Render96 / Render96ex

Fork of https://github.com/sm64-port/sm64-port with additional features.
245 stars 43 forks source link

Building on FreeBSD #73

Open ezntek opened 1 year ago

ezntek commented 1 year ago

I'm trying to build this for FreeBSD in hopes of a PR (which i submitted for sm64pc/sm64ex), but the linker complains about an undefined symbol: stderr (output when executing gmake:

gmake: Entering directory '/usr/home/ezntek/Sources/Render96ex/tools'
cc -I../include -I. -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s -Iaudiofile -Wno-uninitialized sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c -o tabledesign -lm -Laudiofile -laudiofile -lstdc++ -lm
ld: error: undefined symbol: stderr
>>> referenced by audiofile.cpp
>>>               audiofile.o:(defaultErrorFunction(long, char const*)) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(defaultErrorFunction(long, char const*)) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(defaultErrorFunction(long, char const*)) in archive audiofile/libaudiofile.a
>>> referenced 13 more times

ld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)
>>> referenced by audiofile.cpp
>>>               audiofile.o:(void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) (.isra.0)) in archive audiofile/libaudiofile.a

ld: error: undefined symbol: __errno_location
>>> referenced by audiofile.cpp
>>>               audiofile.o:(FileModule::reportWriteError(long, long)) in archive audiofile/libaudiofile.a

ld: error: undefined symbol: stdout
>>> referenced by audiofile.cpp
>>>               audiofile.o:(_af_print_filehandle(_AFfilehandle*)) in archive audiofile/libaudiofile.a

ld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)
>>> referenced by audiofile.cpp
>>>               audiofile.o:(AudioFormat::description[abi:cxx11]() const) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(AudioFormat::description[abi:cxx11]() const) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(AudioFormat::description[abi:cxx11]() const) in archive audiofile/libaudiofile.a
>>> referenced 4 more times

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by audiofile.cpp
>>>               audiofile.o:(AudioFormat::description[abi:cxx11]() const) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_realloc_insert<unsigned long const&>(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned long const&)) in archive audiofile/libaudiofile.a
>>> referenced by audiofile.cpp
>>>               audiofile.o:(void std::vector<SharedPtr<Chunk>, std::allocator<SharedPtr<Chunk> > >::_M_realloc_insert<SharedPtr<Chunk> >(__gnu_cxx::__normal_iterator<SharedPtr<Chunk>*, std::vector<SharedPtr<Chunk>, std::allocator<SharedPtr<Chunk> > > >, SharedPtr<Chunk>&&)) in archive audiofile/libaudiofile.a
>>> referenced 1 more times
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:47: tabledesign] Error 1
gmake: Leaving directory '/usr/home/ezntek/Sources/Render96ex/tools'
Makefile:236: *** Failed to build tools.  Stop.

)

setting CC=gcc in the makefile results in something similar:

gmake: Entering directory '/usr/home/ezntek/Sources/Render96ex/tools'
gcc -I../include -I. -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s -Iaudiofile -Wno-uninitialized sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c -o tabledesign -lm -Laudiofile -laudiofile -lstdc++ -lm
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o): in function `defaultErrorFunction(long, char const*)':
audiofile.cpp:(.text+0x1130): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0x113c): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0x114b): undefined reference to `stderr'
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o): in function `Track::print()':
audiofile.cpp:(.text+0x4450): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0x446a): undefined reference to `stderr'
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o):audiofile.cpp:(.text+0x4486): more undefined references to `stderr' follow
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o): in function `FileModule::reportWriteError(long, long)':
audiofile.cpp:(.text+0x5749): undefined reference to `__errno_location'
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o): in function `_af_print_filehandle(_AFfilehandle*)':
audiofile.cpp:(.text+0x6b33): undefined reference to `stdout'
/usr/local/bin/ld: audiofile/libaudiofile.a(audiofile.o): in function `ModuleState::print()':
audiofile.cpp:(.text+0x9f55): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0x9fa4): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0x9fd5): undefined reference to `stderr'
/usr/local/bin/ld: audiofile.cpp:(.text+0xa02e): undefined reference to `stderr'
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:47: tabledesign] Error 1
gmake: Leaving directory '/usr/home/ezntek/Sources/Render96ex/tools'
Makefile:236: *** Failed to build tools.  Stop.

Digging a bit deeper, I found this, which suggested that this is a feature in glibc only. Is this glibc requirement necessary to some features in R96ex (seeing as this compalins about libaudiofile and c++), or can this restriction be removed? Don't want to make any unfair comparisons, but sm64ex (which is what this is forked from) supports FreeBSD in terms of compilation. Any help would be appreciated, because I'm building a sm64pclauncher/smlinux inspired kind of thing for Unix-like systems.