Skip to content

no .eh_frame_hdr table will be created #428

Closed

Description

@stolk

Description

when linking for arm64-v8a, it fails on no .eh_frame_hdr table will be created

[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)

When linking for 32 bit arm, no such error occurs.

Environment Details

Android Studio 3.0 Canary 4
Build #AI-171.4101728, built on June 14, 2017
JRE: 1.8.0_112-release-b736 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-78-generic

Latest NDK and SDK.
NDK 15.0.4075724

Activity

  1. DanAlbert commented on Jun 19, 2017

    @DanAlbert
    Contributor

    Unfortunately the linker doesn't provide a very helpful error message here. Googling for it turns up this though: https://gcc.gnu.org/ml/gcc-help/2009-04/msg00223.html

    Presumably bin/libx.o was not compiled by a current version of gcc.
    This error means that the linker did not understanding something in the
    exception frame information. gcc has asked the linker to create an
    exception frame header, but, because there is something wrong, the
    exception frame header will not be created.

    I think everything will still work more or less correctly. The effect
    is that throwing an exception will take longer at runtime.

    Were any components maybe built with an old NDK? It's also possible that maybe the inverse of the problem is happening and the Clang we have is actually too new for our linker...

    One thing that might explain the difference between 32-bit and 64-bit arm here: 64-bit arm still uses ld.bfd instead of ld.gold. If you add -fuse-ld=gold to your ldflags, does the problem go away?

    Note that you won't want to use -fuse-ld=gold for aarch64 in anything you ship right now because of https://groups.google.com/d/topic/android-ndk-announce/u8v7eIegIpM/discussion

  2. stolk commented on Jun 19, 2017

    @stolk
    Author

    Thank you for the swift reply.

    The library I try to link (gpg.a) is pre-built and provided by Google. I have no control over the compiler.

    Your analysis was spot on: gold can successfully link.
    I added this to my CMakeLists.txt file:

    set ( CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=gold ${CMAKE_SHARED_LINKER_FLAGS}" )
    

    That said, the resulting app does crash on 64-bit for me.
    Not sure if this is due to the switch to gold linker or not:

    E/ValidateServiceOp( 3257): android.os.DeadObjectException
    E/ValidateServiceOp( 3257): 	at android.os.BinderProxy.transactNative(Native Method)
    E/ValidateServiceOp( 3257): 	at android.os.BinderProxy.transact(Binder.java:505)
    E/ValidateServiceOp( 3257): 	at com.google.android.gms.common.internal.IGmsCallbacks$Stub$Proxy.onPostInitComplete(IGmsCallbacks.java:118)
    

    The 32 bit arm works just fine.

  3. DanAlbert commented on Jun 19, 2017

    @DanAlbert
    Contributor

    Oh, Google Play Games, not GNU Privacy Guard :)

    I'm going to refile this in our other bug tracker so it's easier to loop in the Play Games folks. Does this happen for any trivial link of libgpg, or do you have a specific test case?

  4. stolk commented on Jun 19, 2017

    @stolk
    Author

    Thanks, I already had an issue filed with the Google Play Games tracker.
    It is at: playgameservices/cpp-android-basic-samples#48

    I will download their samples, and build on 64-bit to see if those can be used as repro case.
    UPDATE: I can't for the life of me build the samples from cpp-android-basic-samples. I think they have not been maintained to build for current installs of NDK/SDK/AndroidStudio.

  5. DanAlbert commented on Jun 19, 2017

    @DanAlbert
    Contributor

    Oh, I didn't realize they were also on GitHub. We'll just use that one then. I'll leave this open until we have a better idea of what the problem is though.

  6. DanAlbert commented on Oct 3, 2017

    @DanAlbert
    Contributor

    Closing in favor of the Play Games bug. Will reopen if we have reason to believe this is an NDK issue, but for now we don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions