无法在CentOS7上构建32位库
Unable to build 32bit library on Centos7
我有具有'devtoolset-7'的centos7 vagrant框。
我使用" cmake"来构建和编译我的库。这是cmakelists.txt文件
set(CMAKE_BUILD_TYPE Release)
include_directories("../Include" "/usr/include/libusb-1.0")
add_library(CXIOInterface SHARED
CXIOInterface.cpp
HidInterface_Linux.cpp
HidDevice_Linux.cpp
../Include/Debug.cpp
app.cpp
CrcLibrary.cpp
ContextFunctions.cpp)
set(PROJECT_LINK_LIBS -ludev -lusb-1.0)
target_link_libraries(CXIOInterface LINK_PUBLIC ${PROJECT_LINK_LIBS})
set(CMAKE_CXX_FLAGS "-m32")
当我以64位编译时,一切正常。但是,当我以32位编译时,我会出现错误:
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: skipping incompatible /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lstdc++_nonshared
collect2: error: ld returned 1 exit status
make[2]: *** [CXIOInterface/libCXIOInterface.so] Error 1
你们能帮我吗,我无法理解在这里做什么。
已经有一个链接告诉我安装rpm,但是我是Ubuntu用户而不是CentOS。第一次使用它。
https://www.centos.org/forums/viewtopic.php?t=64011
/opt/opt/rh/devToolset-7/root/usr/libexec/libexec/gcc/x86_64-redhat-linux/7/ld:跳过/opt/opt/opt/rh/devtoolset-7/root/usr/usr/lib/lib/lib/lib/gcc/x86_64-Redhat -linux/7/libstdc _ nonshared.a搜索-lstdc _ nonshared
意味着链接器发现的库与ABI不兼容,在这种情况下,它不是32位兼容。
发生这种情况,因为您缺少此包装,就像您添加的链接一样。
首先,找出您已安装的DevToolset的当前版本:
rpm -qa | grep devtoolset-7
从输出中,您应该能够轻松弄清楚您现在正在使用的版本。
然后,尝试运行:
yum install devtoolset-7-libstdc++-devel-7.2.1-1.el7.x86_64.rpm
NOTE :我使用了7.2.1-1,因为这是我在Google搜索时发现的一个,如果您安装了其他版本,请改用它。
相关文章:
- 在node-gip binding.gyp文件中,如何根据系统结构(32位、64位)包含不同的库文件
- 无法在CentOS7上构建32位库
- 在 64 位机器上构建 32 位 Qt 应用程序
- 如何将Zeromq作为32位库,并将其与标准64位库合并
- 如何在 64 位 Linux Mint 上构建最小的静态 Qt 5.2 32 位库
- Makefile,如何同时链接32位库和64位库
- 无法构建 32 位 Mongo DB C++驱动程序
- 使用Clang编译时,Linker无法在64位Mint操作系统下找到32位库
- Xcode:使用 32 位库编译 64 位应用程序
- 使用带有python绑定的boost在osx上构建32位版本的libtorrent
- Linux环境下构建32位和64位应用程序(C++)
- 同时构建用于提升的32位和64位库
- 链接64位应用程序与32位库在centos 5.6 64位
- 在64位机器上从源代码构建32位mysql c++连接器
- 交叉编译:检查是否可以在64位机器上构建32位
- 使用CMake构建32位CGAL:即使指定了32位,也会生成64位二进制文件
- 在64位c++程序中使用32位库
- 64位系统上的32位库
- 在64位OSX上构建32位libcurl
- 如何在32位Linux Mint中构建64位FastCGI库