Skip to content

Instantly share code, notes, and snippets.

@yashi
Created February 12, 2024 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashi/0661b04106661e75b1749d3f057331e7 to your computer and use it in GitHub Desktop.
Save yashi/0661b04106661e75b1749d3f057331e7 to your computer and use it in GitHub Desktop.
# When you build ROS by yourself, do NOT have multiple version of
# Python development packages (libpython3.XX-dev).
#
# Because packages in ROS use either
#
# find_package(Python3 REQUIRED COMPONENTS Development)
# or
# find_package(Python3 REQUIRED COMPONENTS Interpreter)
#
# These two give you a different version if you have a different
# version of python3.XX-dev from /usr/bin/python3.
#
# If you see something like the following, this could be the case.
#
# CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
# Could NOT find Python3 (missing: Development Development.Module
# Development.Embed) (found version "3.12")
#
# This happends when your /usr/bin/python3 is "3.11" but you have
# libpython3.12-dev.
#
# $ rm -rf builddir && cmake -B builddir
# -- The C compiler identification is GNU 13.2.0
# -- The CXX compiler identification is GNU 13.2.0
# -- Detecting C compiler ABI info
# -- Detecting C compiler ABI info - done
# -- Check for working C compiler: /usr/lib/ccache/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/lib/ccache/c++ - skipped
# -- Detecting CXX compile features
# -- Detecting CXX compile features - done
# -- Found Python3: /usr/include/python3.12 (found version "3.12.2") found components: Development Development.Module Development.Embed
# -- Found Python3: /usr/bin/python3 (found version "3.11.7") found components: Interpreter
# -- Configuring done (0.4s)
# -- Generating done (0.0s)
# -- Build files have been written to: /tmp/foo/builddir
cmake_minimum_required(VERSION 3.28)
project(check-pythons)
find_package(Python3 REQUIRED COMPONENTS Development)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment