Skip to contentSkip to conversation

package/python: fix building _hashlib of host-python

PATCH New Diankun Zhang 2 participants 11 messages Jul 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

?
The python buildin module _hashlib has dependency on library libcrypto.so to provide the SHA-224, SHA-256, SHA-384, SHA-512 hash algorithms in addition to platform optimized versions of MD5 and SHA1. Adding host package dependency on host-openssl to support the building of _hashlib module for host-python.

---
 package/python/python.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/python/python.mk +1 -1
index cf1ddfb..248393c 100644
@@ -56,7 +56,7 @@ HOST_PYTHON_MAKE = $(MAKE1)
 
 PYTHON_DEPENDENCIES = host-python libffi $(TARGET_NLS_DEPENDENCIES)
 
-HOST_PYTHON_DEPENDENCIES = host-expat host-zlib
+HOST_PYTHON_DEPENDENCIES = host-expat host-zlib host-openssl
 
 PYTHON_INSTALL_STAGING = YES
 
Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/990c22a6/attachment.html>
#1 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello,

Quoted 7 lines · Diankun Zhang

The python buildin module _hashlib has dependency on library libcrypto.so to provide the SHA-224, SHA-256, SHA-384, SHA-512 hash algorithms in addition to platform optimized versions of MD5 and SHA1. Adding host package dependency on host-openssl to support the building of _hashlib module for host-python.

Why do you need the _hashlib module in the host-python ?

Indeed, we try to avoid adding too many dependencies, and adding a new dependency to host-python is going to increase the build time to a large number of people who don't necessarily need the _hashlib module in the host Python interpreter.

So could you explain why this is needed ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello Thomas,

According to HOST_PYTHON_CONF_OPTS defined in python.mk, --disable-hashlib is not specified.
That means _hashlib should be enabled by default, right?

Quoted 29 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Diankun Zhang

The python buildin module _hashlib has dependency on library libcrypto.so to provide the SHA-224, SHA-256, SHA-384, SHA-512 hash algorithms in addition to platform optimized versions of MD5 and SHA1. Adding host package dependency on host-openssl to support the building of _hashlib module for host-python.

Why do you need the _hashlib module in the host-python ?

Indeed, we try to avoid adding too many dependencies, and adding a new dependency to host-python is going to increase the build time to a large number of people who don't necessarily need the _hashlib module in the host Python interpreter.

So could you explain why this is needed ?

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/5934de83/attachment.html>
#3 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello,

Quoted 3 lines · Diankun Zhang

According to HOST_PYTHON_CONF_OPTS defined in python.mk, --disable-hashlib is not specified.
That means _hashlib should be enabled by default, right?

Well, no, not necessarily. We simply forgot to add --disable-hashlib.

Again: why do you need this? If you could answer this question it would make the discussion a lot more productive :-)

It is very possible that there are legitimate use cases for having the hashlib module built in the host Python interpreter. If we understand those use cases, then we can come up with a solution. But if you keep being silent about the *why* you need this, we won't move very far.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello Thomas,

I'm cross-compiling host-python on my x86_64 box on which ubuntu 16.04 installed.
libssl is installed whereas openssl is not installed on my box. When cross-compiling
host-python, I found _hashlib.so is not compiled whereas _md5.so, _sha256.so, _sha512.so
and _md5.so are compiled. I think -disable-hashlib will not decrease the build time and
the size of the host-python artifacts.

As for the hash lib use case, i am integrating a third-party python tool pyang
(https://github.com/mbj4668/pyang) into our project. The pyang tool will take advantage of python
_hashlib module.

Quoted 28 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Diankun Zhang

According to HOST_PYTHON_CONF_OPTS defined in python.mk,

--disable-hashlib

Quoted 2 lines

is not specified.
That means _hashlib should be enabled by default, right?

Well, no, not necessarily. We simply forgot to add --disable-hashlib.

Again: why do you need this? If you could answer this question it would make the discussion a lot more productive :-)

It is very possible that there are legitimate use cases for having the hashlib module built in the host Python interpreter. If we understand those use cases, then we can come up with a solution. But if you keep being silent about the *why* you need this, we won't move very far.

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/eef0bd84/attachment.html>
#5 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello,

Quoted 1 line · Diankun Zhang

I'm cross-compiling host-python on my x86_64 box on which ubuntu 16.04

You are not cross-compiling host-python. host-python is a host package, so it is natively compiled.

Quoted 2 lines

installed.
libssl is installed whereas openssl is not installed on my box. When

In Ubuntu 16.04, the package is named libssl, but it's actually OpenSSL, see https://packages.ubuntu.com/xenial/libssl1.0.0. Its source package is "openssl".

Quoted 6 lines

cross-compiling
host-python, I found _hashlib.so is not compiled whereas _md5.so, _sha256.so, _sha512.so
and _md5.so are compiled. I think -disable-hashlib will not decrease the build time and
the size of the host-python artifacts.

--disable-hashlib will make sure that our host-python build is more reproducible. Instead of having _hashlib built when libssl-dev is installed on the host machine, and _hashlib not built otherwise, it will consistently not build _hashlib, which is what we want.

Quoted 5 lines

