Skip to contentSkip to conversation

package/pybind11: new package

PATCH New guillaume.bressaix at gmail.com 2 participants 5 messages Feb 27, 2021 – May 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pybind11: new package

From: "Guillaume W. Bres" <[email protected]>

Pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.

---

Warning!!: this new package and its internal BR2_PACKAGE_PYBIND11_WITH_PYTHON option
intends to replace package/python-pybind which is totally broken since upgrade to v2.6.1 in ->next.

The python build now requires a previous cmake build:
+ python-pybind only is not possible and will not build by itself

+ python setup.py requires cmake to install
within $(@D) a couple files (in $(@D)/pybind11 exactly) to properly work. See my message in BR digest 17/02:
<CAJe0E3eQxAZHAe2DN4Qp9k_0czYGsR639+=bSUaEdyaKm0Keuw@mail.gmail.com> cc to Thomas, Gwen & Peter, entitled:
"Python-pybind we need to discuss this package"

=> If this package is merged, package/python-pybind is deprecated

=> package/python-pybind v2.6.1+ in ->next must be removed, python-build by itself cannot work anymore

Pybind11 is a host only package

---
 DEVELOPERS                     |  1 +
 package/pybind11/Config.in     | 25 ++++++++++++++++++++
 package/pybind11/pybind11.hash |  3 +++
 package/pybind11/pybind11.mk   | 42 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 package/pybind11/Config.in
 create mode 100644 package/pybind11/pybind11.hash
 create mode 100644 package/pybind11/pybind11.mk
DEVELOPERS +1 -0
index b019fe04d5..98e8b329ed 100644
@@ -1057,6 +1057,7 @@ N:	Guillaume William Brs <[email protected]>
 F:	package/libnids/
 F:	package/liquid-dsp/
 F:	package/pixiewps/
+F:	package/pybind11/
 F:	package/python-pybind/
 F:	package/reaver/
 
package/pybind11/Config.in new file +25 -0
new file mode 100644
index 0000000000..883bf8cc09
@@ -0,0 +1,25 @@
+comment "pybind11 needs a toolchain w/ C++, wchar"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+config BR2_PACKAGE_PYBIND11
+	bool "pybind11"
+	depends on BR2_INSTALL_LIBSTDCPP # boost
+	depends on BR2_USE_WCHAR # boost
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-thread
+	select BR2_PACKAGE_BOOST
+	help
+	  Pybind11 is a lightweight header-only library that exposes C++
+	  types in Python and vice versa, mainly to create Python
+	  bindings of existing C++ code.
+
+	  http://pybind11.readthedocs.org/en/master
+
+if BR2_PACKAGE_PYBIND11
+
+config BR2_PACKAGE_PYBIND11_WITH_PYTHON
+	bool "pybind11-python"
+	depends on BR2_PACKAGE_PYTHON3
+	help
+	  Activate support for python-pybind
+
+endif
package/pybind11/pybind11.hash new file +3 -0
new file mode 100644
index 0000000000..e703519a22
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2  pybind11-2.6.2.tar.gz
+sha256 83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb  LICENSE
package/pybind11/pybind11.mk new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/pybind11: new package

See examples of failures that this new approach fixes:
http://autobuild.buildroot.net/results/44c98429a90e2799a92f71e0b70c6b0cc6145867/
http://autobuild.buildroot.net/results/3065c4a240eeed2b62f7c0ba364ed215379e0776/

Guillaume W. Bres
Software engineer
<[email protected]>

Le sam. 27 f?vr. 2021 ? 11:10, <[email protected]> a ?crit :

Quoted 151 lines

From: "Guillaume W. Bres" <[email protected]>

Pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.

---

Warning!!: this new package and its internal BR2_PACKAGE_PYBIND11_WITH_PYTHON option
intends to replace package/python-pybind which is totally broken since upgrade to v2.6.1 in ->next.

The python build now requires a previous cmake build:
+ python-pybind only is not possible and will not build by itself

+ python setup.py requires cmake to install within $(@D) a couple files (in $(@D)/pybind11 exactly) to properly work. See my message in BR digest 17/02:
<CAJe0E3eQxAZHAe2DN4Qp9k_0czYGsR639+=
bSUaEdyaKm0Keuw at mail.gmail.com>
cc to Thomas, Gwen & Peter, entitled:
"Python-pybind we need to discuss this package"

