buzz-lang/Buzz

Cmake fails with "FindLua52.cmake"

prajankya opened this issue · 1 comments

Exact error

-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'argos3_simulator'
--   Found argos3_simulator, version 3.0.0-beta56
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so  
CMake Error at cmake/BuzzBuildChecks.cmake:16 (find_package):
  By not providing "FindLua52.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Lua52", but
  CMake did not find one.

  Could not find a package configuration file provided by "Lua52" with any of
  the following names:

    Lua52Config.cmake
    lua52-config.cmake

  Add the installation prefix of "Lua52" to CMAKE_PREFIX_PATH or set
  "Lua52_DIR" to a directory containing one of the above files.  If "Lua52"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:38 (include)


-- Configuring incomplete, errors occurred!
See also "<$HOME>/buzz/build/CMakeFiles/CMakeOutput.log".

Environment

OS: Ubuntu 19.10
Kernel: 5.3.0-7625-generic
cmake: 3.13.4
gcc: 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)
All packages updated to latest stable

Steps I followed

Installed ArGOS
by following the commands

git clone https://github.com/ilpincy/argos3.git argos3

sudo apt-get install cmake libfreeimage-dev libfreeimageplus-dev \
  qt5-default freeglut3-dev libxi-dev libxmu-dev liblua5.3-dev \
  lua5.3 doxygen graphviz graphviz-dev asciidoc

 cd argos3
mkdir build_simulator
cd build_simulator
cmake ../src
make
make doc
sudo make install
. setup_env.sh 

Using the same terminal, i.e. keeping env variables from setup_env.sh, tested with argos examples, diffusion_1 and diffusion_10 working properly as expected.

Then starting with installing Buzz,

git clone https://github.com/MISTLab/Buzz.git buzz
cd buzz
mkdir build
cd build
cmake ../src

This place is the problem.

Solution

solution 1

After some trial and testing, following are the steps which solved my issue,

sudo apt install lua5.2 liblua5.2-dev

Getting the file from https://github.com/ilpincy/argos3/blob/b666cadcd0ba103007ced71882bfef5a77e1dc24/src/cmake/FindLua52.cmake
and putting in buzz/src/cmake/FindLua52.cmake solved the issue.

As argos require liblua5.3-dev and buzz has no dependency documented in readme for liblua5.2-dev, I had got stuck. Also tried removing the findLua52 (so lua5.2 and liblua5.2-dev is installed in the system) and trying to update ldconfig. The project can't compile without the file.

As no one else had this issue, maybe I have something wrong/different. Is the cmake line find_package(Lua52 REQUIRED) working without the file ?

solution 2

Diving deeper, got to know, cmake has
https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindLua51.cmake to get Lua5.1 but doesn't have "FindLua52.cmake" but instead https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindLua.cmake.

So tried changing line at
https://github.com/MISTLab/Buzz/blob/122a0b22c203b78235908afd1453c9a18c0be747/src/cmake/BuzzBuildChecks.cmake#L16

to find_package(Lua REQUIRED)

Which compiled successfully, though it took lua5.3 (installed in the dependency of argos) and not 5.2.

-- Checking for module 'argos3_simulator'
--   Found argos3_simulator, version 3.0.0-beta56
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so  
-- Found Lua: /usr/lib/x86_64-linux-gnu/liblua5.3.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "5.3.3") 
-- Configuring done

I cannot determine if the lua5.2 is required or lua5.3 as it is compiling with both of the solutions.

Considering Buzz only requires lua when ARGoS is present, and ARGoS is compiled with lua5.3,
changing the line to find_package(Lua REQUIRED) should be the solution I suppose.

Also as shown in https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindLua.cmake#L51 any future versions of lua will be auto added, and hence solution 2 will be better.

Please suggest for any future tests required to help in this issue.

This was fixed a while ago in the development repository.