问题
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?
回答1:
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.
回答2:
Using bdash's answer you can build iOS openssl-1.1.1 by doing the following:
sed -ie "s!-Bsymbolic! !" "Makefile"
sed -ie "s/-Wl,-soname=libssl\$(SHLIB_EXT)/ /g" "Makefile"
sed -ie "s/-Wl,-soname=libcrypto\$(SHLIB_EXT)/ /g" "Makefile"
sed -ie "s/--version-script=libcrypto.map/ /g" "Makefile"
sed -ie "s/--version-script=libssl.map/ /g" "Makefile"
来源:https://stackoverflow.com/questions/15090198/ld-unknown-option-bsymbolic-when-trying-to-build-iniparser-on-osx