=> If this package is merged, package/python-pybind is deprecated

=> package/python-pybind v2.6.1+ in ->next must be removed, python-build by itself cannot work anymore

Pybind11 is a host only package

---
 DEVELOPERS                     |  1 +
 package/pybind11/Config.in     | 25 ++++++++++++++++++++
 package/pybind11/pybind11.hash |  3 +++
 package/pybind11/pybind11.mk   | 42 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 package/pybind11/Config.in
 create mode 100644 package/pybind11/pybind11.hash
 create mode 100644 package/pybind11/pybind11.mk
DEVELOPERS +0 -0
index b019fe04d5..98e8b329ed 100644
@@ -1057,6 +1057,7 @@ N:        Guillaume William Brs <

guillaume.bressaix at gmail.com>

 F:     package/libnids/
 F:     package/liquid-dsp/
 F:     package/pixiewps/
DEVELOPERS +1 -0
+F:     package/pybind11/
 F:     package/python-pybind/
 F:     package/reaver/
package/pybind11/Config.in new file +25 -0
new file mode 100644
index 0000000000..883bf8cc09
@@ -0,0 +1,25 @@
+comment "pybind11 needs a toolchain w/ C++, wchar"
+       depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+config BR2_PACKAGE_PYBIND11
+       bool "pybind11"
+       depends on BR2_INSTALL_LIBSTDCPP # boost
+       depends on BR2_USE_WCHAR # boost
+       depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-thread
+       select BR2_PACKAGE_BOOST
+       help
+         Pybind11 is a lightweight header-only library that exposes C++
+         types in Python and vice versa, mainly to create Python
+         bindings of existing C++ code.
+
+         http://pybind11.readthedocs.org/en/master
+
+if BR2_PACKAGE_PYBIND11
+
+config BR2_PACKAGE_PYBIND11_WITH_PYTHON
+       bool "pybind11-python"
+       depends on BR2_PACKAGE_PYTHON3
+       help
+         Activate support for python-pybind
+
+endif
package/pybind11/pybind11.hash new file +2 -0
new file mode 100644
index 0000000000..e703519a22
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2

pybind11-2.6.2.tar.gz
+sha256 83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb LICENSE

package/pybind11/pybind11.mk new file +42 -1
new file mode 100644
index 0000000000..c8d69e1dd4
@@ -0,0 +1,42 @@
 
+################################################################################
+#
+# pybind11
+#
 
+################################################################################
+
+PYBIND11_VERSION = 2.6.2
+PYBIND11_SITE = $(call github,pybind,pybind11,v$(PYBIND11_VERSION))
+PYBIND11_LICENSE = BSD-3-Clause
+PYBIND11_LICENSE_FILES = LICENSE
+PYBIND11_INSTALL_STAGING = YES
+PYBIND11_SUPPORTS_IN_SOURCE_BUILD = YES
+
+HOST_PYBIND11_CONF_OPTS = \
+       -DBUILD_DOCS=OFF \
+       -DDOWNLOAD_EIGEN=OFF \
+       -DPYTHON=$(TARGET_DIR)/usr/bin/python \
+       -DPYTHON_PREFIX=$(STAGING_DIR)/usr
+
+# pybind11-python support activation
+# this requires the cmake build installed within $(@D)
+ifeq ($(BR2_PACKAGE_PYBIND11_WITH_PYTHON),y)
+
+HOST_PYBIND11_DEPENDENCIES += host-python3
+
+HOST_PYBIND11_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=$(@D)/pybind11
+
+define PYBIND11_PYTHON_BUILD
+       cd $(@D) && $(HOST_DIR)/bin/python setup.py install
+endef
+
+HOST_PYBIND11_POST_INSTALL_HOOKS += PYBIND11_PYTHON_BUILD
+
+else
+
+HOST_PYBIND11_CONF_OPTS += \
+       -DPYBIND_FINDPYTHON=OFF \
+       -DPYBIND11_NOPYTHON=ON
+
+endif
+
+$(eval $(host-cmake-package))
--
Quoted 3 lines

2.20.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210227/363f2cf0/attachment.html>

#2 lore raw

PATCH 1/1 package/pybind11: new package

In reply to guillaume.bressaix at gmail.com

Hi Guillaume,

Quoted 5 lines · guillaume.bressaix at gmail.com

From: "Guillaume W. Bres" <[email protected]>

Pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.

It helps a lot if you add Fixes: lines with the autobuilder failures. Since we
have a backlog of 400+ patches, new packages get ignored pretty easily.

Quoted 7 lines

---

Warning!!: this new package and its internal BR2_PACKAGE_PYBIND11_WITH_PYTHON option
intends to replace package/python-pybind which is totally broken since upgrade to v2.6.1 in ->next.

It would be good to also add a patch that removes python-pybind then. For that
patch, don't forget to add a conversion in Config.in.legacy.

Quoted 6 lines

The python build now requires a previous cmake build:
+ python-pybind only is not possible and will not build by itself

+ python setup.py requires cmake to install

I see that on the first version of this package, you got feedback to not use
cmake. That was clearly a mistake :-)

Quoted 10 lines

within $(@D) a couple files (in $(@D)/pybind11 exactly) to properly work. See my message in BR digest 17/02:
<CAJe0E3eQxAZHAe2DN4Qp9k_0czYGsR639+=bSUaEdyaKm0Keuw@mail.gmail.com> cc to Thomas, Gwen & Peter, entitled:
"Python-pybind we need to discuss this package"

=> If this package is merged, package/python-pybind is deprecated

=> package/python-pybind v2.6.1+ in ->next must be removed, python-build by itself cannot work anymore

I guess we can keep it in 2021.02 right? It still builds there?

Quoted 2 lines

Pybind11 is a host only package

I don't get it... This is supposed to replace python-pybind, which is a target
package. How is that ever going to work?

Quoted 30 lines
---
 DEVELOPERS                     |  1 +
 package/pybind11/Config.in     | 25 ++++++++++++++++++++
 package/pybind11/pybind11.hash |  3 +++
 package/pybind11/pybind11.mk   | 42 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 package/pybind11/Config.in
 create mode 100644 package/pybind11/pybind11.hash
 create mode 100644 package/pybind11/pybind11.mk
DEVELOPERS +1 -0
index b019fe04d5..98e8b329ed 100644
@@ -1057,6 +1057,7 @@ N:	Guillaume William Brs <[email protected]>
 F:	package/libnids/
 F:	package/liquid-dsp/
 F:	package/pixiewps/
+F:	package/pybind11/
 F:	package/python-pybind/
 F:	package/reaver/
 
package/pybind11/Config.in new file +0 -0
new file mode 100644
index 0000000000..883bf8cc09

package/pybind11/Config.in line 4

Quoted 4 lines
package/pybind11/Config.in new file +4 -0
@@ -0,0 +1,25 @@
+comment "pybind11 needs a toolchain w/ C++, wchar"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+config BR2_PACKAGE_PYBIND11

Host packages should be called BR2_PACKAGE_HOST_PYBIND11. But I think you
actually meant to have a target package... Anyway for a host package we normally don't even want a Config.in symbol, and it should only exist if it is a dependency of some other package. We only want Config.in symbols for host packages that you might want to use in a post-build script (like genimage).

But again, I think you actually meant to have a target package.

package/pybind11/Config.in line 6

Quoted 2 lines
package/pybind11/Config.in new file +2 -0
+	bool "pybind11"
+	depends on BR2_INSTALL_LIBSTDCPP # boost

The # boost comment is not needed, since this package is a C++ package itself.

package/pybind11/Config.in line 9

Quoted 3 lines
package/pybind11/Config.in new file +3 -0
+	depends on BR2_USE_WCHAR # boost
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-thread
+	select BR2_PACKAGE_BOOST

The README pretty explicitly says that the goal of the project is to avoid a
dependency on Boost. Are you sure this dependency is needed?

On the other hand, the package is intended to create python-C++ bindings, so I
think there should be a dependency on python.

The README also says that it depends on C++11 features, so you'll need

	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11

(+ comment)

Quoted 4 lines
package/pybind11/Config.in new file +4 -0
+	help
+	  Pybind11 is a lightweight header-only library that exposes C++
+	  types in Python and vice versa, mainly to create Python
+	  bindings of existing C++ code.

package/pybind11/Config.in line 23

Quoted 10 lines
package/pybind11/Config.in new file +10 -0
+
+	  http://pybind11.readthedocs.org/en/master
+
+if BR2_PACKAGE_PYBIND11
+
+config BR2_PACKAGE_PYBIND11_WITH_PYTHON
+	bool "pybind11-python"
+	depends on BR2_PACKAGE_PYTHON3
+	help
+	  Activate support for python-pybind

I suppose the idea is to choose between "expose python objects in C++" and
"expose C++ objects in python". The help text doesn't really tell me which of the two this option enables... Can you clarify that? I think the main package help text should explain that only the headers are installed unless _WITH_PYTHON is enabled.

Quoted 19 lines
package/pybind11/Config.in new file +2 -0
+
+endif
package/pybind11/pybind11.hash new file +3 -0
new file mode 100644
index 0000000000..e703519a22
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2  pybind11-2.6.2.tar.gz
+sha256 83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb  LICENSE
package/pybind11/pybind11.mk new file +2 -0
new file mode 100644
index 0000000000..c8d69e1dd4
@@ -0,0 +1,42 @@
+################################################################################
+#

package/pybind11/pybind11.mk line 12

Quoted 10 lines
package/pybind11/pybind11.mk new file +10 -0
+# pybind11
+#
+################################################################################
+
+PYBIND11_VERSION = 2.6.2
+PYBIND11_SITE = $(call github,pybind,pybind11,v$(PYBIND11_VERSION))
+PYBIND11_LICENSE = BSD-3-Clause
+PYBIND11_LICENSE_FILES = LICENSE
+PYBIND11_INSTALL_STAGING = YES
+PYBIND11_SUPPORTS_IN_SOURCE_BUILD = YES

This is the default, it only needs to be set to NO for packages that don't
support in-source build.

package/pybind11/pybind11.mk line 16

Quoted 4 lines
package/pybind11/pybind11.mk new file +4 -0
+
+HOST_PYBIND11_CONF_OPTS = \
+	-DBUILD_DOCS=OFF \
+	-DDOWNLOAD_EIGEN=OFF \

This sounds like there should also be a (perhaps optional) dependency on eigen?
Ah, no, it's only used for tests - better mention that in the commit message.

package/pybind11/pybind11.mk line 17

Quoted 1 line
package/pybind11/pybind11.mk new file +1 -0
+	-DPYTHON=$(TARGET_DIR)/usr/bin/python \

This means you *definitely* need a dependency on python. However, I think it is
only needed if we actually create the python bindings, i.e. if BR2_PACKAGE_PYBIND11_WITH_PYTHON is turned on.

However, I don't see this used anywhere in the cmake code. I *do* see
PYTHON_EXECUTABLE - isn't that what you meant? Hm, no, that can't be, because it is used to actually execute some python code, so it shouldn't point to the target python. In fact, it never makes sense to point to the target python - if it is actually used for something on the target, the $(TARGET_DIR) part should not be there at all...

Also, this should probably be python3 and not plain python.

package/pybind11/pybind11.mk line 29

Quoted 12 lines
package/pybind11/pybind11.mk new file +12 -0
+	-DPYTHON_PREFIX=$(STAGING_DIR)/usr
+
+# pybind11-python support activation
+# this requires the cmake build installed within $(@D)
+ifeq ($(BR2_PACKAGE_PYBIND11_WITH_PYTHON),y)
+
+HOST_PYBIND11_DEPENDENCIES += host-python3
+
+HOST_PYBIND11_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=$(@D)/pybind11
+
+define PYBIND11_PYTHON_BUILD
+	cd $(@D) && $(HOST_DIR)/bin/python setup.py install

You really want to use the full cross-build environment here, like is done in a
python package. We also want to split the build and the install step. Look at jailhouse for an example.

Regards,
Arnout

