Warning: Shared Library text segment is not writable able
Error: treating warnings as errors
Recently I am debugging A gsensor. The code is directly transplanted from android4.2. But it has been compiled for a long time...
Baidu does not work
Google cannot access it again.
However, after all, I found some useful information, saying that -- no-fatal-warnings must be added to the compiler options.
But no matter how it is added, it becomes the option of G ++, but G ++ does not recognize it. Depressed for a while
Looking at the link options of the linker, we can see the following two options:
-- Warn-shared-textrel warn if text segment is not writable able
-- No-Warn-shared-textrel do not warn if text segment is not writable able (default)
Therefore, the -- Warn-shared-textrel is added by default.
So after you click here to remove it directly, the details are as follows:
Diff -- git a/Android/build/CORE/Combo/TARGET_linux-arm.mk B/Android/build/CORE/Combo/TARGET_linux-arm.mk
Index 5ff30fa... accc3ff 100755
--- A/Android/build/CORE/Combo/TARGET_linux-arm.mk
++ B/Android/build/CORE/Combo/TARGET_linux-arm.mk
@-132,7 + 132,6 @ target_global_ldflags + = \
-Wl,-Z, noexecstack \
-Wl,-Z, relro \
-Wl,-Z, now \
--Wl, -- Warn-shared-textrel \
-Wl, -- fatal-warnings \
-Wl, -- ICF = safe \
$ (Arch_variant_ldflags)