ilpincy / argos3

A parallel, multi-engine simulator for heterogeneous swarm robotics
http://www.argos-sim.info/
268 stars 121 forks source link

argos3_simulator.pc no longer generated ? #177

Closed jharwell closed 3 years ago

jharwell commented 3 years ago

With the latest master, the pkg-config file for ARGoS does not seem to be generated, so when I try to use the ARGoS cmake module elsewhere, I get all sorts of cryptic errors.

My cmake command is just cmake ../src from <argos>/build.

Am I doing something wrong ?

ilpincy commented 3 years ago

The compilation scripts changed a few months ago - check the updated examples to see how to correctly detect ARGoS in your system. Most of the configuration is done automatically now.

jharwell commented 3 years ago

That was not the issue. The issue was that the argos3_simulator.py file is not generated by the ARGoS build process, not that it is generated and my code can't find it when I try to use the ARGoS cmake package in my code later.

Steps to reproduce:

  1. Remove $HOME/.local/lib/pkg-config directory if it exists.
  2. Checkout latest ARGoS master 7c8a51b63400ccf477d5d5132b83349d81d1ae1f
  3. cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DARGOS_INSTALL_LDSOCONF=NO ../src from <argos>/build
  4. make && make doc && make install

Expected result: $HOME/.local/lib/pkg-config/argos3_simulator.pc exists after installation. Actual result: File does not exist.

Prior to commit c0ff091e9f037b022281cec6080c78fa3bd57879 this does not happen and everything works as expected.

It looks like the following lines were deleted from src/CMakeLists.txt by f515fbb356597ac56324c756c96578e00f0037f2:

-# Configuration file for pkg-config
-configure_file(
-  ${CMAKE_SOURCE_DIR}/scripts/argos3.pc.in
-  ${CMAKE_BINARY_DIR}/argos3_${ARGOS_BUILD_FOR}.pc
-  @ONLY)
-install(FILES ${CMAKE_BINARY_DIR}/argos3_${ARGOS_BUILD_FOR}.pc DESTINATION lib/pkgconfig)

which seems to be the source of the issue. I think? There are present in c0ff091e9f037b022281cec6080c78fa3bd57879 and not in later commits after FindARGoS was updated.

Was this an accidental deletion, or was this the old mechanism supposed to be replaced by something new ?

ilpincy commented 3 years ago

As I said in my previous message: the way ARGoS is detected and compilation configured has changed. It is not based on pkg-config anymore, because that system did not allow to easily check for and configure the other dependencies. I don't plan to reinstate it, given its limitations.

jharwell commented 3 years ago

In that case, the examples should be updated--they still say that if FindARGoS fails to check pkg-config settings.

ilpincy commented 3 years ago

I am not sure I understand the issue. Can you show me what's going wrong on your side? The correct code is what is reported in the examples here:

find_package(ARGoS REQUIRED)
include_directories(${CMAKE_SOURCE_DIR} ${ARGOS_INCLUDE_DIRS})
link_directories(${ARGOS_LIBRARY_DIR})
link_libraries(${ARGOS_LDFLAGS})

EDIT: The find_package() statement needs to find the file ARGoSConfig (see here), which is installed in /usr/local/share/argos3/cmake or /usr/share/argos3/cmake (this is the default behavior in cmake, as reported in the manual). In case you are using a non-standard installation prefix (not /usr or /usr/local), you need use the CMake option cmake -DCMAKE_MODULE_PATH=/path/to/argos3/share/cmake ....

jharwell commented 3 years ago

The code is correct, but the README https://github.com/ilpincy/argos3-examples/blob/master/README still contains:

When you launch one of the two 'cmake' commands, you might get an error like 'package argos3_simulator' not found. This error has two possible causes:

  1. You haven't installed ARGoS3 system-wide. To fix this, install ARGoS3 through the packages or with the command 'sudo make install' in the ARGoS3 build directory.
  2. pkg-config can't find the file argos3_simulator.pc. When you install ARGoS3 from a package, this file is located in /usr/lib/pkgconfig/. When you install ARGoS3 from the sources, this file is located in $CMAKE_INSTALL_PREFIX/lib/pkgconfig/. If you don't set $CMAKE_INSTALL_PREFIX explicitly before compiling, by default it is set to /usr/local. If the file is present and pkg-config can't find it, add the directory where it's located to the environment variable PKG_CONFIG_PATH, e.g.

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

which is where my confusion came from--I checked the README first.

ilpincy commented 3 years ago

Well spotted - I forgot to update the README. Thanks, I'll change it!

jharwell commented 3 years ago

:+1: