OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

Orange C failed to link on FreeBSD

Open ghost opened this issue 1 year ago • 5 comments

Here is the error message on FreeBSD:

clang++ -c -D__MSVCRT__ -DHAVE_UNISTD_H=1 -DSQLITE_OS_UNIX -Wno-int-to-pointer-cast -I../util -I../exefmt -I../ -fpermissive  -DGNUC -std=gnu++14 -o /test/OrangeC/src/netlib/obj/gcc-linux/NetLinkMain.o NetLinkMain.cpp
clang -L/test/OrangeC/src/../src/lib/gcc-linux -o netlib.exe /test/OrangeC/src/netlib/obj/gcc-linux/NetLinkMain.o -Wl,--start-group -lnetlib -lutil -Wl,--end-group -lstdc++ -lpthread -ldl 
ld: error: undefined symbol: ceilf
>>> referenced by NetLinkMain.cpp
>>>               /test/OrangeC/src/netlib/obj/gcc-linux/NetLinkMain.o:(std::__1::__math::ceil[abi:se180100](float))
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Build command: gmake COMPILER="gcc-linux" CC=clang CXX=clang++.

ghost avatar Sep 16 '24 10:09 ghost

How did you run the build? I guess with GNU make?

As we already found out in the other thread #1044, the Makefile shouldn't use -D__MSVCRT__ on this environment #1049 and additionally needs -lm.

GitMensch avatar Sep 16 '24 10:09 GitMensch

How did you run the build? I guess with GNU make?

Of course. The command is gmake. If you use only make, it will invoke BSD make (bmake) instead.

ghost avatar Sep 16 '24 10:09 ghost

gcc and g++ on freebsd don't display this behavior for whatever reason but clang and clang++ do. I can confirm that adding -lm as the LINK flag fixes the issue with the linker crashing out, however. When I do my big "Add verbosity/mkfifo" changes I'll push a fix for this.

chuggafan avatar May 07 '25 01:05 chuggafan

gcc may automatically add -lm I'm not sure....

LADSoft avatar May 07 '25 02:05 LADSoft

This depends on the spec file that is installed - gcc's configure machinary checks for libraries it always need to link "specific for this machine", and adds it there.

GitMensch avatar May 07 '25 05:05 GitMensch