Archived

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

Mavericks Build Failure because of unexported symbols

Install dependencies with de-facto standard homebrew on brand new machine with OSX Mavericks 10.9 (i.e. not upgraded from something else)

Attempt to build Ice 4.5.1 with Xcode 5.0.1 clang compiler.

Use modification detailed in http://www.zeroc.com/forums/bug-reports/6151-cant-build-osx-mavericks-because-ssl-deprecation.html to get past previous error.
xcrun clang++ -Wl,-rpath,@loader_path/../lib  -g -Wall -Werror -L../../lib -o ../../bin/icegridnode Internal.o DescriptorParser.o DescriptorBuilder.o TraceLevels.o FileCache.o PlatformInfo.o SessionManager.o NodeI.o NodeServerAdminRouter.o ServerI.o ServerAdapterI.o Activator.o NodeSessionManager.o AdminCallbackRouter.o RegistryI.o RegistryServerAdminRouter.o InternalRegistryI.o Allocatable.o AdapterCache.o ObjectCache.o AllocatableObjectCache.o ServerCache.o NodeCache.o ReplicaCache.o Database.o LocatorI.o LocatorRegistryI.o AdminI.o Util.o DescriptorHelper.o NodeSessionI.o ReplicaSessionI.o ReapThread.o SessionI.o AdminSessionI.o SessionServantManager.o Topics.o QueryI.o FileUserAccountMapperI.o ReplicaSessionManager.o WellKnownObjectsManager.o IceGridNode.o -lIceGrid -lIceStorm -lIceStormService -lIceBox -lGlacier2 \
	-lIcePatch2 -lIceDB  -lIceXML -lIceSSL  -lssl -lcrypto -lIce -lIceUtil
Undefined symbols for architecture x86_64:
  "IceGrid::ServerInstanceHelper::operator=(IceGrid::ServerInstanceHelper const&)", referenced from:
      void std::__1::__tree<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper> > >::__assign_multi<std::__1::__tree_const_iterator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, void*> const*, long> >(std::__1::__tree_const_iterator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, void*> const*, long>, std::__1::__tree_const_iterator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, IceGrid::ServerInstanceHelper>, void*> const*, long>) in DescriptorHelper.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/icegridnode] Error 1
make[1]: *** [IceGrid] Error 2
make: *** [all] Error 1

This happens because:
$ nm src/IceGrid/DescriptorHelper.o | c++filt | grep ServerInstanceHelper::operator=
                 U IceGrid::ServerInstanceHelper::operator=(IceGrid::ServerInstanceHelper const&)

