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

cmake: python: use system pybind11 if installed #5092

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

acolinisi
Copy link
Contributor

Fixes builds on offline hosts (common on HPC clusters), which otherwise
fail with failure to fetch pybind11 from the Internet, introduced in
c13efff:

CMake Error at
pybind11-subbuild/pybind11-populate-prefix/tmp/pybind11-populate-gitclone.cmake:31
(message):
  Failed to clone repository: 'https://github.com/pybind/pybind11.git'

Also, make build friendly to distribution packages. Distribution
package recipe should be in control of (1) dependencies to build against
(e.g. some distros are on pybind11 2.5, and it should be used unless
it's incompatible), and (2) when fetching happens vs when building
happens. So, there is a need for a packager-friendly build mode where
the build system doesn't go out and fetch whatever dependencies it
chooses whenever it chooses. This patch gives priority to the system
pybind11 with fallback to fetching.

An alternative (if you prefer) would be to keep fetch as the default, and add a flag for distributions to use: -DWITH_SYSTEM_PYBIND11 (default OFF).

@steven-johnson
Copy link
Contributor

LGTM but deferring to @alexreinking; also cloning for testing

python_bindings/CMakeLists.txt Outdated Show resolved Hide resolved
python_bindings/CMakeLists.txt Outdated Show resolved Hide resolved
python_bindings/CMakeLists.txt Outdated Show resolved Hide resolved
Fixes builds on offline hosts (common on HPC clusters), which otherwise
fail with failure to fetch pybind11 from the Internet, introduced in
c13efff:

	CMake Error at
	pybind11-subbuild/pybind11-populate-prefix/tmp/pybind11-populate-gitclone.cmake:31
	(message):
	  Failed to clone repository: 'https://github.com/pybind/pybind11.git'

Also, make build friendly to distribution packages.  Distribution
package recipe should be in control of (1) dependencies to build against
(e.g. some distros are on pybind11 2.5, and it should be used unless
it's incompatible), and (2) when fetching happens vs when building
happens. So, there is a need for a packager-friendly build mode where
the build system doesn't go out and fetch whatever dependencies it
chooses whenever it chooses. This patch gives priority to the system
pybind11 with fallback to fetching.
@acolinisi acolinisi force-pushed the PR--cmake-system-pybind11 branch from 3ab5015 to 8551fac Compare July 7, 2020 19:16
@acolinisi
Copy link
Contributor Author

Btw, d7034c8 undoes pybind11 2.4.3 -> 2.5.0 version change done in f9d8b7d . Was that intentional?

@alexreinking
Copy link
Member

alexreinking commented Jul 7, 2020

Btw, d7034c8 undoes pybind11 2.4.3 -> 2.5.0 version change done in f9d8b7d . Was that intentional?

Yes, we want to match the version in Ubuntu 20.04 LTS because that's what the Makefile-based build will use on such systems.

@alexreinking
Copy link
Member

@steven-johnson - if you would, please clone again for testing.

@steven-johnson
Copy link
Contributor

Clone looks good to land

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

Successfully merging this pull request may close these issues.

3 participants