Mac OS X Client compiling / linking error

Added by cjlpa about 3 years ago

Hello all,

it's me again :-( Trying to compile on Mac OS X 10.7.4, Xcode 4.3.2, x64 system, following the Wiki and using:

cmake .. -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TESTS=OFF -DWITH_STATIC_EXTERNAL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON

or, alternatively,

cmake .. -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TESTS=OFF -DWITH_STATIC_EXTERNAL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk

but I keep receiving the same error:

Linking CXX executable "../../../bin/Ryzom Core Client.app/Contents/MacOS/Ryzom Core Client"
clang: warning: argument unused during compilation: '-ansi'
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
__nl_find_msg in libintl.a(dcigettext.o)
(maybe you meant: _str_iconv, _iconv_canonicalize , _mem_cd_iconv , _str_cd_iconv )
"_iconv_open", referenced from:
__nl_find_msg in libintl.a(dcigettext.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]: *** [bin/Ryzom Core Client.app/Contents/MacOS/Ryzom Core Client] Error 1
make[1]: *** [ryzom/client/src/CMakeFiles/ryzom_client.dir/all] Error 2
make: *** [all] Error 2

at around 97% completion. Any ideas?

Thanks a lot,
F.


Replies (8)

RE: Mac OS X Client compiling / linking error - Added by kervala about 3 years ago

Hi !

It should be fixed on Hg now :)

But that's strange my curl wasn't depending on iconv on the Mac I have access.

RE: Mac OS X Client compiling / linking error - Added by cjlpa about 3 years ago

Hi,

I checked out the latest version, but the error is still there. I read on the internetz that the "port" version of libiconv doesn't support x64 architecture - does this apply? Is there anything I could paste here that may help narrow down the error source?

Thank you,
F.

RE: Mac OS X Client compiling / linking error - Added by kervala about 3 years ago

I checked on exactly the same config as you and I have :

Mac:Documents kervala$ ls /opt/local/lib/libiconv.*
/opt/local/lib/libiconv.2.dylib /opt/local/lib/libiconv.dylib
/opt/local/lib/libiconv.a /opt/local/lib/libiconv.la

You can verify that using : sudo port install iconv

I'm upgrading my ports and then I'll try again to recompile the whole client from scratch to see if I can reproduce your case.

RE: Mac OS X Client compiling / linking error - Added by kervala about 3 years ago

I recompiled the whole client and it's working fine. iconv is found and linked without any issue, my previous fix seems to be useless because that's libxml2 which requires iconv.

RE: Mac OS X Client compiling / linking error - Added by cjlpa about 3 years ago

Hi,

I did the following:

iMac:build-static root# ls /opt/local/lib/libiconv.*
/opt/local/lib/libiconv.2.dylib /opt/local/lib/libiconv.a /opt/local/lib/libiconv.dylib /opt/local/lib/libiconv.la
iMac:build-static root# port install iconv
Error: Port iconv not found
To report a bug, see <http://guide.macports.org/#project.tickets>
iMac:build-static root# port install libiconv
---> Cleaning libiconv

to no avail - still producing the same error.

edit: as user root

RE: Mac OS X Client compiling / linking error - Added by cjlpa about 3 years ago

What cmake options are you using? the same ones you mentioned in http://dev.ryzom.com/boards/17/topics/5816?r=5970 ??

RE: Mac OS X Client compiling / linking error - Added by kervala about 3 years ago

I just pasted your cmake command to check and it worked :)

RE: Mac OS X Client compiling / linking error - Added by cjlpa about 3 years ago

I made it compile. What I did?
- download the Apple version of libiconv from http://opensource.apple.com/release/mac-os-x-1074/
- compiled it with --enable-static as suggested in http://www.bill.eccles.net/bills_words/2008/12/libiconv-madness.html
- thinned the port version of libiconv.a (lipo libiconv.a -output libiconv.a.64slim -thin x86_64)
- extracted the symbols from the port version of libiconv (ar -x libiconv.a.64slim)
- in a different directory, did the same with the Apple version (ar -x libiconv.a.apple)
- renamed the .o files to .apple.o and .port.o
- copied them into the same directory
- and combined them with ar -r libiconv.a *.o

When copying the resulting libiconv.a to /opt/local/lib/, it compiled fine :-) though it (of course) warned about double symbols in the lazy-linked static library libiconv.a.

The problem was / is that libintl or dcigettext.o reference the symbol "_iconv" and "_iconv_open", whereas libxml2 and libidn or encoding.o and striconv.o rference the symbol "_libiconv", "_libiconv_open" and "_libiconv_close".
The port version provides the symbols "_libiconv_whatever", whereas the Apple version provides "_iconv_whatever" (without lib). you can check that with $ nm libiconv.a

I don't know if the error is with port, iconv, or my Mac.

Anyway, thank you for all the help!
F.

(1-8/8)