cocos2d / cocos2d-console

cocos2d command line tool
152 stars 190 forks source link

use gcc 4.9 instead #365

Closed minggo closed 8 years ago

minggo commented 8 years ago

done in #16245

cezheng commented 8 years ago

why back to gcc again?

minggo commented 8 years ago

can refer to this issue https://github.com/cocos2d/cocos2d-x/issues/16244

cezheng commented 8 years ago

hmm, we've always been using clang long before gcc became deprecated in NDK. NDK r12b seems to have multiple link issues when building with cocos compile

minggo commented 8 years ago

i think i fixed many link issues, will you please create an issue if you still has problem?

cezheng commented 8 years ago

I'm not sure if it is general issue, I will try it on the HelloWorld project first

cezheng commented 8 years ago
/Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a(pr-support.o): multiple definition of '_Unwind_GetRegionStart'
/Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /Users/ce.zheng/android-ndk-r12b/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/armeabi-v7a/libunwind.a(Unwind-EHABI.o): previous definition here
/Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a(pr-support.o): multiple definition of '_Unwind_GetLanguageSpecificData'
/Users/ce.zheng/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /Users/ce.zheng/android-ndk-r12b/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/armeabi-v7a/libunwind.a(Unwind-EHABI.o): previous definition here

The HelloWorld seems to be fine. But our project give error message like this, have you ever seen message like this before? What is weird is that, I'm using the clang toolchain, but ndk-build seems to be trying to link with libgcc.a in the 4.9 toolchain.

Since we can't share the source code here, I have to try to reproduce it in HelloWorld.

minggo commented 8 years ago

Yep, i met it before when using NDK r10, and i don't know how to fix it. It seems it is a bug of NDK. And i haven't met after not using the NDK version.

cezheng commented 8 years ago

@minggo I figured out that this is caused by luajit, as the issue reported says in this issue: https://code.google.com/p/android/issues/detail?id=73907

However we are not using the lua bindings in our project. We have a cpp project that explicitly imports luajit in Android.mk, since we only use lua for some specific event scripts.

This used to work with NDK r10e. But our project is growing and it takes too long to build, so we want to take advantage of clang's precompiled header(by defining LOCAL_PCH) which seems to work in r12b(it didn't in r10e), that's one of the reasons we have to use clang rather than gcc.

I took a look in the lua's project template but didn't find additional settings. Do I need to add any build settings in order to make luajit work with NDK?

I also tested with a lua project, didn't work either with clang & c++_static. Is the luajit.a somehow problematic?

minggo commented 8 years ago

Yep, i reported the issue. But i haven't met it after switching NDK version. Did you want want continue use clang? If so, then i don't know what issues you may meet. Or did have any issue with gcc?

cezheng commented 8 years ago

Our project won't compile with gcc & gnustl, there're many tiny difference like std:to_string and we want to use libdispatch which would require block syntax.

minggo commented 8 years ago

Got it, then you can continue to use clang, but you may meet strange issues. That's why we i change to use gcc.

cezheng commented 8 years ago

Yep, seems this is a ndk issue and we have to stick with r10e at the moment

cezheng commented 8 years ago

Anyway I created an issue here.

cezheng commented 8 years ago

@minggo It seems that ndk r13 beta1 already fixed this issue. So hopefully when r13 stable release comes out, cocos2d-x will be able to switch back to clang & c++_static https://github.com/android-ndk/ndk/issues/176

minggo commented 8 years ago

@cezheng we will switch to clang+c++_static when c++_static is stable

ricardoquesada commented 7 years ago

r13 was released a few days ago. should we migrate to clang?

cezheng commented 7 years ago

we have already switched to r13, so far so good

minggo commented 7 years ago

@ricardoquesada i think it is not a good time to migrate to clang as c++_static is not stable. Am i wrong? We can not make sure clang + gnu_static is stable now as we met some strange crash issues in v3.12.