2.2.0 build error (and solution)


I tried to build 2.2.0 on ubuntu 13.10 64 bit and came up to this error:

LINK bin/debug/TestCpp
/usr/bin/ld: /home/dmen/workspace/cocos2d-x-2.2.0/lib/linux/debug/libextension.a(HttpClient.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: [bin/debug/TestCpp] Error 1
make[1]: Leaving directory `/home/dmen/workspace/cocos2d-x-2.2.0/samples/Cpp/TestCpp/proj.linux'
make: [all] Error 2

Solved it by switching to the gold linker instead of the default ld:

  • Edit “/cocos2d-x-2.2.0/cocos2dx/proj.linux/cocos2dx.mk”
  • Add “-fuse-ld=gold” to “CCFLAGS” and “CXXFLAGS”

Some links that give insight for this issue:


Thx a lot.