PureBasic 5.31 linux GCC flags when generating executable

Just starting out? Need help? Post your questions and find answers here.
pv081079
New User
New User
Posts: 8
Joined: Sun Dec 19, 2021 6:11 pm

PureBasic 5.31 linux GCC flags when generating executable

Post 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,
User avatar
mk-soft
Always Here
Always Here
Posts: 6207
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PureBasic 5.31 linux GCC flags when generating executable

Post by mk-soft »

No sure, but you need only

Code: Select all

Import "-no-pie"
endimport
in first lines
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
pv081079
New User
New User
Posts: 8
Joined: Sun Dec 19, 2021 6:11 pm

Re: PureBasic 5.31 linux GCC flags when generating executable

Post by pv081079 »

Solved :D :x :D :D :D

Thank you
hamtronix
New User
New User
Posts: 5
Joined: Wed Jan 31, 2024 4:08 pm

Re: PureBasic 5.31 linux GCC flags when generating executable

Post 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
Post Reply