Page 1 of 1

PureBasic 5.31 linux GCC flags when generating executable

Posted: Sun Dec 19, 2021 6:15 pm
by pv081079
Hi,

It is possible to add -no-pie gcc flag while generating the linux binary executable? or something

to avoid this error:

Symbol `exit' causes overflow in R_X86_64_PC32 relocation

Thanks,

Re: PureBasic 5.31 linux GCC flags when generating executable

Posted: Sun Dec 19, 2021 6:21 pm
by mk-soft
No sure, but you need only

Code: Select all

Import "-no-pie"
endimport
in first lines

Re: PureBasic 5.31 linux GCC flags when generating executable

Posted: Sun Dec 19, 2021 6:34 pm
by pv081079
Solved :D :x :D :D :D

Thank you

Re: PureBasic 5.31 linux GCC flags when generating executable

Posted: Wed Jan 31, 2024 4:16 pm
by hamtronix
I have similar issue and solution with

Code: Select all

Import "no-pie" 
EndImport 
allows to compile the code without error (mentioned below).
However created executable is not running and gives error

Code: Select all

Illegal instruction (core dumped)
.

I am running Ubuntu Linux 22.04 LTS, PureBasic 5.31.
Any idea how to solve that ?

Original issue when the Import is not used:

******************************************
PureBasic 5.31 (Linux - x64)
******************************************
Loading external modules...
Starting compilation...
27394 lines processed.
Creating the executable.
Error: Linker
/usr/bin/ld: purebasic.o: warning: relocation in read-only section `.text'
/usr/bin/ld: purebasic.o: relocation R_X86_64_PC32 against symbol `exit@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status