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

Default 1.5.0 build on Ubuntu 22.04 attempts to build lcm-python which requires Python_LIBRARY #453

Open
jwatson27 opened this issue May 19, 2023 · 3 comments

Comments

@jwatson27
Copy link

Summary

When attempting to build LCM 1.5.0 from source on ubuntu 22.04, the cmake configuration step throws the following error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Python_LIBRARY
    linked by target "lcm-python" in directory /usr/src/lcm-1.5.0/lcm-python

Example

Host OS: Ubuntu 22.04
Docker version: Docker version 23.0.6, build ef23cbc.

Dockerfile

FROM ubuntu:22.04 as lcm

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        build-essential \
        cmake \
        libglib2.0-dev \
        curl \
        ca-certificates \
        unzip \
        default-jdk \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src
RUN curl -fSL "https://github.com/lcm-proj/lcm/archive/refs/tags/v1.5.0.zip" -o "lcm-1.5.0.zip" \
    && unzip "lcm-1.5.0.zip"
WORKDIR /usr/src/lcm-1.5.0/build

Build & Run

docker build -f Dockerfile -t lcm-bug .
docker run -it lcm-bug cmake ..

Output

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found GLib2_glib: /usr/lib/x86_64-linux-gnu/libglib-2.0.so  
-- Found GLib2: /usr/lib/x86_64-linux-gnu/libglib-2.0.so  found components: glib 
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__std_gnu99
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__std_gnu99 - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wall
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wall - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wshadow
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wshadow - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wuninitialized
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wuninitialized - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wunused_variable
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wunused_variable - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Werror_return_type
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Werror_return_type - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wno_unused_parameter
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wno_unused_parameter - Success
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wno_format_zero_length
-- Performing Test CMAKE_C_COMPILER_SUPPORTS__Wno_format_zero_length - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wall
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wall - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wshadow
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wshadow - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wuninitialized
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wuninitialized - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wunused_variable
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wunused_variable - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Werror_return_type
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Werror_return_type - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wno_unused_parameter
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wno_unused_parameter - Success
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wno_format_zero_length
-- Performing Test CMAKE_CXX_COMPILER_SUPPORTS__Wno_format_zero_length - Success
-- Building LCM 1.5.0 (ABI v1)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Found Python: /usr/bin/python3.10 (found version "3.10.6") found components: Interpreter 
-- Could NOT find Python (missing: Python_INCLUDE_DIRS Python_LIBRARIES Interpreter Development Development.Module Development.Embed) 
CMake Warning at docs/CMakeLists.txt:5 (message):
  Doxygen was not found; documentation generation will be incomplete


-- Found Java: /usr/bin/java (found suitable version "11.0.19", minimum required is "1.8") 
-- Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) 
Unable to parse the Go version string: 
-- Could NOT find Go (missing: GO_VERSION GO_PLATFORM GO_ARCH) 
-- CPack: Packages will be placed under /usr/src/lcm-1.5.0/build/packages
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Python_LIBRARY
    linked by target "lcm-python" in directory /usr/src/lcm-1.5.0/lcm-python

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
@jwatson27
Copy link
Author

Workarounds

Disable Python Build

If building python is not necessary, it can be disable using the LCM_ENABLE_PYTHON cmake variable.

docker run -it lcm-bug cmake .. -DLCM_ENABLE_PYTHON=OFF

In this case, the cmake configuration completes correctly without checking for the python library.

Install Python Dev

If building python is necessary, install the python dev apt package before building LCM. For example, adding the following to the Dockerfile before the WORKDIR /usr/src results in the following output during the cmake configuration.

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python3-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

Build & Run

docker build -f Dockerfile -t lcm-bug .
docker run -it lcm-bug cmake ..

Output

-- Found Python: /usr/bin/python3.10 (found version "3.10.6") found components: Interpreter 
-- Found Python: /usr/bin/python3.10 (found version "3.10.6") found components: Interpreter Development Development.Module Development.Embed

@jwatson27
Copy link
Author

In version 1.4.0, if the Python_LIBRARY was not found, it would skip the python build. Should version 1.5.0 also do that?

If the python installation is desired for the default build, I think the python dev package (e.g. python3-dev) should be listed as a required dependency.

@nosracd
Copy link
Contributor

nosracd commented May 20, 2023

In version 1.4.0, if the Python_LIBRARY was not found, it would skip the python build. Should version 1.5.0 also do that?

If the python installation is desired for the default build, I think the python dev package (e.g. python3-dev) should be listed as a required dependency.

Agree on both counts; it looks like this is a bug in the meson logic. It looks like the detection logic may just be checking for the interpreter

# Python
lcm_option(
  LCM_ENABLE_PYTHON
  "Build Python bindings and utilities"
  PYTHON_FOUND Python)
if(LCM_ENABLE_PYTHON)
  add_subdirectory(lcm-python)
endif()

but it should be disabling if other necessary components are not found.

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

2 participants