Skip to contentSkip to conversation

python: fix to ensure libpython is stripped

PATCH New Przemyslaw Wrzos 3 participants 7 messages Jan 23, 2014 – Feb 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

---
 package/python/python.mk   | 9 +++++++++
 package/python3/python3.mk | 9 +++++++++
 2 files changed, 18 insertions(+)

NOTE: Resubmitting as part of patchwork cleanup #6.

package/python/python.mk +9 -0
index 6a6aaac..69662c3 100644
@@ -162,6 +162,15 @@ endef
 
 PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#
+define PYTHON_ENSURE_LIBPYTHON_STRIPPED
+	chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR)*.so
+endef
+
+PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON_AUTORECONF = YES
 
 $(eval $(autotools-package))
package/python3/python3.mk +9 -0
index b5e9689..6cbe772 100644
@@ -149,6 +149,15 @@ endef
 
 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#
+define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+	chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
+endef
+
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON3_AUTORECONF = YES
 
 define PYTHON3_INSTALL_SYMLINK
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

Quoted 42 lines · Przemyslaw Wrzos

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

---
 package/python/python.mk   | 9 +++++++++
 package/python3/python3.mk | 9 +++++++++
 2 files changed, 18 insertions(+)

NOTE: Resubmitting as part of patchwork cleanup #6.

package/python/python.mk +9 -0
index 6a6aaac..69662c3 100644
@@ -162,6 +162,15 @@ endef
 
 PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#
+define PYTHON_ENSURE_LIBPYTHON_STRIPPED
+       chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR)*.so
+endef
+
+PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON_AUTORECONF = YES
 
 $(eval $(autotools-package))
package/python3/python3.mk +3 -0
index b5e9689..6cbe772 100644
@@ -149,6 +149,15 @@ endef
 
 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#

package/python3/python3.mk endef

Quoted 10 lines
package/python3/python3.mk +6 -1
+define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+       chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
+endef
+
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON3_AUTORECONF = YES
 
 define PYTHON3_INSTALL_SYMLINK
--

(tested with python2 only)

Note: the library will remain writable, but this doesn't look like a big problem to me...

By the way: nice find! Saves about 4MB on Python 2!

#2 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

Hello Thomas,

Quoted 13 lines · Thomas De Schampheleire
Quoted 5 lines · Przemyslaw Wrzos

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

---

Acked-by: Thomas De Schampheleire <[email protected]> Tested-by: Thomas De Schampheleire <[email protected]> (tested with python2 only)

Quoted 4 lines

Note: the library will remain writable, but this doesn't look like a big problem to me...

By the way: nice find! Saves about 4MB on Python 2!

Yep, that's the only caveat without stuffing some horrible hack into buildroot elsewhere to get around it. I couldn't think of a downside though, and I've been running this on my embedded systems for a year now without issue.

Cheers,
Przemyslaw Wrzos

#3 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

In reply to Thomas De Schampheleire
Quoted 57 lines · Thomas De Schampheleire
Quoted 42 lines · Przemyslaw Wrzos

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

---
 package/python/python.mk   | 9 +++++++++
 package/python3/python3.mk | 9 +++++++++
 2 files changed, 18 insertions(+)

NOTE: Resubmitting as part of patchwork cleanup #6.

package/python/python.mk +9 -0
index 6a6aaac..69662c3 100644
@@ -162,6 +162,15 @@ endef
 
 PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#
+define PYTHON_ENSURE_LIBPYTHON_STRIPPED
+       chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR)*.so
+endef
+
+PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON_AUTORECONF = YES
 
 $(eval $(autotools-package))
package/python3/python3.mk +3 -0
index b5e9689..6cbe772 100644
@@ -149,6 +149,15 @@ endef
 
 PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
 
+#
+# Make sure libpython gets stripped out on target
+#

package/python3/python3.mk endef

Quoted 10 lines
package/python3/python3.mk +6 -1
+define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+       chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
+endef
+
+PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
+
 PYTHON3_AUTORECONF = YES
 
 define PYTHON3_INSTALL_SYMLINK
--
Quoted 6 lines

(tested with python2 only)

Note: the library will remain writable, but this doesn't look like a big problem to me...

By the way: nice find! Saves about 4MB on Python 2!

ping on this patch?

#4 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

In reply to Przemyslaw Wrzos

Dear Przemyslaw Wrzos,

Quoted 10 lines · Przemyslaw Wrzos

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

---
 package/python/python.mk   | 9 +++++++++
 package/python3/python3.mk | 9 +++++++++
 2 files changed, 18 insertions(+)

NOTE: Resubmitting as part of patchwork cleanup #6.

I have integrated this patch into the large set of Python patches I've posted at
http://lists.busybox.net/pipermail/buildroot/2014-February/089309.html.

However, I agree with Thomas De Schampheleire that this specific patch should be merged for 2014.02, as it fixes a real problem, and gives a nice size reduction.

Thomas

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

PATCH 1/1 python: fix to ensure libpython is stripped

Hello Thomas,

Quoted 12 lines · Thomas Petazzoni

Dear Przemyslaw Wrzos,

Quoted 4 lines · Przemyslaw Wrzos

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

I have integrated this patch into the large set of Python patches I've posted at
http://lists.busybox.net/pipermail/buildroot/2014-February/089309.html.

Quoted 5 lines

However, I agree with Thomas De Schampheleire that this specific patch should be merged for 2014.02, as it fixes a real problem, and gives a nice size reduction.

Thomas

That makes sense. I assume you don't need anything from me at this point.

Cheers,
Przemyslaw Wrzos

#6 lore raw

PATCH 1/1 python: fix to ensure libpython is stripped

Dear Przemyslaw Wrzos,

Quoted 10 lines · Przemyslaw Wrzos
Quoted 10 lines · Przemyslaw Wrzos
Quoted 4 lines

The python and python3 builds mark libpython as read-only which prevents it from being stripped out correctly for the target.

I have integrated this patch into the large set of Python patches I've posted at
http://lists.busybox.net/pipermail/buildroot/2014-February/089309.html.

Quoted 7 lines
Quoted 5 lines

However, I agree with Thomas De Schampheleire that this specific patch should be merged for 2014.02, as it fixes a real problem, and gives a nice size reduction.

Thomas

That makes sense. I assume you don't need anything from me at this point.

Nope, at this point your patch is in the queue, it should be handled at some point :-)

Thanks!

Thomas

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