Quoted 14 lines
package/pybind11/pybind11.mk new file +13 -0
+endef
+
+HOST_PYBIND11_POST_INSTALL_HOOKS += PYBIND11_PYTHON_BUILD
+
+else
+
+HOST_PYBIND11_CONF_OPTS += \
+	-DPYBIND_FINDPYTHON=OFF \
+	-DPYBIND11_NOPYTHON=ON
+
+endif
+
+$(eval $(host-cmake-package))
#3 lore raw

PATCH 1/1 package/pybind11: new package

Arnout,

thank you for the patch review,
I am working on total different things but will soon get back to this topic

Quoted 1 line

I went back to that patch and commented on it. It indeed looks like a

better approach

Yes, it would allow any use case of "pybind" and would unlock the impossibility to upgrade at the moment

Quoted 1 line

It would be good to also add a patch that removes python-pybind then. For

that

Quoted 1 line

patch, don't forget to add a conversion in Config.in.legacy.

I never had to do that, I'll try my best.
Which version of BR should I mention in "removed in xxx"?
I assume the next release, so that means I should push my patch to ->next??

Quoted 1 line

you got feedback to not use cmake. That was clearly a mistake :-)

Wrong or right, either way the problem is the current philosophy has this package completely stuck

Quoted 1 line

I don't get it... This is supposed to replace python-pybind, which is a

target

Quoted 3 lines

package. How is that ever going to work?
Host packages should be called BR2_PACKAGE_HOST_PYBIND11. But I think you actually meant to have a target package...

that's correct

I will take all your reviews into account

Quoted 1 line

I hear what you're saying. We're really struggling to improve the

situation,

Quoted 1 line

but with the huge backlog of patches we have, we're barely keeping afloat

with

Quoted 1 line

just the easy security updates and build fixes. There are not many

"difficult"

Quoted 1 line

patches that get our time (it took me more than an hour to review the

pybind11

Quoted 1 line

patch).

I can only imagine the amount of work you guys are facing. Sorry for my late reply but I don't forget you guys and this topic, i'm focused on so many things, I need to be 100% on a topic, especially when I need to take lots of info/reviews into account

I keep you updated and will submit a review of this patch soon

Guillaume W. Bres
Software engineer
<[email protected]>

Le sam. 1 mai 2021 ? 17:43, Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 244 lines

Hi Guillaume,

Quoted 5 lines · guillaume.bressaix at gmail.com

From: "Guillaume W. Bres" <[email protected]>

Pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.

It helps a lot if you add Fixes: lines with the autobuilder failures.
Since we
have a backlog of 400+ patches, new packages get ignored pretty easily.

Quoted 7 lines

---

Warning!!: this new package and its internal BR2_PACKAGE_PYBIND11_WITH_PYTHON option
intends to replace package/python-pybind which is totally broken since upgrade to v2.6.1 in ->next.

It would be good to also add a patch that removes python-pybind then. For
that
patch, don't forget to add a conversion in Config.in.legacy.

Quoted 6 lines

The python build now requires a previous cmake build:
+ python-pybind only is not possible and will not build by itself

+ python setup.py requires cmake to install

I see that on the first version of this package, you got feedback to not
use
cmake. That was clearly a mistake :-)

Quoted 3 lines
      within $(@D) a couple files (in $(@D)/pybind11 exactly)
      to properly work. See my message in BR digest 17/02:
      <CAJe0E3eQxAZHAe2DN4Qp9k_0czYGsR639+=

bSUaEdyaKm0Keuw at mail.gmail.com>

Quoted 7 lines

cc to Thomas, Gwen & Peter, entitled:
"Python-pybind we need to discuss this package"

=> If this package is merged, package/python-pybind is deprecated

=> package/python-pybind v2.6.1+ in ->next must be removed, python-build by itself cannot work anymore

I guess we can keep it in 2021.02 right? It still builds there?

Quoted 2 lines

Pybind11 is a host only package

I don't get it... This is supposed to replace python-pybind, which is a
target
package. How is that ever going to work?

DEVELOPERS N: Guillaume William Brs <

Quoted 17 lines
---
 DEVELOPERS                     |  1 +
 package/pybind11/Config.in     | 25 ++++++++++++++++++++
 package/pybind11/pybind11.hash |  3 +++
 package/pybind11/pybind11.mk   | 42 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 package/pybind11/Config.in
 create mode 100644 package/pybind11/pybind11.hash
 create mode 100644 package/pybind11/pybind11.mk
DEVELOPERS +0 -0
index b019fe04d5..98e8b329ed 100644
@@ -1057,6 +1057,7 @@ N:      Guillaume William Brs <

guillaume.bressaix at gmail.com>

Quoted 13 lines
DEVELOPERS +1 -0
 F:   package/libnids/
 F:   package/liquid-dsp/
 F:   package/pixiewps/
+F:   package/pybind11/
 F:   package/python-pybind/
 F:   package/reaver/
 
package/pybind11/Config.in new file +0 -0
new file mode 100644
index 0000000000..883bf8cc09

package/pybind11/Config.in line 4

Quoted 4 lines
package/pybind11/Config.in new file +4 -0
@@ -0,0 +1,25 @@
+comment "pybind11 needs a toolchain w/ C++, wchar"
+     depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+config BR2_PACKAGE_PYBIND11

Host packages should be called BR2_PACKAGE_HOST_PYBIND11. But I think you
actually meant to have a target package... Anyway for a host package we normally
don't even want a Config.in symbol, and it should only exist if it is a dependency of some other package. We only want Config.in symbols for host packages that you might want to use in a post-build script (like genimage).

But again, I think you actually meant to have a target package.

package/pybind11/Config.in line 6

Quoted 2 lines
package/pybind11/Config.in new file +2 -0
+     bool "pybind11"
+     depends on BR2_INSTALL_LIBSTDCPP # boost

The # boost comment is not needed, since this package is a C++ package
itself.

package/pybind11/Config.in line 9

Quoted 3 lines
package/pybind11/Config.in new file +3 -0
+     depends on BR2_USE_WCHAR # boost
+     depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-thread
+     select BR2_PACKAGE_BOOST

The README pretty explicitly says that the goal of the project is to
avoid a
dependency on Boost. Are you sure this dependency is needed?

On the other hand, the package is intended to create python-C++ bindings,
so I
think there should be a dependency on python.

The README also says that it depends on C++11 features, so you'll need

        depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11

(+ comment)

Quoted 4 lines
package/pybind11/Config.in new file +4 -0
+     help
+       Pybind11 is a lightweight header-only library that exposes C++
+       types in Python and vice versa, mainly to create Python
+       bindings of existing C++ code.

package/pybind11/Config.in line 23

Quoted 10 lines
package/pybind11/Config.in new file +10 -0
+
+       http://pybind11.readthedocs.org/en/master
+
+if BR2_PACKAGE_PYBIND11
+
+config BR2_PACKAGE_PYBIND11_WITH_PYTHON
+     bool "pybind11-python"
+     depends on BR2_PACKAGE_PYTHON3
+     help
+       Activate support for python-pybind

I suppose the idea is to choose between "expose python objects in C++" and
"expose C++ objects in python". The help text doesn't really tell me which of
the two this option enables... Can you clarify that? I think the main package
help text should explain that only the headers are installed unless _WITH_PYTHON
is enabled.

Review

Quoted 3 lines
package/pybind11/Config.in new file +2 -0
+
+endif
(quoted diff) +0 -0

b/package/pybind11/pybind11.hash

package/pybind11/pybind11.hash line 2

Quoted 7 lines

new file mode 100644
index 0000000000..e703519a22

package/pybind11/pybind11.hash new file +2 -0
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256

8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2 pybind11-2.6.2.tar.gz

package/pybind11/pybind11.hash line 3

Quoted 1 line
package/pybind11/pybind11.hash new file +1 -0
+sha256

83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb LICENSE

package/pybind11/pybind11.mk

Quoted 7 lines
package/pybind11/pybind11.mk new file +0 -0
new file mode 100644
index 0000000000..c8d69e1dd4
@@ -0,0 +1,42 @@

+################################################################################

package/pybind11/pybind11.mk line 4

Quoted 4 lines
package/pybind11/pybind11.mk new file +3 -0
+#
+# pybind11
+#

+################################################################################

package/pybind11/pybind11.mk line 12

Quoted 7 lines
package/pybind11/pybind11.mk new file +7 -0
+
+PYBIND11_VERSION = 2.6.2
+PYBIND11_SITE = $(call github,pybind,pybind11,v$(PYBIND11_VERSION))
+PYBIND11_LICENSE = BSD-3-Clause
+PYBIND11_LICENSE_FILES = LICENSE
+PYBIND11_INSTALL_STAGING = YES
+PYBIND11_SUPPORTS_IN_SOURCE_BUILD = YES

This is the default, it only needs to be set to NO for packages that don't
support in-source build.

package/pybind11/pybind11.mk line 16

Quoted 4 lines
package/pybind11/pybind11.mk new file +4 -0
+
+HOST_PYBIND11_CONF_OPTS = \
+     -DBUILD_DOCS=OFF \
+     -DDOWNLOAD_EIGEN=OFF \

This sounds like there should also be a (perhaps optional) dependency on
eigen?
Ah, no, it's only used for tests - better mention that in the commit message.

package/pybind11/pybind11.mk line 17

Quoted 1 line
package/pybind11/pybind11.mk new file +1 -0
+     -DPYTHON=$(TARGET_DIR)/usr/bin/python \

This means you *definitely* need a dependency on python. However, I think
it is
only needed if we actually create the python bindings, i.e. if BR2_PACKAGE_PYBIND11_WITH_PYTHON is turned on.

However, I don't see this used anywhere in the cmake code. I *do* see
PYTHON_EXECUTABLE - isn't that what you meant? Hm, no, that can't be, because it
is used to actually execute some python code, so it shouldn't point to the target python. In fact, it never makes sense to point to the target python
- if
it is actually used for something on the target, the $(TARGET_DIR) part should
not be there at all...

Also, this should probably be python3 and not plain python.

package/pybind11/pybind11.mk line 29

Quoted 12 lines
package/pybind11/pybind11.mk new file +12 -0
+     -DPYTHON_PREFIX=$(STAGING_DIR)/usr
+
+# pybind11-python support activation
+# this requires the cmake build installed within $(@D)
+ifeq ($(BR2_PACKAGE_PYBIND11_WITH_PYTHON),y)
+
+HOST_PYBIND11_DEPENDENCIES += host-python3
+
+HOST_PYBIND11_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=$(@D)/pybind11
+
+define PYBIND11_PYTHON_BUILD
+     cd $(@D) && $(HOST_DIR)/bin/python setup.py install

You really want to use the full cross-build environment here, like is
done in a
python package. We also want to split the build and the install step. Look at
jailhouse for an example.

Regards,
Arnout

Quoted 15 lines
Quoted 4 lines
package/pybind11/pybind11.mk new file +3 -0
+endef
+
+HOST_PYBIND11_POST_INSTALL_HOOKS += PYBIND11_PYTHON_BUILD

package/pybind11/pybind11.mk line 42

Quoted 10 lines
package/pybind11/pybind11.mk new file +10 -0
+
+else
+
+HOST_PYBIND11_CONF_OPTS += \
+     -DPYBIND_FINDPYTHON=OFF \
+     -DPYBIND11_NOPYTHON=ON
+
+endif
+
+$(eval $(host-cmake-package))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210509/26811cb2/attachment.html>

#4 lore raw

PATCH 1/1 package/pybind11: new package

Quoted 11 lines · Guillaume Bres

Arnout,

thank you for the patch review,
I am working on total different things but will soon get back to this topic

Quoted 1 line

I went back to that patch and commented on it. It indeed looks like a better

approach?

Yes, it would allow any use case of "pybind" and would unlock the?impossibility?to upgrade at the moment

Quoted 6 lines
Quoted 2 lines

It would be good to also add a patch that removes python-pybind then. For that patch, don't forget to add a conversion in Config.in.legacy.

I never had to do that, I'll try my best.
Which version of BR should I mention in "removed in xxx"??
I assume the next release, so that means I should push my patch to ->next??

Yes, please prepare your patch for the next branch. There should be a

comment "Legacy options removed in 2021.08"

added. But don't worry too much about it, we'll fix that while applying if needed.

Regards,
Arnout

[snip]