怎么在不修改代码的情况下设置so导出符号 #4959
Replies: 4 comments 6 replies
-
另外有没有只导出其中一个链接库的符号的,比如libA.so链接了现成的libB.so, |
Beta Was this translation helpful? Give feedback.
-
先确认下 debug mode 是否会导出,或者移除 mode.release rules |
Beta Was this translation helpful? Give feedback.
-
另外,对于 so ,目前 release mode 默认就是会导出的。。 xmake/xmake/rules/mode/xmake.lua Line 48 in 7e7b37e 你这里不行,我估计你根本没说清楚你这里的配置,我猜你是 shared target 去 link 了一个 static target,而你的导出符号是在这个 static target 里,而不是 so 所在的 target。。 这种情况,你得对这个 static target 去 set_symbols none,而不是对 shared target,否则肯定不生效。。符号在哪个 target ,就对哪个 target 配置 |
Beta Was this translation helpful? Give feedback.
-
但是我这编出来就是啥都没有耶,纯的qt.shared $ nm build/linux/x86_64/release/libtest.so
nm: build/linux/x86_64/release/libtest.so: no symbols $ xmake build -rvD
[ 50%]: cache compiling.release src/demo.cpp
/usr/bin/gcc -c -m64 -O3 -std=c++11 -I/home/administrator/test/build/.gens/test/linux/x86_64/release/rules/qt/ui -DQT_DEMO_LIBRARY -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_CORE_LIB -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtGui -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtGui/5.14.2 -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtGui/5.14.2/QtGui -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtCore -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtCore/5.14.2 -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include/QtCore/5.14.2/QtCore -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/include -isystem /home/administrator/Qt5.14.2/5.14.2/gcc_64/mkspecs/linux-g++ -DNDEBUG -fPIC -o build/.objs/test/linux/x86_64/release/src/demo.cpp.o src/demo.cpp
[ 75%]: linking.release libtest.so
/usr/bin/g++ -o build/linux/x86_64/release/libtest.so build/.objs/test/linux/x86_64/release/src/demo.cpp.o -shared -m64 -fPIC -L/home/administrator/Qt5.14.2/5.14.2/gcc_64/lib -Wl,-rpath=/home/administrator/Qt5.14.2/5.14.2/gcc_64/lib -s -lQt5Gui -lQt5Core
build cache stats:
cache directory: build/.build_cache
cache hit rate: 100%
cache hit: 1
cache hit total time: 0.000s
cache miss: 0
cache miss total time: 0.000s
new cached files: 0
remote cache hit: 0
remote new cached files: 0
preprocess failed: 0
compile fallback count: 0
compile total time: 0.000s
[100%]: build ok, spent 0.275s |
Beta Was this translation helpful? Give feedback.
-
release下试了
set_symbols("debug")
、set_symbols("none")
、add_rules("utils.symbols.export_list")
都没效果,都是只有额外的sym能导出符号,但是我希望是so本身有Beta Was this translation helpful? Give feedback.
All reactions