Linking errors when I compiling minetest on Mac OSX

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
glut32
Posts: 3
Joined: Tue Mar 28, 2017 2:29 pm

Linking errors when I compiling minetest on Mac OSX

Post by glut32 »

Hi all,

I compile Irrlicht 1.9 with xcode this morning and I have 3 linking errors when I want to generate my game. CIrrDeviceOSX.mm file is an objective-c code. I think that the errors are inside "std::map<int,int> KeyCodes;" inside https://github.com/zaki/irrlicht/blob/m ... eviceOSX.h and used by https://github.com/zaki/irrlicht/blob/m ... viceOSX.mm

There are a strange thing is that there are no problem for other code inside irrlicht 1.9. Maybe it's that the file is Objective-C the problem and the signature of methods are different? or it's a different version of c++ (c++11 or more)

Thanks in advance for your help

This is the linking error message :

Code: Select all

    Ld bin/Debug/minetest normal x86_64
        cd /Users/bluholm/Desktop/minetest-release/minetest
        export MACOSX_DEPLOYMENT_TARGET=10.12
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/bluholm/Desktop/minetest-release/minetest/bin/Debug -F/Users/bluholm/Desktop/minetest-release/minetest/bin/Debug -filelist /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest.LinkFileList -mmacosx-version-min=10.12 -Xlinker -object_path_lto -Xlinker /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest_lto.o -Xlinker -no_deduplicate -lc++ -pagezero_size 10000 -image_base 100000000 -Wl,-search_paths_first -Wl,-headerpad_max_install_names /usr/lib/libz.dylib /usr/local/Cellar/irrlicht/1.9/lib/libIrrlicht.a -framework OpenGL -framework OpenAL /usr/local/lib/libvorbisfile.dylib /usr/local/lib/libvorbis.dylib /usr/local/lib/libogg.dylib /usr/lib/libsqlite3.dylib /usr/local/lib/libluajit-5.1.dylib /Users/bluholm/Desktop/minetest-release/minetest-osx/src/gmp/Debug/libgmp.a /Users/bluholm/Desktop/minetest-release/minetest-osx/src/jsoncpp/json/Debug/libjsoncpp.a -framework CoreFoundation -lpthread /usr/lib/libiconv.dylib -framework Carbon -framework Cocoa -framework IOKit /usr/lib/libiconv.dylib /usr/lib/libcurl.dylib /usr/local/lib/libfreetype.dylib /Users/bluholm/Desktop/minetest-release/minetest-osx/src/cguittfont/Debug/libcguittfont.a /usr/lib/libcurses.dylib /usr/lib/libform.dylib /usr/local/lib/libhiredis.dylib -framework Carbon -framework Cocoa -framework IOKit /usr/lib/libcurl.dylib /usr/lib/libcurses.dylib /usr/lib/libform.dylib /usr/local/lib/libhiredis.dylib /usr/lib/libz.dylib /usr/local/Cellar/irrlicht/1.9/lib/libIrrlicht.a /usr/local/lib/libfreetype.dylib -Xlinker -dependency_info -Xlinker /Users/bluholm/Desktop/minetest-release/minetest-osx/src/minetest.build/Debug/minetest.build/Objects-normal/x86_64/minetest_dependency_info.dat -o /Users/bluholm/Desktop/minetest-release/minetest/bin/Debug/minetest
 
    Undefined symbols for architecture x86_64:
      "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:
          std::_Rb_tree_iterator<std::pair<int const, int> >::operator--() in libIrrlicht.a(CIrrDeviceOSX.o)
      "std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:
          std::_Rb_tree_iterator<std::pair<int const, int> >::operator++() in libIrrlicht.a(CIrrDeviceOSX.o)
      "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
          std::_Rb_tree<int, std::pair<int const, int>, std::_Select1st<std::pair<int const, int> >, std::less<int>, std::allocator<std::pair<int const, int> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<int const, int> const&) in libIrrlicht.a(CIrrDeviceOSX.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
 
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Linking errors when I compiling minetest on Mac OSX

Post by CuteAlien »

Indeed very strange to see std linker errors - as Irrlicht doesn't use the standard library at all. I don't think we are to blame here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
glut32
Posts: 3
Joined: Tue Mar 28, 2017 2:29 pm

Re: Linking errors when I compiling minetest on Mac OSX

Post by glut32 »

Check the file CIrrDeviceOSX.h (https://github.com/zaki/irrlicht/blob/m ... eviceOSX.h) and the file CIrrDeviceOSX.mm (https://github.com/zaki/irrlicht/blob/m ... viceOSX.mm).

You have a STL Map used inside those files : "std::map<int,int> KeyCodes;"...
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Linking errors when I compiling minetest on Mac OSX

Post by CuteAlien »

Argh, why... that shouldn't be in there :-( Unfortunately I can't help with OS X myself as I have no Mac. I hope Nadro sees this thread.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Linking errors when I compiling minetest on Mac OSX

Post by Nadro »

I fixed that in the latest commit to ogl-es branch.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply