Cross compiling C output with gcc/ld

Just starting out? Need help? Post your questions and find answers here.
Yann64
User
User
Posts: 32
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

Cross compiling C output with gcc/ld

Post by Yann64 »

I am investigating if it is possible to cross-compile Purebasic C output using a gcc/ld cross compiler (on linux x86_64).
I am using gcc and ld for the target architecture.

First step is extracting/getting the C code:

Code: Select all

pbcompilerc -c ./main.pb
Gives me a purebasic.c file.

Then compiling the code seem to be working (using the gcc for the target architecture):

Code: Select all

PBHOME=~/purebasic
PBINCLUDES="$PBHOME/sdk/c/PureLibraries"
gcc -c -I$PBINCLUDES ./purebasic.c
Gives me a purebasic.o file.

But using ld to link using *.a and *.o files return returns errors (missing symbols).

Which linker is being used for PureBasic on linux. Is it ld? And if yes, which libraries does it link against?
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Cross compiling C output with gcc/ld

Post by mk-soft »

Not right way,

the pb compiler executes many compilation and linker options

See pbcompilerc help:
-ra, --reasm, /REASM: re-assembles the 'purebasic.asm' or 'purebasic.c' file into an executable. This allow to use the '--commented' option, modify the generated output and creates the executable again.
This option is for advanced programmers only.
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
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: Cross compiling C output with gcc/ld

Post by juergenkulow »

Code: Select all

gcc -Xlinker --help
Post Reply