我已成功完成install/build instructions for OpenBR on linux
我的目标是在Android上构建并运行OpenBR。
经过大量的修补,我终于成功为armv7构建了OpenBR。我的问题是,当我做" System.loadLibrary(" openbr")"我收到错误:
11-25 23:40:31.221: E/dalvikvm(29742): dlopen("/data/app-lib/com.test.app-28/libopenbr.so") failed: dlopen failed: could not load library "/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Concurrent.so.5.1.1" needed by "libopenbr.so"; caused by library "/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Concurrent.so.5.1.1" not found
我相信我已经正确地包含了armv7 libQt5Concurrent库(在android.mk中加载为本地模块),但我认为问题是libopenbr在加载时看错了目录(如错误信息中所示) 。它试图查看编译机器上的路径。
在libopenbr.so上运行readelf会产生这样的结果:
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Concurrent.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Core.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Gui.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Network.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Sql.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Widgets.so.5.1.1]
0x00000001 (NEEDED) Shared library: [/home/ubuntu/qt5.1.1/android_armv7/lib/libQt5Xml.so.5.1.1]
0x00000001 (NEEDED) Shared library: [libz.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [liblog.so]
0x00000001 (NEEDED) Shared library: [libc.so]
如何获取它,以便在编译时不使用此路径搜索Qt库?
我尝试过各种cmake指令,包括openbr CMakeLists.txt中这些变量的各种排列:
SET(CMAKE_SKIP_RPATH TRUE)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH to be used when installing
SET(CMAKE_INSTALL_RPATH "")
# don't add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
任何帮助从我的构建库的共享库路径中获取此路径都会很棒!谢谢!
答案 0 :(得分:1)
我实际上终于想出了如何解决这个问题,方法是更新每个qt lib的cmake文件,使其不包含文件名末尾的版本字符串!
答案 1 :(得分:0)
使用System.loadLibrary()加载动态库时,需要先打开所有依赖项,因为System.loadLibrary()不会为您加载它们。
所以你可能需要这样做: 的System.loadLibrary( “libQt5Concurrent”) 的System.loadLibrary( “openbr”)
如果libQt5Concurrent有其他依赖,你必须以同样的方式加载它们。