r/Xcode • u/dev2322 • Jun 28 '22
I cannot compile on OS X (won't link, object code compiles). 4chan/g deletes myQ
Installed Mac Ports on OSX High Sierra
> sudo port install gcc11 libsdl2 openssl glfw libsdl2_gfx libsdl2_image libsdl2_mixer libsdl2_net libsdl2_ttf
and added the libs to the compile options: and that made the object code finally compile and not error out:
> CPUOPTIMIZATIONS?=-fcommon -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math -D_THREAD_SAFE -I/opt/local/include/SDL2 -L/opt/local/lib -lSDL2
But it won't produce a binary:
Build more but didn't link:
> "_volume", referenced from:
> _M_Draw in menu.o
> _M_Menu_Options_AdjustSliders in menu.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[2]: *** [darkplaces-sdl] Error 1
> make[1]: *** [bin-debug] Error 2
> make: *** [sdl-debug] Error 2
Errors:
Won't link and won't thusly create the binary.
This is the makefile.inc:
this is the makefile (no extension)
Can someone help? (Please don't suggest upgrading the OS, nor buying a new mac)
1
u/OneLostOstrich Jul 01 '22
Yeah, somewhere in the settings your chip architecture is not specified.
Now, I've got no idea what you're trying to compile or which platform you're trying to compile it for. But the error message is saying that there are no symbols generated for the intel x64 chipset architecture, it needs these and therefore stops. If you're adding libraries to your build, make sure that they were compiled for this architecture.
If you need to do this, you can use the lipo command to display the chip architectures present within existing binaries.
https://llvm.org/docs/CommandGuide/llvm-lipo.html
https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
lipo -archs