As for the hash lib use case, i am integrating a third-party python tool pyang
(https://github.com/mbj4668/pyang) into our project. The pyang tool will take advantage of python
_hashlib module.

It pyang meant to be run on the host or on the target ? From a quick look, it seems like something that runs on the host indeed. If that's the case, then we will really need to start adding hidden options for host packages, so that other host packages can request hashlib support from host-python, without forcing everyone to build this.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello Thomas,

From https://packages.ubuntu.com/xenial/amd64/openssl/filelist, we can see the openssl package on ubuntu 16.04 does not cotain the libssl or licrypto.so,
instead they are in package libssl1.0.0,
https://packages.ubuntu.com/xenial/amd64/libssl1.0.0/filelist.

In most of systems nowadays, openssl (and libssl ) is installed since the hash algorithms
are needed to meet kinds of requirements.

Yes, I'm using the pyang tool on my host to compile some YANG files. The compiled YANG
files are platform independent ideally.

Quoted 48 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Diankun Zhang

I'm cross-compiling host-python on my x86_64 box on which ubuntu 16.04

You are not cross-compiling host-python. host-python is a host package, so it is natively compiled.

Quoted 2 lines

installed.
libssl is installed whereas openssl is not installed on my box. When

In Ubuntu 16.04, the package is named libssl, but it's actually OpenSSL, see https://packages.ubuntu.com/xenial/libssl1.0.0. Its source package is "openssl".

Quoted 6 lines

cross-compiling
host-python, I found _hashlib.so is not compiled whereas _md5.so, _sha256.so, _sha512.so
and _md5.so are compiled. I think -disable-hashlib will not decrease the build time and
the size of the host-python artifacts.

--disable-hashlib will make sure that our host-python build is more reproducible. Instead of having _hashlib built when libssl-dev is installed on the host machine, and _hashlib not built otherwise, it will consistently not build _hashlib, which is what we want.

Quoted 5 lines

As for the hash lib use case, i am integrating a third-party python tool pyang
(https://github.com/mbj4668/pyang) into our project. The pyang tool will take advantage of python
_hashlib module.

It pyang meant to be run on the host or on the target ? From a quick look, it seems like something that runs on the host indeed. If that's the case, then we will really need to start adding hidden options for host packages, so that other host packages can request hashlib support from host-python, without forcing everyone to build this.

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/7d436c9b/attachment.html>
#7 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello,

Quoted 5 lines · Diankun Zhang

From https://packages.ubuntu.com/xenial/amd64/openssl/filelist, we can see the openssl package on ubuntu 16.04 does not cotain the libssl or licrypto.so,
instead they are in package libssl1.0.0,
https://packages.ubuntu.com/xenial/amd64/libssl1.0.0/filelist.

libssl is a *binary* package that is produced from the source package openssl.

Quoted 2 lines

In most of systems nowadays, openssl (and libssl ) is installed since the hash algorithms are needed to meet kinds of requirements.

Yes, the libraries, but not necessarily the development files.

Quoted 2 lines

Yes, I'm using the pyang tool on my host to compile some YANG files. The compiled YANG files are platform independent ideally.

OK.

So, again what is needed is a hidden BR2_PACKAGE_HOST_PYTHON_OPENSSL that enables OpenSSL support in host-python, which the pyang package could select.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Thanks, Thomas, I would send out a new patch as you suggested.

Quoted 36 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Diankun Zhang

From https://packages.ubuntu.com/xenial/amd64/openssl/filelist, we can

see

Quoted 4 lines

the openssl package on ubuntu 16.04 does not cotain the libssl or licrypto.so,
instead they are in package libssl1.0.0,
https://packages.ubuntu.com/xenial/amd64/libssl1.0.0/filelist.

libssl is a *binary* package that is produced from the source package openssl.

Quoted 2 lines

In most of systems nowadays, openssl (and libssl ) is installed since the hash algorithms are needed to meet kinds of requirements.

Yes, the libraries, but not necessarily the development files.

Quoted 2 lines

Yes, I'm using the pyang tool on my host to compile some YANG files. The compiled YANG files are platform independent ideally.

OK.

So, again what is needed is a hidden BR2_PACKAGE_HOST_PYTHON_OPENSSL that enables OpenSSL support in host-python, which the pyang package could select.

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/34cb0ecf/attachment.html>
#9 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Hello,

Quoted 1 line · Diankun Zhang

Thanks, Thomas, I would send out a new patch as you suggested.

But are you going to submit the patch that adds a package for pyang as well ? Without the pyang addition, it doesn't make a lot of sense to add support for building host-python with host-openssl.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#10 lore raw

PATCH 1/1 package/python: fix building _hashlib of host-python

Thomas, will it be much better if I add hashlib package (
https://pypi.python.org/pypi/hashlib/20081119)
into buildroot?

Quoted 18 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Diankun Zhang

Thanks, Thomas, I would send out a new patch as you suggested.

But are you going to submit the patch that adds a package for pyang as well ? Without the pyang addition, it doesn't make a lot of sense to add support for building host-python with host-openssl.

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Signature · 4 lines
-Diankun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170720/d9a49102/attachment.html>