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

狂风中的少年 提交于 2021-01-27 17:36:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!