ros2 / tinyxml2_vendor

temporary vendor package for tinyxml2
Apache License 2.0
2 stars 9 forks source link

Unable to extract the library file path from tinyxml2 #15

Open tanshihaj opened 2 years ago

tanshihaj commented 2 years ago

I cannot build ROS packages that depends on tinyxml2_vendor using nixpkgs. Main issue is https://github.com/ros2/tinyxml2_vendor/blob/rolling/cmake/Modules/FindTinyXML2.cmake, it seems that in some environments you can get error during configure:

$ nix-build -A rosPackages.humble.qt-gui-cpp
...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/share/doc/qt_gui_cpp -DCMAKE_INSTALL_INFODIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/include -DCMAKE_INSTALL_SBINDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/griqc100a3gc6b2z1ydx5zh97zmqbnvi-clang-wrapper-11.1.0/bin/strip -DCMAKE_RANLIB=/nix/store/griqc100a3gc6b2z1ydx5zh97zmqbnvi-clang-wrapper-11.1.0/bin/ranlib -DCMAKE_AR=/nix/store/griqc100a3gc6b2z1ydx5zh97zmqbnvi-clang-wrapper-11.1.0/bin/ar -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/nix/store/3fziqxpywkkcjqjn1bvf3hw25n6v2yc8-ros-humble-qt-gui-cpp-2.2.1-r2  -DAMENT_CMAKE_ENVIRONMENT_PARENT_PREFIX_PATH_GENERATION=OFF
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/griqc100a3gc6b2z1ydx5zh97zmqbnvi-clang-wrapper-11.1.0/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/griqc100a3gc6b2z1ydx5zh97zmqbnvi-clang-wrapper-11.1.0/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ament_cmake: 1.3.2 (/nix/store/9y6vg4kb9l5c8k5v8gljyayfx2fajpcc-ros-humble-ament-cmake-1.3.2-r1/share/ament_cmake/cmake)
-- Found Python3: /nix/store/v4iwl6az3wax9nw0wl42kjpq4vfdd7j4-python3-3.10.5/bin/python3.10 (found version "3.10.5") found components: Interpreter
-- Found pluginlib: 5.1.0 (/nix/store/r1zljfp3m21q8m72hi8s6a6ak8pii7v3-ros-humble-pluginlib-5.1.0-r3/share/pluginlib/cmake)
-- Found TinyXML2 via Config file: /nix/store/fb9x9sxhbaamshdqmbq72q1nvixxhmzy-tinyxml-2-6.0.0/lib/cmake/tinyxml2
-- Found TinyXML2 via Config file: /nix/store/fb9x9sxhbaamshdqmbq72q1nvixxhmzy-tinyxml-2-6.0.0/lib/cmake/tinyxml2
CMake Error at /nix/store/h0pmgkywwcgi0s2vmf4rcbbfnacs3ccv-ros-humble-tinyxml2-vendor-0.7.5-r2/share/tinyxml2_vendor/cmake/Modules/FindTinyXML2.cmake:44 (message):
  Unable to extract the library file path from tinyxml2
Call Stack (most recent call first):
  CMakeLists.txt:25 (find_package)

-- Configuring incomplete, errors occurred!
See also "/tmp/nix-build-ros-humble-qt-gui-cpp-2.2.1-r2.drv-0/qt_gui_core-release-release-humble-qt_gui_cpp-2.2.1-2/build/CMakeFiles/CMakeOutput.log".

It seems that https://github.com/ros2/tinyxml2_vendor/blob/rolling/cmake/Modules/FindTinyXML2.cmake called twice (I think because there is two transitive dependencies of qt-gui-cpp that use TinyXML2). First call FindTinyXML2.cmake sets TINYXML2_LIBRARY variable to tinyxml2 here https://github.com/ros2/tinyxml2_vendor/blob/rolling/cmake/Modules/FindTinyXML2.cmake#L13 and second time it tries to split it by ; for 4 parts here https://github.com/ros2/tinyxml2_vendor/blob/rolling/cmake/Modules/FindTinyXML2.cmake#L27. This issue obviously specific to my environment since it builds fine on other ones (otherwise this bug would be fixed), but I don't understand how it should work.

audrow commented 2 years ago

It's not obvious what's going on to me either. I'm going to mark this as help wanted.

If you do figure it out, I'd appreciate if you post it here or make a PR. You can @ me for a review.

FranekStark commented 7 months ago

@tanshihaj any news on that? I am facing the exact same issue when trying to build https://github.com/ros/kdl_parser on a system which has ROS2 installed.

tanshihaj commented 4 months ago

No, I didn't fix this issue, unfortunately.