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

CMake error with v2 changes on libabsl_log_severity.a #146

Open
Benjamin-Tan opened this issue May 24, 2024 · 22 comments
Open

CMake error with v2 changes on libabsl_log_severity.a #146

Benjamin-Tan opened this issue May 24, 2024 · 22 comments

Comments

@Benjamin-Tan
Copy link

Hi, while using ros-humble-fields2cover (2.0.0-9jammy.20240516.152001), there is a reproducible issue with these 3 lines of minimal CMakeLists.txt. mkdir build; cd build; cmake ... This could be related to the ortools dependency. Any idea how can this be fixed and resolved?

cmake_minimum_required(VERSION 3.22)
project(example)

find_package(Fields2Cover REQUIRED)

The error logs:

root@0447bae7c411:/build# cmake ..
CMake Error at pt/ros/humble/lib/x86_64-linux-gnu/cmake/absl/abslTargets.cmake:1909 (message):
  The imported target "absl::log_severity" references the file

     "/opt/ros/humble/lib/lib/libabsl_log_severity.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/opt/ros/humble/lib/x86_64-linux-gnu/cmake/absl/abslTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /opt/ros/humble/lib/x86_64-linux-gnu/cmake/absl/abslConfig.cmake:32 (include)
  /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /opt/ros/humble/lib/x86_64-linux-gnu/cmake/ortools/ortoolsConfig.cmake:33 (find_dependency)
  /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /opt/ros/humble/lib/cmake/fields2cover/Fields2CoverConfig.cmake:14 (find_dependency)
  CMakeLists.txt:4 (find_package)

@Gonzalo-Mier
Copy link
Member

@aosmw, do you have any idea how to fix this?

@wimos-ai
Copy link
Contributor

wimos-ai commented Jun 4, 2024

In the package.xml, comment out the line that says, "libabsl-dev". At least that works for me

@Gonzalo-Mier
Copy link
Member

Let's try that

@aosmw
Copy link
Contributor

aosmw commented Jun 5, 2024

It might have something to do with the use of https://cmake.org/cmake/help/latest/variable/LIBRARY_OUTPUT_PATH.html

It is used in swig/python/CMakeLists.txt and also in the spline dependency.

Copy and pasting comment made in opennav_coverage here too

The main problem of using the Fields2Cover package, (2.0.0-13noble.20240514.144256) right now is the command line flags that the ros buildfarm uses and what they do to the locations of where things get installed prior to creating the debian package.

Fields2Cover does not use ament_cmake and I when I started trying to help, I tried to workaround what was there. I introduced the use of cmake include(GNUInstallDirs) and used the variable CMAKE_INSTALL_LIBDIR which is overriden by the ros packaging command in a way that is not playing nicely.

Digging down into it the command that is getting run by the ros build farm to create the package - https://build.ros2.org/job/Rbin_uN64__fields2cover__ubuntu_noble_amd64__binary/77/console and wrapping it in a script to reproduce locally

#!/bin/bash

mkdir -p build
cd build
DEB_PYTHON_INSTALL_LAYOUT=deb cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=/optmw/ros/rolling -DCMAKE_PREFIX_PATH=/optmw/ros/rolling -DBUILD_TESTING=OFF -DFETCHCONTENT_FULLY_DISCONNECTED=OFF ..

make -j8
sudo make install

Notice the -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu
Notice that i tweak the install prefix to /optmw isolate it on my local dev system.

I have some ideas to get it to play nicely (in a ros package install) that I am playing around with.

My aim is to find a way to get the ortools sfuff installed in /opt/ros/rolling/opt/f2c_ortools while still working for a non-ros/non-ament build.

THIS #146 (remove libabsl-dev from Fields2Cover/package.xml) might be a simple fix for now but the way the Fields2Cover package is dumping ortools artifacts into /opt/ros/rolling should really be improved so I will keep plugging away at it.

@aosmw
Copy link
Contributor

aosmw commented Jun 5, 2024

See Work In Progress #156

@rovo89
Copy link

rovo89 commented Jun 20, 2024

#156 has been merged, but still I'm getting the exact same error as above (with the duplicate "lib" directory in the path). Is that known and are investigations still ongoing?

I can work around the issue by creating symlinks:

sudo ln -s ../bin /opt/ros/iron/lib/bin
sudo ln -s ../include /opt/ros/iron/lib/include
sudo ln -s x86_64-linux-gnu /opt/ros/iron/lib/lib

With that, the build is able to complete, but it's obviously very hacky.

@Gonzalo-Mier
Copy link
Member

Hi @rovo89,
it usually takes a few days between the merging on our side and the ROS release. I've checked ROS iron and humble and they should be fine now.
Can you try again please?

@rovo89
Copy link

rovo89 commented Jun 24, 2024

I'm trying to compile it within another project. Inside the workspace, they have this repo's main branch checked out to src/lib/fields2cover (along with other dependencies). And then have colcon build --base-paths "src/lib/*" in their Makefile to compile it. This still fails with the error above, while changing into the directory and running colcon build there works fine (except for some python warnings and taking more than 3 minutes to compile).

@pl3703
Copy link

pl3703 commented Jun 29, 2024

I'm able to reproduce the error quite easily. Please find the steps

  1. Install a brand new Ubuntu 22.04
  2. Install ros2 iron
  3. Install navigation2
  4. Install fields2cover using sudo apt install ros-iron-fields2cover
  5. Clone opennav_coverage repo, then build it using colon build, you can see the error of libabsl_log_severity.a missing

@wimos-ai
Copy link
Contributor

I was also able to get it to compile and run by running rosdep install -i --from-path ./libraries/Fields2Cover --rosdistro humble -y to install lib_absl. After that it compiled fine.

@pl3703
Copy link

pl3703 commented Jul 18, 2024

I was also able to get it to compile and run by running rosdep install -i --from-path ./libraries/Fields2Cover --rosdistro humble -y to install lib_absl. After that it compiled fine.

Thanks for sharing the info! Is ./libraries/Fields2Cover the source cloned from this repo, or only the packed installed using apt?

@wimos-ai
Copy link
Contributor

I was also able to get it to compile and run by running rosdep install -i --from-path ./libraries/Fields2Cover --rosdistro humble -y to install lib_absl. After that it compiled fine.

Thanks for sharing the info! Is ./libraries/Fields2Cover the source cloned from this repo, or only the packed installed using apt?

Yah, sorry, should have specified. I cloned the repo.

@pl3703
Copy link

pl3703 commented Jul 22, 2024

I was also able to get it to compile and run by running rosdep install -i --from-path ./libraries/Fields2Cover --rosdistro humble -y to install lib_absl. After that it compiled fine.

Thanks for sharing the info! Is ./libraries/Fields2Cover the source cloned from this repo, or only the packed installed using apt?

Yah, sorry, should have specified. I cloned the repo.

Got it, did you install OR-tools by following the google's instructions?

@wimos-ai
Copy link
Contributor

wimos-ai commented Jul 22, 2024 via email

@pl3703
Copy link

pl3703 commented Jul 23, 2024

Nope. Didn't do that. I think in the latest CMakes it downloads them automatically if needed. Though I admit I had gotten it running before on that computer so it may just have been seeing my previously downloaded version.

On Mon, Jul 22, 2024, 10:27 AM pl3703 @.> wrote: I was also able to get it to compile and run by running rosdep install -i --from-path ./libraries/Fields2Cover --rosdistro humble -y to install lib_absl. After that it compiled fine. Thanks for sharing the info! Is ./libraries/Fields2Cover the source cloned from this repo, or only the packed installed using apt? Yah, sorry, should have specified. I cloned the repo. Got it, did you install OR-tools https://developers.google.com/optimization by following the google's instructions? — Reply to this email directly, view it on GitHub <#146 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBGCZJBC2NC2PT5OW2CG7TZNUQHLAVCNFSM6AAAAABIH25GSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBTGIZTONJQGU . You are receiving this because you commented.Message ID: @.>

Thanks! I got new errors if I try to build it, with such steps

  1. git clone Fields2Cover repo, and put it into ./fields2cover_repo/src
  2. install rosdep install -i --from-path ./src/Fields2Cover --rosdistro iron -y
  3. in the ./fields2cover run colcon build, the errors of (
--- stderr: fields2cover                              
/home/repos/complete_coverate/build/fields2cover/swig/python/setup.py:2: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.sysconfig import get_python_lib
/home/repos/complete_coverate/build/fields2cover/swig/python/setup.py:2: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_python_lib
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(

)

@Gonzalo-Mier
Copy link
Member

Hi @pl3703, those are warnings, not the actual error.

@pl3703
Copy link

pl3703 commented Jul 23, 2024

Hi @pl3703, those are warnings, not the actual error.

Sorry, let me clarify my question. When I tried to build opennav_coverage package using Fields2Cover as dependency, it gave such error. I clone both (Fields2Cover and opennav_coverage) in src/ folder and run colcon build on the outside of src/. Then I found Fields2Cover is able to build (using colcon build --packages-select fields2cover), but the opennav_coverage (who depends on Fields2Cover) failed.

CMake Error at /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  Could not find a package configuration file provided by "ortools" with any
  of the following names:

    ortoolsConfig.cmake
    ortools-config.cmake

  Add the installation prefix of "ortools" to CMAKE_PREFIX_PATH or set
  "ortools_DIR" to a directory containing one of the above files.  If
  "ortools" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  /home/repos/complete_coverate/install/fields2cover/lib/cmake/fields2cover/Fields2CoverConfig.cmake:18 (find_dependency)
  CMakeLists.txt:18 (find_package)

@Jakubach
Copy link

Jakubach commented Jul 26, 2024

I had the same issue on ROS2 Humble and I managed to fix that with below steps:

To fix ortools error I had to remove fields2cover from /usr (I installed it previosly with rosdep):
find / -type f -iname "*fields2cover*" and then remove eveything related to that.

Then make a new installation:

  1. Download https://github.com/Fields2Cover/Fields2Cover/releases/tag/v1.2.1 and put it into ros2 workspace ros2_ws into src (git clone with selected branch doesn't work since there is no branch v1.2.1).
  2. (Optional) Remove nested directory and rename to Fields2Cover.
  3. Download opennav_coverage into src: git clone https://github.com/open-navigation/opennav_coverage.git -b humble
  4. Install Fields2Cover
cd ~/ros2_ws/src/Fields2Cover`
mkdir -p build; 
cd build; cmake -DCMAKE_BUILD_TYPE=Release ..; 
make -j$(nproc); 
sudo make install;
  1. Build packages (from ros2_ws directory):
colcon build --packages-select opennav_coverage opennav_coverage_bt opennav_coverage_demo opennav_coverage_msgs opennav_coverage_navigator backported_bt_navigator opennav_row_coverage fields2cover 

@pl3703
Copy link

pl3703 commented Jul 30, 2024

I had the same issue on ROS2 Humble and I managed to fix that with below steps:

To fix ortools error I had to remove fields2cover from /usr (I installed it previosly with rosdep): find / -type f -iname "*fields2cover*" and then remove eveything related to that.

Then make a new installation:

  1. Download https://github.com/Fields2Cover/Fields2Cover/releases/tag/v1.2.1 and put it into ros2 workspace ros2_ws into src (git clone with selected branch doesn't work since there is no branch v1.2.1).
  2. (Optional) Remove nested directory and rename to Fields2Cover.
  3. Download opennav_coverage into src: git clone https://github.com/open-navigation/opennav_coverage.git -b humble
  4. Install Fields2Cover
cd ~/ros2_ws/src/Fields2Cover`
mkdir -p build; 
cd build; cmake -DCMAKE_BUILD_TYPE=Release ..; 
make -j$(nproc); 
sudo make install;
  1. Build packages (from ros2_ws directory):
colcon build --packages-select opennav_coverage opennav_coverage_bt opennav_coverage_demo opennav_coverage_msgs opennav_coverage_navigator backported_bt_navigator opennav_row_coverage fields2cover 

Thanks! I'll try it today. BTW, did you install ortools before step 4?

@Jakubach
Copy link

Jakubach commented Jul 30, 2024

No, I didn't. Checked to be sure with find / -type f -iname "*ortools*" and it's not installed.
Please let me know if this steps will work for you after you try.

@pl3703
Copy link

pl3703 commented Aug 2, 2024

No, I didn't. Checked to be sure with find / -type f -iname "*ortools*" and it's not installed. Please let me know if this steps will work for you after you try.

Thanks a lot! The humble version can be built successfully. Have you ever tried to build the iron with v2.0.0 Fields2cover? I'm still having the issue to complete this step

cd ~/ros2_ws/src/Fields2Cover`
mkdir -p build; 
cd build; cmake -DCMAKE_BUILD_TYPE=Release ..; 
make -j$(nproc); 
sudo make install;

Error is

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) (Required is at
  least version "4.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindSWIG.cmake:153 (find_package_handle_standard_args)
  swig/CMakeLists.txt:1 (find_package)

@pl3703
Copy link

pl3703 commented Aug 7, 2024

For iron version build, I'm able to build the v2.0.0 after installing dependencies by apt install swig gnuplot libfftw3-dev.

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

No branches or pull requests

7 participants