Skip to content

Recent CMake changes prefer pybind11 installed in /usr/local/include to development files [macOS] #2381

@jbarlow83

Description

@jbarlow83

Issue description

Checkout HEAD - commit 1732046

mkdir build
cd build
cmake ..
make [check]

This is a regression compared to v2.5.0, where commands above work without issue.

cmake: 3.18.1
clang: Apple clang version 11.0.0 (clang-1100.0.33.17)
make: GNU Make 3.81

Result:

[  2%] Building CXX object tests/CMakeFiles/pybind11_cross_module_tests.dir/pybind11_cross_module_tests.cpp.o
~/src/pybind11/tests/pybind11_cross_module_tests.cpp:10:
~/src/pybind11/tests/pybind11_tests.h:56:1: error: unknown type name 'PYBIND11_NAMESPACE_BEGIN'
PYBIND11_NAMESPACE_BEGIN(pybind11)
^
~/src/pybind11/tests/pybind11_tests.h:56:35: error: expected ';' after top level declarator
PYBIND11_NAMESPACE_BEGIN(pybind11)
                                  ^
                                  ;
~/src/pybind11/tests/pybind11_tests.h:64:1: error: unknown type name 'PYBIND11_NAMESPACE_END'
PYBIND11_NAMESPACE_END(detail)
^
~/src/pybind11/tests/pybind11_tests.h:64:31: error: expected ';' after top level declarator
PYBIND11_NAMESPACE_END(detail)
                              ^
                              ;
~/src/pybind11/tests/pybind11_cross_module_tests.cpp:11:
~/src/pybind11/tests/local_bindings.h:12:19: error: no template named 'LocalBase'
using LocalType = LocalBase<0>;
                  ^
~/src/pybind11/tests/local_bindings.h:14:22: error: no template named 'LocalBase'
using NonLocalType = LocalBase<1>;
                     ^
~/src/pybind11/tests/local_bindings.h:16:19: error: no template named 'LocalBase'
using NonLocal2 = LocalBase<2>;
                  ^
~/src/pybind11/tests/local_bindings.h:18:23: error: no template named 'LocalBase'
using LocalExternal = LocalBase<3>;
                      ^
~/src/pybind11/tests/local_bindings.h:20:26: error: no template named 'LocalBase'
using MixedLocalGlobal = LocalBase<4>;
                         ^
~/src/pybind11/tests/local_bindings.h:22:26: error: no template named 'LocalBase'
using MixedGlobalLocal = LocalBase<5>;
                         ^
~/src/pybind11/tests/local_bindings.h:25:23: error: no template named 'LocalBase'
using ExternalType1 = LocalBase<6>;
                      ^
~/src/pybind11/tests/local_bindings.h:26:23: error: no template named 'LocalBase'
using ExternalType2 = LocalBase<7>;
                      ^
~/src/pybind11/tests/local_bindings.h:28:30: error: use of undeclared identifier 'LocalType'
using LocalVec = std::vector<LocalType>;
                             ^
~/src/pybind11/tests/local_bindings.h:29:31: error: use of undeclared identifier 'NonLocal2'
using LocalVec2 = std::vector<NonLocal2>;
                              ^
~/src/pybind11/tests/local_bindings.h:30:50: error: use of undeclared identifier 'LocalType'
using LocalMap = std::unordered_map<std::string, LocalType>;
                                                 ^
~/src/pybind11/tests/local_bindings.h:31:33: error: use of undeclared identifier 'NonLocalType'
using NonLocalVec = std::vector<NonLocalType>;
                                ^
~/src/pybind11/tests/local_bindings.h:32:34: error: use of undeclared identifier 'NonLocal2'
using NonLocalVec2 = std::vector<NonLocal2>;
                                 ^
~/src/pybind11/tests/local_bindings.h:33:53: error: use of undeclared identifier 'NonLocalType'
using NonLocalMap = std::unordered_map<std::string, NonLocalType>;
                                                    ^
~/src/pybind11/tests/local_bindings.h:36:22: error: use of undeclared identifier 'LocalVec'
PYBIND11_MAKE_OPAQUE(LocalVec);
                     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [tests/CMakeFiles/pybind11_cross_module_tests.dir/pybind11_cross_module_tests.cpp.o] Error 1
make[1]: *** [tests/CMakeFiles/pybind11_cross_module_tests.dir/all] Error 2
make: *** [all] Error 2

The same errors occurs in each of these cases:

  • attempt this with homebrew python (3.8) in the system environment
  • attempt the same through a virtual environment
  • pip install . is used to install pybind11
  • pip install -e . is used to install pybind11 in edit mode

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions