vxl cannot build with share libs

本文讨论了使用CMake构建VXL项目时遇到的问题,即无法创建共享库(DLL)。文中解释了VXL不支持MSVC的共享库特性,并提供了几种解决方案,包括使用静态库、Cygwin构建或手动列出导出符号。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


I used CMake to create a MSVC project with BUILD_SHARED_LIBRARY=ON. But when I try to build, it gives message "cannot open vcl.lib". What's wrong?

VXL does not support the CMake "Shared Library" feature on MSVC. You have to use static libraries. This is mostly due to MSVC's requirements to have either a complete list of every exportable identifier or a decoration of every identifier in the code. We are too lazy (or appalled at this "feature") to try to fix this. If you absolutely need DLLs you can build your code using Cygwin, which can produce shared libraries in a "normal" manner. Alternatively, if you only want to export a small number of classes or functions, then you can manually list them. See the MSVC tool documentation for further details.

make[1]: Entering directory '/openwrt/openwrt-15.05.1' make[2]: Entering directory '/openwrt/openwrt-15.05.1/package/helloworld/helloworld' rm -f /openwrt/openwrt-15.05.1/bin/ar71xx/packages/base/helloworld_* rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/._installed rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/packages/.list /openwrt/openwrt-15.05.1/staging_dir/host/packages/.list rm -rf /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/helloworld-1.0 make[2]: Leaving directory '/openwrt/openwrt-15.05.1/package/helloworld/helloworld' make[1]: Leaving directory '/openwrt/openwrt-15.05.1' make[1]: Entering directory '/openwrt/openwrt-15.05.1' make[2]: Entering directory '/openwrt/openwrt-15.05.1/package/libs/toolchain' mkdir -p /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain touch /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.prepared_0c0f7031f78967ca687e5628984dfab9 rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.toolchain_installed (cd /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/./; if [ -x ./configure ]; then find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.guess | xargs -r chmod u+w; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.guess | xargs -r -n1 cp --remove-destination /openwrt/openwrt-15.05.1/scripts/config.guess; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.sub | xargs -r chmod u+w; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.sub | xargs -r -n1 cp --remove-destination /openwrt/openwrt-15.05.1/scripts/config.sub; AR="mips-openwrt-linux-uclibc-gcc-ar" AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float" LD=mips-openwrt-linux-uclibc-ld NM="mips-openwrt-linux-uclibc-gcc-nm" CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB="mips-openwrt-linux-uclibc-gcc-ranlib" STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 " CPPFLAGS="-I/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include -I/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/include -I/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include " LDFLAGS="-L/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib -L/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/lib -L/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib " ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls ; fi; ) rm -f /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.configured_* touch /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.configured_yyy cp -fpR /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libuClibc-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libcrypt-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libm-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libpthread-*.so /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libuClibc-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libcrypt-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libm-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libpthread-*.so': No such file or directory Makefile:636: recipe for target '/openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.built' failed make[2]: *** [/openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.built] Error 1 make[2]: Leaving directory '/openwrt/openwrt-15.05.1/package/libs/toolchain' package/Makefile:191: recipe for target 'package/libs/toolchain/compile' failed make[1]: *** [package/libs/toolchain/compile] Error 2 make[1]: Leaving directory '/openwrt/openwrt-15.05.1' /openwrt/openwrt-15.05.1/include/toplevel.mk:181: recipe for target 'package/helloworld/compile' failed make: *** [package/helloworld/compile] Error 2
最新发布
08-08
CMake Warning at /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:166 (add_library): Cannot generate a safe runtime search path for target mrp_interfaces__rosidl_generator_py because files in some directories may conflict with libraries in implicit directories: runtime library [libpython3.10.so] in /usr/lib/aarch64-linux-gnu may be hidden by files in: /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/usr/lib64/aarch64-linux-gnu Some of these libraries may not be found correctly. Call Stack (most recent call first): /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:17 (rosidl_generate_interfaces) CMake Warning at /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library): Cannot generate a safe runtime search path for target mrp_interfaces__rosidl_typesupport_fastrtps_c__pyext because files in some directories may conflict with libraries in implicit directories: runtime library [libpython3.10.so] in /usr/lib/aarch64-linux-gnu may be hidden by files in: /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/usr/lib64/aarch64-linux-gnu Some of these libraries may not be found correctly. Call Stack (most recent call first): /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:17 (rosidl_generate_interfaces) CMake Warning at /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library): Cannot generate a safe runtime search path for target mrp_interfaces__rosidl_typesupport_introspection_c__pyext because files in some directories may conflict with libraries in implicit directories: runtime library [libpython3.10.so] in /usr/lib/aarch64-linux-gnu may be hidden by files in: /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/usr/lib64/aarch64-linux-gnu Some of these libraries may not be found correctly. Call Stack (most recent call first): /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:17 (rosidl_generate_interfaces) CMake Warning at /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library): Cannot generate a safe runtime search path for target mrp_interfaces__rosidl_typesupport_c__pyext because files in some directories may conflict with libraries in implicit directories: runtime library [libpython3.10.so] in /usr/lib/aarch64-linux-gnu may be hidden by files in: /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/usr/lib64/aarch64-linux-gnu Some of these libraries may not be found correctly. Call Stack (most recent call first): /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:17 (rosidl_generate_interfaces) //home/yebh/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/rootfs/usr/bin/python3: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory make[2]: *** [mrp_interfaces__py/CMakeFiles/mrp_interfaces__py.dir/build.make:199:rosidl_generator_py/mrp_interfaces/_mrp_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c] 错误 127 make[1]: *** [CMakeFiles/Makefile2:593:mrp_interfaces__py/CMakeFiles/mrp_interfaces__py.dir/all] 错误 2 make: *** [Makefile:149:all] 错误 2 --- Failed <<< mrp_interfaces [5.54s, exited with code 2] Summary: 0 packages finished [5.84s] 1 package failed: mrp_interfaces 1 package had stderr output: mrp_interfaces
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值