shared library text segment is not shareable

10,058

Solution 1

Update:

from Android NDK r11 you can use

LOCAL_LDLIBS += -Wl,--no-warn-shared-textrel

You can also use

LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true

Previous answer:

This is a recent change in toolchain which treats this warning as an error.

One workaround is to add --no-warn-shared-textrel to LOCAL_LDFLAGS to disable treating warning as an error. You can do that in your Android.mk like

LOCAL_LDFLAGS := --no-warn-shared-textrel

Solution 2

Workaround for Android NDK r11:

LOCAL_LDLIBS += -Wl,--no-warn-shared-textrel

LOCAL_LDLIBS is applied later in the option chain than LOCAL_LDFLAGS, and consequently overrides the default.

Share:
10,058

Related videos on Youtube

Vektor88
Author by

Vektor88

Updated on July 12, 2022

Comments

  • Vektor88
    Vektor88 almost 2 years

    I am trying to add HW video acceleration to a cm10.2 port for my device. I get no errors but the one below, then make stops working, apparently without any error.

    /home/vektor/CM102/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: warning: shared library text segment is not shareable
    /home/vektor/CM102/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: treating warnings as errors
    collect2: error: ld returned 1 exit status
    make: *** [/home/vektor/CM102/out/target/product/s7300b/obj/SHARED_LIBRARIES/libamplayer_intermediates/LINKED/libamplayer.so] Error 1
    make: *** Waiting for unfinished jobs....
    

    What does it mean? Should I compile with less restrictive flags or is something worse causing it?

  • Alexey Yakovenko
    Alexey Yakovenko about 8 years
    Adding this LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true to Android.mk works better, than LOCAL_LDFLAGS solution.
  • jayatubi
    jayatubi about 8 years
    Since r11, The build/core/build-binary.mk will always add the LOCAL_LDFLAGS += -Wl,--warn-shared-textrel at the end of the link command no matter what LOCAL_LDFLAGS I have set before. How to avoid this?
  • pelya
    pelya almost 8 years
    This does provide an answer, which works better than the accepted answer for newer version of Android NDK.
  • Karu
    Karu over 7 years
    This doesn't answer the question: What does it mean?
  • Karu
    Karu over 7 years
    This doesn't answer the question: What does it mean?