首页 > 代码库 > warning: shared library text segment is not shareable
warning: shared library text segment is not shareable
warning: shared library text segment is not shareable
error: treating warnings as errors
近期在调试一个Gsensor, 代码是从android4.2上直接移植过来的。但却一直编译只是, 纳闷了。。。
baidu不行
google 又訪问不了,真是操蛋
可是终究还是找到了点实用的信息,说是编译器的选项要加上 --no-fatal-warnings
可无论怎么加, 加到那儿都变成了g++的选项,可g++不认得它。郁闷 了一会
看了看链接器的链接选项中看到了例如以下两个选项
--warn-shared-textrel Warn if text segment is not shareable
--no-warn-shared-textrel Do not warn if text segment is not shareable (default)
由此猜測一空是默认加入了 --warn-shared-textrel
所以打一此处直接去掉就OK了, 详细例如以下:
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)
warning: shared library text segment is not shareable