Search code examples
macosbuildld

"ld: unknown option: -Bsymbolic" when trying to build iniparser on OSX


I'm trying to build http://github.com/ndevilla/iniparser on OSX, but getting:

~/ make
compiling src/iniparser.c ...
compiling src/dictionary.c ...
a - src/iniparser.o
a - src/dictionary.o
ld: unknown option: -Bsymbolic
collect2: ld returned 1 exit status
make: *** [libiniparser.so] Error 1

This seems to not be a known issue with the code itself. What do I need to adjust on my system?


Solution

  • The -Bsymbolic flag specified in the Makefile of that project is specific to the GNU linker and platforms using the ELF binary format. OS X uses neither. The Makefile has several other flags that aren't compatible with the OS X toolchain, such as the use of the .so extension for shared libraries rather than .dylib, and another unsupported linker flag (-Wl,-soname=…). You should be able to remove the unsupported linker flags and then fix up the file extensions to make things work.