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

[package] pybind11/2.6.1: CMake warning and error emitted for test_package example #3743

Closed
dchapp opened this issue Nov 30, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@dchapp
Copy link

dchapp commented Nov 30, 2020

Hi, I have a directory containing all of the files from the pybind11/2.6.1 test package (minus the conanfile.py) and the following conanfile.txt:

[requires]                                                                      
pybind11/2.6.1                                                                  
                                                                                
[generators]                                                                    
cmake 

I expected that I would be able to execute the following commands:

  • conan install . --build missing
  • cmake .
  • make

However, I observe the following output from CMake:

-- The CXX compiler identification is GNU 9.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-9 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/dchapp/repos/conan-center-index/recipes/pybind11/all/test
-- Conan: Compiler GCC>=5, checking major version 9.3
-- Conan: Checking correct version: 9.3
-- Found PythonInterp: /usr/bin/python (found version "2.7.17") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so
CMake Warning at /home/dchapp/.conan/data/pybind11/2.6.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib/cmake/pybind11/pybind11Tools.cmake:17 (message):
  Set PYBIND11_PYTHON_VERSION to search for a specific version, not
  PYTHON_VERSION (which is an output).  Assuming that is what you meant to do
  and continuing anyway.
Call Stack (most recent call first):
  /home/dchapp/.conan/data/pybind11/2.6.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib/cmake/pybind11/pybind11Common.cmake:201 (include)
  /home/dchapp/.conan/data/pybind11/2.6.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib/cmake/pybind11/pybind11Install.cmake:249 (include)
  conanbuildinfo.cmake:781 (include)
  conanbuildinfo.cmake:259 (conan_include_build_modules)
  CMakeLists.txt:5 (conan_basic_setup)


-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /home/dchapp/.conan/data/pybind11/2.6.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include (found version "" )
CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "pybind11",
  but CMake did not find one.

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

    pybind11Config.cmake
    pybind11-config.cmake

  Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
  "pybind11_DIR" to a directory containing one of the above files.  If
  "pybind11" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!
See also "/home/dchapp/repos/conan-center-index/recipes/pybind11/all/test/CMakeFiles/CMakeOutput.log".

If I use the deprecated(?) conan package pybind11/2.3.0@conan/stable I do not observe this error.
At this point I am unsure whether this is a problem with how I'm using conan or how the package is defined. Any assistance would be welcome.

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: pybind11/2.6.1
  • Operating System+version: Linux Ubuntu 18.04
  • Compiler+version: GCC 9.3
  • Conan version: conan 1.31.0
  • Python version: Python 3.6.9

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=9.3
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
CC=/usr/bin/gcc-9
CXX=/usr/bin/g++-9
@dchapp dchapp added the bug Something isn't working label Nov 30, 2020
@Namburger
Copy link

Namburger commented Dec 1, 2020

I got this to work with a work around CMakeLists.txt (doing it the normal cmake way):

cmake_minimum_required(VERSION 3.4)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include_directories(SYSTEM ${CONAN_INCLUDE_DIRS})

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/pybind11/include)

add_library(test_package SHARED
  test_package.cpp
)

# Don't add a 'lib' prefix to the shared library
set_target_properties(test_package PROPERTIES PREFIX "")
set_target_properties(test_package PROPERTIES SUFFIX ".so")

enable_testing()
add_test(run_example
  ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test.py ${CMAKE_CURRENT_BINARY_DIR}/lib)

However, I believe it should works as described in the doc (which is the way the example failed CMakeLists.txt in the example does):
https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake

Team, we would really appreciate it if we can get to the bottom of this issue!

@prince-chrismc
Copy link
Contributor

The CCI test_package is exactly that, a test which is expecting to be called when the package is created to ensure its validity.

The "work around" as I understand it, is the correct way of consuming the outputs of your conan install.

So to be clear the test_package is not an example.

@mydatamodels
Copy link
Contributor

But why the pybind11Config.cmake file is missing in the conan index package?

@prince-chrismc
Copy link
Contributor

But why the pybind11Config.cmake file is missing in the conan index package?

We recently had a contribution #4641 complaining about it's existence. You might not have configured Conanfile correctly

@mydatamodels
Copy link
Contributor

mydatamodels commented Mar 12, 2021

I see. By the way the pybind11 docs suggests to use find_package(pybind11 CONFIG REQUIRED) in CMakeLists.txt with cmake 3.12+, and this does not work with the conan index package. On the other hand using the upstream pybind11 make install in the recipe works just fine without warnings (cmake version 3.19.6).

Reference:
https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode

@prince-chrismc
Copy link
Contributor

We are aware, Conan still official supports older versions so we have not changed it =)

Again, you most likely do have your project setup correctly, I'd encourage you to try the slack channel there a lot of helpful community members. You can also open an issue and we'll do our best to get to it.

@danimtb
Copy link
Member

danimtb commented Apr 20, 2021

Should be working fine after #4445 got merged

@perseoGI
Copy link
Contributor

perseoGI commented Sep 9, 2024

Hi there,
I was reviewing old issues and I have come across this one.
The pybind11/2.6.1 is no longer supported by Conan Center Index.

I'm closing this issue as this recipe has suffer plenty of modifications since this issue was reported.
If for some reason the problem remains nowadays, do not hesitate to reopen this issue or create a new ticket with updated information, preferably using conan v2.

Happy coding 🐸

@perseoGI perseoGI closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants