问题描述
我正在尝试在Mac OS X Lion中编译GCC 4.5.1.
I am trying to compile GCC 4.5.1 in Mac OS X Lion.
我对libiconv有问题.首先,它抱怨架构x86_64的未定义符号,它们是:_iconv,_iconv_open和_iconv_close.我发现libiconv的MacPorts版本将其重命名为:_libiconv,_libiconv_open和_libiconv_close.因此,我链接到/usr/lib中的Mac OS本机libiconv而不是/opt/local/lib中的MacPorts库.
I have a problem with libiconv. First it complained about undefined symbols for architecture x86_64, which were: _iconv, _iconv_open and _iconv_close. I found out that MacPorts version of libiconv rename those to: _libiconv, _libiconv_open and _libiconv_close. So I linked to the Mac OS native libiconv in /usr/lib instead of the MacPorts library in /opt/local/lib.
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_convert_using_iconv in libcpp.a(charset.o)
__nl_find_msg in libintl.a(dcigettext.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
"_iconv_close", referenced from:
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
__nl_free_domain_conv in libintl.a(loadmsgcat.o)
"_iconv_open", referenced from:
_init_iconv_desc in libcpp.a(charset.o)
__nl_init_domain_conv in libintl.a(loadmsgcat.o)
但是,这样做之后,我尝试从一开始就对其进行重建(清理和所有操作),但是随后它又抱怨未定义符号,但是这次是_libiconv,_libiconv_open和_libiconv_close.
However, after doing that, I tried to rebuild it from the beginning (cleaning and everything), but then it complained at a different point about undefined symbols, but this time _libiconv, _libiconv_open and _libiconv_close.
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_identifier_to_locale in libbackend.a(pretty-print.o)
"_libiconv_close", referenced from:
_identifier_to_locale in libbackend.a(pretty-print.o)
"_libiconv_open", referenced from:
_identifier_to_locale in libbackend.a(pretty-print.o)
关于我该如何处理?我已经找到了一些从MacPorts卸载libiconv的解决方案,但是我不想这样做,因为我有很多依赖它的端口.
Is there any idea about how I can deal with this? I have found some solutions uninstalling libiconv from MacPorts, but I don't want to do it, as I have many ports depending on it.
推荐答案
我通过以下方式解决了该问题:
I solved it by:
$ sudo port -f deactivate libiconv
$ ...build my project...
$ sudo port activate libiconv
也许有更好的方法,但是我不直接使用GCC,因此这是一个临时解决方法.
There's probably a better way but I'm not using GCC directly, so this helps as a temporary workaround.
这篇关于libiconv和MacOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!