Cross-compiling in 64-bit CentOS via gcc.. and ubuntu.

General FreeBASIC programming questions.
Post Reply
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Cross-compiling in 64-bit CentOS via gcc.. and ubuntu.

Post by agamemnus »

CentOS is pretty much needed if you want to have a cPanel and WHM in your server. And, let's say you're making a game engine or whatever... and want to use FB... what do you do?

Many thanks to dkl here... it is possible. I don't have the exact steps right now but generally --

First, I compiled (in an Ubuntu 32-bit VM) the 64-bit version of FB, which should be arriving soon I guess.

Then I compiled and got the c file via:

Code: Select all

fbc -v -R -Wl -rpath-link=. -arch 64 [filename]
Then I copied the /usr/local/lib/freebasic and /usr/lib/gcc/i686-linux-gnu stuff to centOS.

Then I compiled with gcc under centos. With a filename tp.c/.o/.asm/.bas:

Code: Select all

gcc -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables "tp.c" -o "tp.asm"
as --64 --strip-local-absolute "tp.asm" -o "tp.o"
ld -m elf_x86_64 -o "tp" -dynamic-linker /lib64/ld-linux-x86-64.so.2 "/usr/local/bin/../lib/freebasic/x86_64-linux/fbextra.x" -s -L "/usr/local/bin/../lib/freebasic/x86_64-linux" -L "." -L "/usr/lib/gcc/i686-linux-gnu/4.6/64" "/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib64/crt1.o" "/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib64/crti.o" "/usr/lib/gcc/i686-linux-gnu/4.6/64/crtbegin.o" "/usr/local/bin/../lib/freebasic/x86_64-linux/fbrt0.o" "tp.o" "-(" -lmysqlclient -lfb -ltinfo -lm -ldl -lsupc++ -lpthread -lgcc -lgcc_eh -lc "-)" "/usr/lib/gcc/i686-linux-gnu/4.6/64/crtend.o" "/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib64/crtn.o"  -rpath-link=. 
Seems to work? I also tried with 64-bit ubuntu but ran into problems.
Post Reply