Archived

This forum has been archived. Please start a new discussion on GitHub.

Linker error while building for iOS target Ice

Hello All .

Facing a linker issue while building ice for iOS target.
_iconv", referenced from:
IceUtil::IconvStringConverter::toUTF8(char const*, char const*, IceUtil::UTF8Buffer&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::fromUTF8(unsigned char const*, unsigned char const*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::toUTF8(wchar_t const*, wchar_t const*, IceUtil::UTF8Buffer&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::fromUTF8(unsigned char const*, unsigned char const*, std::__1::basic_string<wchar_t, std::__1::char_traits, std::__1::allocator >&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
"_iconv_open", referenced from:
IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
"_iconv_close", referenced from:
IceUtil::IconvStringConverter::close(std::__1::pair<void*, void*>) in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::close(std::__1::pair<void*, void*>) in libIce.a(StringConverterPlugin_Ice_cpp.o)
IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)

How to overcome this. Pls suggest will be really helpful.

Tagged:

Comments

  • benoit
    benoit Rennes, France

    Hi,

    Which Ice version do you use? Did you add -liconv to the linker options in your Xcode project?

    See https://doc.zeroc.com/ice/3.7/release-notes/using-the-macos-binary-distribution#id-.UsingthemacOSBinaryDistributionv3.7-UsingXcodeSDKs for information on how to use the Xcode SDKs.

    Cheers,
    Benoit.

  • Ice touch 3.7.
    I am not using Xcode instead building my project from Qt creator.
    I don't think the Xcode has iconv library for iOS target.

  • @benoit - Can you pls respond. I need a way to link to iconv from Makefile for iOS not the dylib or tbd way from Xcode.

  • benoit
    benoit Rennes, France

    Hi,

    Hmm why do you think Xcode doesn't support the iconv library for iOS? It's in the Xcode iPhoneOS sdk (at the following location with my Xcode installation:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libiconv.tbd).

    What error do you get when you add the link with the iconv library to your Qt project?

    Cheers,
    Benoit.

  • @benoit - Unfortunately the .tbd can be interpreted by Xcode only not the Qt .pro., .pri.

    I want to have references to a static library. which i can put in these project like.
    LIBS += -L$$PATH/lib -liconv

    If you know how to add .tbd to project pls suggest. thx

  • benoit
    benoit Rennes, France

    I'm not very familiar with QtCreator and qmake... doesn't qmake create an Xcode projet from the Qt .pro file?

    The iconv library is installed as a dynamic library on iOS devices. I don't think Apple provides a static library for it so you'll need to dynamically link with this library. The fact that Apple only provides a stub (the .tbd file) in the iPhoneOS SDK shouldn't be an issue. The clang compiler should be able to deal with it and you shouldn't have to specify the library path with -L<path>/lib if the Qt build system calls xcrun -sdk iphoneos clang++ or uses Xcode to build the application.

    Can you copy/paste the error you get if you just add LIBS += -liconv to your Qt .pro file? Can you also copy the compiler/linker output showing the build flags?

    Btw, Ice Touch 3.7 doesn't exist... we've integrated Ice Touch into the main Ice 3.7 distribution. It looks like you're still using Ice Touch <= 3.6. I recommend to upgrade to Ice 3.7.2 instead, it supports the latest Xcode versions.

    Cheers,
    Benoit.

  • @benoit
    The linker error are same i started this forum topic.
    Undefined symbols for architecture arm64:
    "_iconv", referenced from:
    IceUtil::IconvStringConverter::toUTF8(char const*, char const*, IceUtil::UTF8Buffer&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::fromUTF8(unsigned char const*, unsigned char const*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::toUTF8(wchar_t const*, wchar_t const*, IceUtil::UTF8Buffer&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::fromUTF8(unsigned char const*, unsigned char const*, std::__1::basic_string<wchar_t, std::__1::char_traits, std::__1::allocator >&) const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    "_iconv_open", referenced from:
    IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    "_iconv_close", referenced from:
    IceUtil::IconvStringConverter::close(std::__1::pair<void*, void*>) in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::close(std::__1::pair<void*, void*>) in libIce.a(StringConverterPlugin_Ice_cpp.o)
    IceUtil::IconvStringConverter::createDescriptors() const in libIce.a(StringConverterPlugin_Ice_cpp.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    The compiler is provided by Mac for iOS and is integrated with Qt build system itself. It works very well if i do not have dependency on ICE.

    Note: If i remove LIBS += -liconv and build for Mac OSX target it builds without linker errors.

  • benoit
    benoit Rennes, France

    Hi,

    Can you provide the build log that shows the compiler/linker flags? Which Xcode version do you use and which iOS version do you target?

    Cheers,
    Benoit.

  • @benoit
    I could resolve this however not in Qt but in Xcode.
    There are three libiconv.tbd available in iOS SDK. the one which worked is libiconv2.4.0.tbd

    I think their shall be a way to add .tbd dependencies in Qt project file, at present it is not blocking me.

    Thanks for help.