Skip to contentSkip to conversation

Drop ldconfig handling

PATCH Superseded Thomas Petazzoni 3 participants 3 messages Dec 29, 2015 – Dec 30, 2015 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drop ldconfig handling

The ldconfig handling in the main Makefile is utterly broken, as it calls the build machine ldconfig to generate the ld.so.cache of the target. Unfortunately, the format of the ld.so.cache is architecture specific, and therefore the build machine ldconfig cannot be used as-is.

This patch therefore simply drops using ldconfig entirely, and removes /etc/ld.so.conf.d/ from the target skeleton. The idea is that all libraries that should be loaded by the dynamic linker must be installed in paths where the dynamic linker searches them by default (typically /lib or /usr/lib).

This might potentially break a few packages, but the only way to know is to actually stop handling ldconfig. In order to be notified of such cases, we add a check in target-finalize to verify that there is no /etc/ld.so.conf file in the target.

---
 Makefile                                | 14 ++------------
 system/skeleton/etc/ld.so.conf.d/.empty |  0
 2 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 system/skeleton/etc/ld.so.conf.d/.empty
Makefile +2 -12
index 1d69192..a15013e 100644
@@ -598,18 +598,8 @@ endif
 		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 
 	mkdir -p $(TARGET_DIR)/etc
-	# Mandatory configuration file and auxiliary cache directory
-	# for recent versions of ldconfig
-	touch $(TARGET_DIR)/etc/ld.so.conf
-	mkdir -p $(TARGET_DIR)/var/cache/ldconfig
-	if [ -x "$(TARGET_CROSS)ldconfig" ]; \
-	then \
-		$(TARGET_CROSS)ldconfig -r $(TARGET_DIR) \
-					-f $(TARGET_DIR)/etc/ld.so.conf; \
-	else \
-		/sbin/ldconfig -r $(TARGET_DIR) \
-			       -f $(TARGET_DIR)/etc/ld.so.conf; \
-	fi
+	test -f $(TARGET_DIR)/etc/ld.so.conf && \
+		{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
 	( \
 		echo "NAME=Buildroot"; \
 		echo "VERSION=$(BR2_VERSION_FULL)"; \
system/skeleton/etc/ld.so.conf.d/.empty deleted +0 -0
deleted file mode 100644
index e69de29..0000000
Signature · 1 line
2.6.4
#1 lore raw

PATCH 1/1 Drop ldconfig handling

Thomas, All,

On 2015-12-29 21:27 +0100, Thomas Petazzoni spake thusly:

Quoted 36 lines

The ldconfig handling in the main Makefile is utterly broken, as it calls the build machine ldconfig to generate the ld.so.cache of the target. Unfortunately, the format of the ld.so.cache is architecture specific, and therefore the build machine ldconfig cannot be used as-is.

This patch therefore simply drops using ldconfig entirely, and removes /etc/ld.so.conf.d/ from the target skeleton. The idea is that all libraries that should be loaded by the dynamic linker must be installed in paths where the dynamic linker searches them by default (typically /lib or /usr/lib).

This might potentially break a few packages, but the only way to know is to actually stop handling ldconfig. In order to be notified of such cases, we add a check in target-finalize to verify that there is no /etc/ld.so.conf file in the target.

---
 Makefile                                | 14 ++------------
 system/skeleton/etc/ld.so.conf.d/.empty |  0
 2 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 system/skeleton/etc/ld.so.conf.d/.empty
Makefile +0 -4
index 1d69192..a15013e 100644
@@ -598,18 +598,8 @@ endif
 		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 
 	mkdir -p $(TARGET_DIR)/etc
-	# Mandatory configuration file and auxiliary cache directory
-	# for recent versions of ldconfig
-	touch $(TARGET_DIR)/etc/ld.so.conf
-	mkdir -p $(TARGET_DIR)/var/cache/ldconfig

Makefile endif · line 602

Quoted 10 lines
Makefile +2 -8
-	if [ -x "$(TARGET_CROSS)ldconfig" ]; \
-	then \
-		$(TARGET_CROSS)ldconfig -r $(TARGET_DIR) \
-					-f $(TARGET_DIR)/etc/ld.so.conf; \
-	else \
-		/sbin/ldconfig -r $(TARGET_DIR) \
-			       -f $(TARGET_DIR)/etc/ld.so.conf; \
-	fi
+	test -f $(TARGET_DIR)/etc/ld.so.conf && \
+		{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true

We could also add (in case a package installs something in there):

    test -d $(TARGET_DIR)/etc/ld.so.conf.d && \
        { echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true

Otherwise:

Regards,
Yann E. MORIN.

Quoted 13 lines
Makefile +0 -0
 	( \
 		echo "NAME=Buildroot"; \
 		echo "VERSION=$(BR2_VERSION_FULL)"; \
system/skeleton/etc/ld.so.conf.d/.empty deleted +0 -0
deleted file mode 100644
index e69de29..0000000
Signature · 6 lines
2.6.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 Drop ldconfig handling

Quoted 52 lines · Yann E. MORIN

Thomas, All,

On 2015-12-29 21:27 +0100, Thomas Petazzoni spake thusly:

Quoted 36 lines

The ldconfig handling in the main Makefile is utterly broken, as it calls the build machine ldconfig to generate the ld.so.cache of the target. Unfortunately, the format of the ld.so.cache is architecture specific, and therefore the build machine ldconfig cannot be used as-is.

This patch therefore simply drops using ldconfig entirely, and removes /etc/ld.so.conf.d/ from the target skeleton. The idea is that all libraries that should be loaded by the dynamic linker must be installed in paths where the dynamic linker searches them by default (typically /lib or /usr/lib).

This might potentially break a few packages, but the only way to know is to actually stop handling ldconfig. In order to be notified of such cases, we add a check in target-finalize to verify that there is no /etc/ld.so.conf file in the target.

---
 Makefile                                | 14 ++------------
 system/skeleton/etc/ld.so.conf.d/.empty |  0
 2 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 system/skeleton/etc/ld.so.conf.d/.empty
Makefile +0 -4
index 1d69192..a15013e 100644
@@ -598,18 +598,8 @@ endif
 		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 
 	mkdir -p $(TARGET_DIR)/etc
-	# Mandatory configuration file and auxiliary cache directory
-	# for recent versions of ldconfig
-	touch $(TARGET_DIR)/etc/ld.so.conf
-	mkdir -p $(TARGET_DIR)/var/cache/ldconfig

Makefile endif · line 602

Quoted 10 lines
Makefile +2 -8
-	if [ -x "$(TARGET_CROSS)ldconfig" ]; \
-	then \
-		$(TARGET_CROSS)ldconfig -r $(TARGET_DIR) \
-					-f $(TARGET_DIR)/etc/ld.so.conf; \
-	else \
-		/sbin/ldconfig -r $(TARGET_DIR) \
-			       -f $(TARGET_DIR)/etc/ld.so.conf; \
-	fi
+	test -f $(TARGET_DIR)/etc/ld.so.conf && \
+		{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true

We could also add (in case a package installs something in there):

Quoted 2 lines
    test -d $(TARGET_DIR)/etc/ld.so.conf.d && \
        { echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true

And it probably should be done after the overlay and post-build scripts, since
these may (and are likely to) add it.

Regards,
Arnout

Quoted 22 lines

Otherwise:

Regards,
Yann E. MORIN.

Quoted 13 lines
Makefile +0 -0
 	( \
 		echo "NAME=Buildroot"; \
 		echo "VERSION=$(BR2_VERSION_FULL)"; \
system/skeleton/etc/ld.so.conf.d/.empty deleted +0 -0
deleted file mode 100644
index e69de29..0000000
Signature · 6 lines
2.6.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF