Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pkg_config_entry when version number is not specified #374

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Aug 3, 2023

🦟 Bug fix

Fixes gazebosim/gz-transport#412

Summary

When gz_find_package is called without a VERSION argument, the <package>_FIND_VERSION variable is empty. But in most of our Find*.cmake modules, we add a pkg-config entry that assumes the version is there.

Example:

gz_pkg_config_entry(GzProtobuf "protobuf >= ${GzProtobuf_FIND_VERSION}")

The pkg-config entry will then be "protobuf >= ", which is invalid and causes the following entry to be treated as a version number.

The fix here removes the operator if the version is empty.

I believe this is why https://build.osrfoundation.org/job/gz-transport13-debbuilder/372/ is failing with

Removing autopkgtest-satdep (0) ...
�[33mautopkgtest [11:28:54]: test build: [-----------------------
�[0mIn file included from /usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/transport13/gz/transport/Discovery.hh:71,
                 from /usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/transport13/gz/transport.hh:26,
                 from gztest.cc:1:
/usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/msgs10/gz/msgs/Utility.hh:24:10: fatal error: gz/math/AxisAlignedBox.hh: No such file or directory
   24 | #include <gz/math/AxisAlignedBox.hh>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
�[33mautopkgtest [11:28:54]: test build: -----------------------]
�[0m�[33mautopkgtest [11:28:54]: test build:  - - - - - - - - - - results - - - - - - - - - -
�[0mbuild                FAIL non-zero exit status 1
�[33mautopkgtest [11:28:54]: test build:  - - - - - - - - - - stderr - - - - - - - - - -
�[0mIn file included from /usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/transport13/gz/transport/Discovery.hh:71,
                 from /usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/transport13/gz/transport.hh:26,
                 from gztest.cc:1:
/usr/lib/x86_64-linux-gnu/pkgconfig/../../..//include/gz/msgs10/gz/msgs/Utility.hh:24:10: fatal error: gz/math/AxisAlignedBox.hh: No such file or directory
   24 | #include <gz/math/AxisAlignedBox.hh>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~

The test uses pkg-config and checking the output of pkg-config --libs gz-transport13 is

-L/usr/lib/x86_64-linux-gnu/pkgconfig/../../..//lib/x86_64-linux-gnu -lgz-transport13 -lgz-utils2 -lgz-msgs10 -lprotobuf

It doesn't include libgz-math7. The contents of /usr/lib/x86_64-linux-gnu/pkgconfig/gz-msgs10.pc from libgz-msgs10-dev is:

prefix=${pcfiledir}/../../../
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include/gz/msgs10

Name: Gazebo msgs
Description: A set of msgs classes for robot applications
Version: 10.0.0
Requires: gz-cmake3 >= 1.1 protobuf >=  gz-math7
Requires.private: tinyxml2
Libs: -L${libdir} -lgz-msgs10 
Libs.private: 
CFlags: -I${includedir} 

We recently removed the required version of protobuf from gz-msgs (gazebosim/gz-msgs#346) which explains why we haven't seen this failure in gz-transport12-debbuilder before.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

When `gz_find_package` is called without a VERSION argument, the
`<package>_FIND_VERSION` variable is empty. But in most of our
`Find*.cmake` modules, we add a pkg-config entry that assumes the
version is there.

Example:
```
gz_pkg_config_entry(GzProtobuf "protobuf >= ${GzProtobuf_FIND_VERSION}")
```

The pkg-config entry will then be "protobuf >= ", which is invalid and
causes the following entry to be treated as a version number.

The fix here removes the operator if the version is empty.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey self-assigned this Aug 3, 2023
@azeey azeey merged commit fdcd50e into gazebosim:gz-cmake3 Aug 3, 2023
9 checks passed
@azeey azeey deleted the fix_pkg_config_empty_version branch August 3, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
2 participants