Not sure how to solve that.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Try removing line 250 in cpp/src/IceGrid/DescriptorHelper.h, this should fix the problem. We'll fix this for the next release, thanks for pointing it out.

    Cheers,
    Benoit.
  • I commented out
    void operator=(const ServerInstanceHelper&);
    

    but somewhat unsurprisingly that just leads to:
    xcrun clang++ -c -pthread -I../../include -I.. -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6    -g -Wall -Werror DescriptorHelper.cpp
    In file included from DescriptorHelper.cpp:11:
    ../IceGrid/DescriptorHelper.h:243:7: error: member function 'operator=' not viable: 'this' argument has type 'const IceGrid::ServerInstanceDescriptor', but function is not marked
          const
    class ServerInstanceHelper : public InstanceHelper
          ^~~~~~~~~~~~~~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:1246:35: note: in instantiation of member function
          'std::__1::pair<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper>::operator=' requested here
                    __cache->__value_ = *__first;
                                      ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:1187:9: note: in instantiation of function template specialization
          'std::__1::__tree<std::__1::pair<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper>, std::__1::__map_value_compare<std::__1::basic_string<char>,
          IceGrid::ServerInstanceHelper, std::__1::less<std::__1::basic_string<char> >, true>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char>,
          IceGrid::ServerInstanceHelper> > >::__assign_multi<std::__1::__tree_const_iterator<std::__1::pair<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper>, const
          std::__1::__tree_node<std::__1::pair<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper>, void *> *, long> >' requested here
            __assign_multi(__t.begin(), __t.end());
            ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:766:21: note: in instantiation of member function
          'std::__1::__tree<std::__1::pair<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper>, std::__1::__map_value_compare<std::__1::basic_string<char>,
          IceGrid::ServerInstanceHelper, std::__1::less<std::__1::basic_string<char> >, true>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char>,
          IceGrid::ServerInstanceHelper> > >::operator=' requested here
                __tree_ = __m.__tree_;
                        ^
    DescriptorHelper.cpp:2169:13: note: in instantiation of member function 'std::__1::map<std::__1::basic_string<char>, IceGrid::ServerInstanceHelper,
          std::__1::less<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, IceGrid::ServerInstanceHelper> > >::operator=' requested
          here
        updated = getDictUpdatedElts(helper._servers, _servers);
                ^
    ../../include/IceGrid/Descriptor.h:749:8: note: 'operator=' declared here
    struct ServerInstanceDescriptor
           ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/utility:256:16: note: implicit default copy assignment operator for
          'IceGrid::ServerInstanceHelper' first required here
            second = __p.second;
                   ^
    1 error generated.
    make[2]: *** [DescriptorHelper.o] Error 1
    make[1]: *** [IceGrid] Error 2
    make: *** [all] Error 1
    
  • benoit
    benoit Rennes, France
    Mavericks and Xcode 5.0.1 use by default the libc++ library and target 10.9. It looks like a problem specific to libc++ and 10.9. I don't get this problem when compiling on 10.8 with the same Xcode version (either with libc++ or libstdc++ using the CPP11=yes|no setting).

    For now, you should be able to workaround the problem by adding -mmacosx-version-min=10.8 to the CPPFLAGS in cpp/config/Make.rules.Darwin or set MACOSX_DEPLOYMENT_TARGET=10.8 in your environment before building (and after a make clean).

    Note that we also provide an OS X installer for Ice, see our download page.

    Cheers,
    Benoit.
  • Then this happens

    Changing cpp/config/Make.rules.Darwin:
    - CPPFLAGS            += -pthread
    + CPPFLAGS           += -pthread -mmacosx-version-min=10.8
    

    Results in (Too long to post here):

    xcrun clang++ -dynamiclib -g -Wall -Werror -L../../lib -o ../../lib/libIceUtil - Pastebin.com


    Or doing this before building:
    export MACOSX_DEPLOYMENT_TARGET=10.8
    

    Results in:
    xcrun clang++  -dynamiclib  -g -Wall -Werror -L../../lib -o ../../lib/libFreeze.3.5.1.dylib -install_name @rpath/libFreeze.35.dylib   BackgroundSaveEvictor.o BackgroundSaveEvictorI.o CatalogData.o Catalog.o CatalogIndexList.o ConnectionI.o Connection.o DB.o EvictorI.o EvictorIteratorI.o EvictorStorage.o Evictor.o Exception.o IndexI.o Index.o MapDb.o MapI.o ObjectStore.o PingObject.o SharedDbEnv.o TransactionalEvictor.o TransactionalEvictorI.o TransactionalEvictorContext.o TransactionHolder.o TransactionI.o Transaction.o Util.o  -lIce -lIceUtil -ldb_cxx
    Undefined symbols for architecture x86_64:
      "Db::set_error_stream(std::ostream*)", referenced from:
          vtable for Freeze::MapDb in MapDb.o
      "Db::set_message_stream(std::ostream*)", referenced from:
          vtable for Freeze::MapDb in MapDb.o
      "Db::verify(char const*, char const*, std::ostream*, unsigned int)", referenced from:
          vtable for Freeze::MapDb in MapDb.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]: *** [../../lib/libFreeze.3.5.1.dylib] Error 1
    make[1]: *** [Freeze] Error 2
    make: *** [all] Error 1
    
  • xdm
    xdm La Coruña, Spain
    It will work if you use our OS X third party packages, the DB package you are using seems was build without setting MACOSX_DEPLOYMENT_TARGET=10.8, and so it is using a different C++ runtime. The default C++ runtime has changed for 10.9.

    You can get the OS X third party packages from our download page, if you want to build the third party packages your self you will need to also set MACOSX_DEPLOYMENT_TARGET=10.8 when you build DB, so it uses the same c++ runtime than Ice.
  • xdm wrote: »
    It will work if you use our OS X third party packages, the DB package you are using seems was build without setting MACOSX_DEPLOYMENT_TARGET=10.8, and so it is using a different C++ runtime. The default C++ runtime has changed for 10.9.

    You can get the OS X third party packages from our download page, if you want to build the third party packages your self you will need to also set MACOSX_DEPLOYMENT_TARGET=10.8 when you build DB, so it uses the same c++ runtime than Ice.

    Ok, I see that that will probably work, but you still have a pretty serious issue here going forwards.
  • xdm
    xdm La Coruña, Spain
    If you want to build with 10.9 without using the previous workaround. You need to remove the const qualifier from DescriptorHelper.h line 268
    - const ServerInstanceDescriptor _def;
    + ServerInstanceDescriptor _def;
    

    You need to also comment out the operator= from line 250 as Benoit commented.

    The problem is that types used in std::map must be assignable, an a const member prevents the compiler from generated the assignment operator.
  • xdm wrote: »
    If you want to build with 10.9 without using the previous workaround. You need to remove the const qualifier from DescriptorHelper.h line 268
    - const ServerInstanceDescriptor _def;
    + ServerInstanceDescriptor _def;
    

    You need to also comment out the operator= from line 250 as Benoit commented.

    The problem is that types used in std::map must be assignable, an a const member prevents the compiler from generated the assignment operator.

    Much better solution, thanks. I guess both of these will be fixed in the next release as it's a general c++11 problem? As it's meant to be const you'll just have to implement it yourself.