cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.16k stars 7.05k forks source link

cocos2d-x-4 linking error when integrating with libchipmunk on linux,How to compile libchipmunk source code? #20755

Open Sickyour opened 1 year ago

Sickyour commented 1 year ago

Steps to Reproduce:

  1. cd cocos-2d-x-root/
  2. mkdir -p build/linux-build
  3. make ../..
  4. make -j 4 error : linking error when integrating with libchipmunk.a

I want to cross-compile the libchipmunk source code, Specific steps? I would like to compile libchiomunk for specific steps? Thanks you !

Sickyour commented 1 year ago

Development environment system : ubuntu20.04 Dependent tools: gcc-9-aarch64-linux-gnu, g++-9-aarch64-linux-gnu [ 86%] Built target luacocos2d [ 86%] Linking CXX executable ../../../bin/lua-empty-test/lua-empty-test /usr/bin/ld: ../../../../../external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftinit.o): Relocations in generic ELF (EM: 62) /usr/bin/ld: ../../../../../external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftinit.o): Relocations in generic ELF (EM: 62) /usr/bin/ld: ../../../../../external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftinit.o): Relocations in generic ELF (EM: 62) /usr/bin/ld: ../../../../../external/freetype2/prebuilt/linux/64-bit/libfreetype.a: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status make[2]: [engine/tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/build.make:152: bin/cpp-empty-test/cpp-empty-test] Error 1 make[1]: [CMakeFiles/Makefile2:1233: engine/tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/all] Error 2

The questions are as follows:

  1. I compiled the libchipmunk 7.0.0 library, which solved the above problem.
  2. I want to use cross-compiled cocos2d-x-4, how can I modify the CMakeLists.txt file?