-
Notifications
You must be signed in to change notification settings - Fork 280
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
Consider adding support for generator expression in pkgConfig.cmake.in #1154
Comments
Following the problem, I can dedicate a bit of time to patch the issue. All I need would be a reproducible instructions (or a Dockerfile) to get a source build failing with the problem described. Thanks! |
Here is a Dockerfile that demonstrate the issue, the last FROM ubuntu
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y \
build-essential \
g++ \
git \
curl \
vim \
gnupg2 \
cmake \
lsb-release
# to simplify your life:
WORKDIR /root
RUN apt install -y zsh zsh-syntax-highlighting zsh-autosuggestions vim bat wget
RUN echo 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >~/.zshrc.local && \
echo 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >~/.zshrc.local
RUN wget -O ~/.zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \
yes | ~/.fzf/install
# ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" >/etc/apt/sources.list.d/ros-latest.list' && \
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - && \
apt update && \
apt install -y ros-noetic-catkin \
ros-noetic-cmake-modules \
ros-noetic-hardware-interface \
ros-noetic-rostest \
# just to get the dependencies:
liburdfdom-dev \
liburdfdom-sensor \
ros-noetic-urdf && \
apt remove -y ros-noetic-urdf
RUN git clone https://github.com/ros-controls/ros_control && \
git clone https://github.com/ros/urdf && \
git clone https://github.com/ros/urdfdom
SHELL [ "/bin/bash", "-c" ]
RUN cd urdfdom && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/noetic && \
make -j && \
make install
RUN cd urdf/urdf_parser_plugin && \
mkdir build && \
cd build && \
source /opt/ros/noetic/setup.bash && \
cmake .. -DCATKIN_BUILD_BINARY_PACKAGE=ON -DCMAKE_INSTALL_PREFIX=/opt/ros/noetic && \
make -j && \
make install
RUN cd urdf/urdf && \
mkdir build && \
cd build && \
source /opt/ros/noetic/setup.bash && \
cmake .. -DCATKIN_BUILD_BINARY_PACKAGE=ON -DCMAKE_INSTALL_PREFIX=/opt/ros/noetic && \
make -j && \
make install
# or with zsh: source /opt/ros/noetic/setup.zsh
RUN cd ros_control/joint_limits_interface && \
mkdir build && \
cd build && \
source /opt/ros/noetic/setup.bash && \
cmake .. -DCATKIN_BUILD_BINARY_PACKAGE=ON -DCMAKE_INSTALL_PREFIX=/opt/ros/noetic && \
make && \
make install |
Just in case there's a confusion, that line is matching configuration keywords, which are not the same as generator expressions.
I don't think that's going to work. The issue should be solved by making sure that PKG_CONFIG_LIBRARIES has a list of actual libraries, with all generator expressions already (somehow) resolved. PKG_CONFIG_LIBRARIES is generated here. |
can we add extra filter to extract pure library name from those regex expression in where that ( catkin/cmake/templates/pkgConfig.cmake.in Line 119 in 085e895
by the way, why urdf will cause something to generate that ugly expression, I have build hundred ros packages, only urdf's cmake file raise those errors. -- check library: urdf -- check library: $<$>:/usr/local/lib/liburdfdom_sensor.dylib> CMake Error at /Users/xlla/ros_catkin_ws/install_isolated/share/urdf/cmake/urdfConfig.cmake:174 (message): Project 'gazebo_plugins' tried to find library '$<$>:/usr/local/lib/liburdfdom_sensor.dylib>'. The library is neither a target nor built/installed properly. Did you compile project 'urdf'? Did you find_package() it before the subdirectory containing its code is included? Call Stack (most recent call first): /Users/xlla/ros_catkin_ws/install_isolated/share/catkin/cmake/catkinConfig.cmake:76 (find_package) CMakeLists.txt:7 (find_package) |
Those are cmake generator expressions. I'm rereading this thread and ros/urdf#37, and I think the suggestion here is fine ros/urdf#37 (comment).
I'm not sure what you're suggesting. |
hi @ivanpauno , I have tried the solutions on ros/urdf#37 (comment) , manual remove those regex expressions actually work but trivial and bring mistake sometimes. AchmadFathoni's sed regex command just remove the prefix of lib regex expression and leave suffix ">" there. the filter I mean is like this sorry, I don't know how to avoid html to render these special symbols so I have to post a picture to demonstrate it. |
I'm not sure what are you trying to do. i.e. you would need to replace this catkin/cmake/templates/pkgConfig.cmake.in Lines 122 to 123 in 7fa3eb3
if("${library}" MATCHES "^\\$<.*>$")
list(APPEND @PROJECT_NAME@_LIBRARIES ${library})
elseif("${library}" MATCHES "^(debug|optimized|general)$")
list(APPEND @PROJECT_NAME@_LIBRARIES ${library}) The regex expression I proposed my need to be adjusted. |
I just want to pass the build of the package that depend on urdfdom lib. |
Yes, but it never should reach this find_library() line with the fix I mentioned.
That's bad. I'm not sure how that could be fixed. Line 5 in 7fa3eb3
But getting that right is going to be tricky. |
urdfdom is providing libraries with generator expression in it, which is not supported by the pkgConfig.cmake.in template as it will call
find_library
on it: ros/urdf#37Maybe it could just add the library if it looks like a generator expression as suggested by ros/urdf#37 (comment)
catkin/cmake/templates/pkgConfig.cmake.in
Line 122 in 085e895
catkin/cmake/templates/pkgConfig.cmake.in
Line 171 in 085e895
The text was updated successfully, but these errors were encountered: