playgameservices / cpp-android-basic-samples

Sample games using the Google Play Games C++ SDK
302 stars 133 forks source link

arm64-v8a build fails: no .eh_frame_hdr table will be created #48

Open stolk opened 7 years ago

stolk commented 7 years ago

Using gpg-cpp-sdk v2.3, I was able to create an armeabi-v7a build. Yet, when linking for arm64-v8a, it fails on no .eh_frame_hdr table will be created

Which compiler was used to create libgpg.a for 64bit arm?

  [176/176] Linking CXX shared library /home/bram/apps/Buggy/AndroidStudio/app/build/intermediates/cmake/debug/obj/arm64-v8a/libbuggy.so
  FAILED: : && /home/bram/android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=aarch64-none-linux-android --gcc-toolchain=/home/bram/android-sdk-linux/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/home/bram/android-sdk-linux/ndk-bundle/sysroot -fPIC -isystem /home/bram/android-sdk-linux/ndk-bundle/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security  -std=c++11 -DANDROID=1 -DPLAY=1 -DUSEES2=1 -DLOGTAG=swaag -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a --sysroot /home/bram/android-sdk-linux/ndk-bundle/platforms/android-21/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libbuggy.so -o /home/bram/apps/Buggy/AndroidStudio/app/build/intermediates/cmake/debug/obj/arm64-v8a/libbuggy.so CMakeFiles/buggy.dir/main.cpp.o CMakeFiles/buggy.dir/android_native_app_glue.c.o CMakeFiles/buggy.dir/StateManager.cpp.o CMakeFiles/buggy.dir/http_lib.c.o CMakeFiles/buggy.dir/leaderboardmanager.cpp.o  /home/bram/src/gpg-cpp-sdk/android/lib/gnustl/arm64-v8a/libgpg.a /home/bram/apps/Buggy/AndroidStudio/app/.externalNativeBuild/cmake/PI/outputs/libpi.a /home/bram/apps/GBase/src/output/libgbase.a /home/bram/src/opende/output/libopende.a /home/bram/src/GPGOAP/libgpgoap.a /home/bram/src/ip2ensign/libip2ensign.a -lEGL -lGLESv2 -lOpenSLES -landroid -llog -lz -lm -lm "/home/bram/android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a" && :
  /home/bram/android-sdk-linux/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: error in /home/bram/src/gpg-cpp-sdk/android/lib/gnustl/arm64-v8a/libgpg.a(.eh_frame); no .eh_frame_hdr table will be created.
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
stolk commented 7 years ago

It turns out that it is an issue with ld. 32-bit uses ld.gold, and 64-bit uses ld.bfd

When I force the use of ld.gold on 64 bit, the linking succeeds, albeit w non working binary. See: https://github.com/android-ndk/ndk/issues/428

DanAlbert commented 7 years ago

It looks like the version of libgpg that's currently shipped isn't compatible with ld.bfd. Presumably caused by a bug in the version of the compiler that was used to create that library. Any way we could get this tested with a libgpg built with a newer NDK?