Skip to content

Conversation

@czoido
Copy link
Contributor

@czoido czoido commented Nov 6, 2025

fix(mapping): include ouster_mapping in shared_library when BUILD_MAPPING is enabled

Hi!

While trying to bring the latest version to Conan Center Index (PR: conan-io/conan-center-index#28804) I found this problem while building the test_package:

When building with BUILD_SHARED_LIBRARY=ON and BUILD_MAPPING=ON, the ouster_mapping component is not properly included in the shared_library target. This causes linking errors because:

  1. The ouster_mapping object files are not added to shared_library via target_sources()
  2. The ouster_mapping target is not linked in ouster_library_common(), so its dependencies and include directories are not propagated

Here is the log failing:

Details
ouster_sdk/0.15.0 (test package): RUN: cmake --build "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release" -- -j14
ouster_sdk/0.15.0 (test package): Full command: . "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release/generators/conanbuild.sh" && cmake --build "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release" -- -j14
[ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
[100%] Linking CXX executable test_package
ld: warning: ignoring duplicate libraries: '-lc++'
Undefined symbols for architecture arm64:
  "ouster::Preprocessor::Preprocessor(double, double, bool, int)", referenced from:
      _main in test_package.cpp.o
  "ouster::Preprocessor::Preprocess(std::__1::vector<Eigen::Matrix<double, 3, 1, 0, 3, 1>, std::__1::allocator<Eigen::Matrix<double, 3, 1, 0, 3, 1>>> const&, std::__1::vector<double, std::__1::allocator<double>> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&) const", referenced from:
      _main in test_package.cpp.o
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test_package] Error 1
make[1]: *** [CMakeFiles/test_package.dir/all] Error 2
make: *** [all] Error 2

This PR adds the missing integration of ouster_mapping into shared_library by:

  1. Adding ouster_mapping object files to shared_library when the target exists (following the same pattern as other components)
  2. Linking ouster_mapping and propagating its include directories in ouster_library_common() when BUILD_MAPPING is enabled

Here is the successful log after the fix:

Details
ouster_sdk/0.15.0 (test package): RUN: cmake --build "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release" -- -j14
ouster_sdk/0.15.0 (test package): Full command: . "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release/generators/conanbuild.sh" && cmake --build "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release" -- -j14
[ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
[100%] Linking CXX executable test_package
ld: warning: ignoring duplicate libraries: '-lc++'
[100%] Built target test_package


======== Testing the package: Executing test ========
ouster_sdk/0.15.0 (test package): Running test()
ouster_sdk/0.15.0 (test package): RUN: ./test_package
ouster_sdk/0.15.0 (test package): Full command: . "/Users/carlosz/Documents/developer/conan/conan-center-index/recipes/ouster_sdk/all/test_package/build/apple-clang-17-armv8-gnu17-release/generators/conanrun.sh" && ./test_package
Successfully created a sensor::LidarScan object
Successfully created a osf::Writer object
Successfully created a sensor_utils::PcapReader object
Successfully created a SensorScanSource object
Successfully verified mapping component (SolverConfig, Preprocessor, dependencies)

This fix ensures that when BUILD_SHARED_LIBRARY=ON and BUILD_MAPPING=ON, all ouster_mapping symbols and its transitive dependencies are correctly included in the shared library, resolving undefined symbol errors at link time.

@czoido czoido changed the title Include ouster_mapping in shared_library when BUILD_MAPPING is enabled Include ouster_mapping in shared_library when BUILD_MAPPING is enabled Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant