Skip to contentSkip to conversation

HOST_DIR/lib: symlink respectively to lib32/64

PATCH Superseded Matt Weber 2 participants 3 messages Oct 3, 2017 – Oct 4, 2017 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH v2 1/1 HOST_DIR/lib: symlink respectively to lib32/64

Discovered the issue on a RHEL7.4 machine where the cmake build dynamically selected HOST_DIR/lib64 as the installation path for the lzo2 library.

Fixes failures like the following:
host-mtd
http://autobuild.buildroot.net/results/d31/d31581d2e60f35cf70312683df99c768e2ea8516/

host-squashfs
http://autobuild.buildroot.net/results/d9c/d9c95231ac774ed71580754a15ebb3b121764310/

---
Changes
[Yann
v1 -> v2
- Correct the condition used to determine host arch. (Previously used the target arch check)

---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Makefile +8 -1
index 9b09589..1cc474a 100644
@@ -542,7 +542,7 @@ endif
 
 .PHONY: dirs
 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
-	$(HOST_DIR) $(HOST_DIR)/usr $(BINARIES_DIR)
+	$(HOST_DIR) $(HOST_DIR)/usr $(HOST_DIR)/lib $(BINARIES_DIR)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
 	$(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
@@ -565,6 +565,13 @@ sdk: world
 $(HOST_DIR)/usr: $(HOST_DIR)
 	@ln -snf . $@
 
+$(HOST_DIR)/lib: $(HOST_DIR)
+ifeq ($(HOSTARCH),x86)
+	@ln -snf lib $@32
+else
+	@ln -snf lib $@64
+endif
+
 # Populating the staging with the base directories is handled by the skeleton package
 $(STAGING_DIR):
 	@mkdir -p $(STAGING_DIR)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 HOST_DIR/lib: symlink respectively to lib32/64

Matthew, All,

On 2017-10-03 15:58 -0500, Matt Weber spake thusly:

Quoted 36 lines

Discovered the issue on a RHEL7.4 machine where the cmake build dynamically selected HOST_DIR/lib64 as the installation path for the lzo2 library.

Fixes failures like the following:
host-mtd
http://autobuild.buildroot.net/results/d31/d31581d2e60f35cf70312683df99c768e2ea8516/

host-squashfs
http://autobuild.buildroot.net/results/d9c/d9c95231ac774ed71580754a15ebb3b121764310/

---
Changes
[Yann
v1 -> v2
- Correct the condition used to determine host arch. (Previously used the target arch check)

---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Makefile +1 -1
index 9b09589..1cc474a 100644
@@ -542,7 +542,7 @@ endif
 
 .PHONY: dirs
 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
-	$(HOST_DIR) $(HOST_DIR)/usr $(BINARIES_DIR)
+	$(HOST_DIR) $(HOST_DIR)/usr $(HOST_DIR)/lib $(BINARIES_DIR)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
 	$(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

Makefile sdk: world · line 573

Quoted 9 lines
Makefile +6 -0
@@ -565,6 +565,13 @@ sdk: world
 $(HOST_DIR)/usr: $(HOST_DIR)
 	@ln -snf . $@
 
+$(HOST_DIR)/lib: $(HOST_DIR)
+ifeq ($(HOSTARCH),x86)
+	@ln -snf lib $@32
+else
+	@ln -snf lib $@64
+endif

You will want to mkdir lib first. If you don't, you create a dangling symlink.

If lib32 (or lib64) s dangling, and if a package wants to install in there before another package has created lib, then the install will fail.

Typically, an install step would basically do something like:

    mkdir -p $(DESTDIR)$(PREFIX)/lib32/
    cp some-file $(DESTDIR)$(PREFIX)/lib32/some-file

However, the mkdir will fail there, with:

mkdir: cannot create directory ?/bla/bla/lib32?: File exists

Secondly, $(HOST_DIR)/lib is not a .PHONY rule, and since you do not explicitly create it in the rule, the rule will get executed every time make is called, until at last some host package creates lib.

So, forcibly create lib in that rule.

Regards,
Yann E. MORIN.

Quoted 10 lines
Makefile +0 -0
 # Populating the staging with the base directories is handled by the skeleton package
 $(STAGING_DIR):
 	@mkdir -p $(STAGING_DIR)
Signature · 6 lines
1.9.1

_______________________________________________
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 v2 1/1 HOST_DIR/lib: symlink respectively to lib32/64

Yann, Jan,

Quoted 63 lines · Yann E. MORIN

Matthew, All,

On 2017-10-03 15:58 -0500, Matt Weber spake thusly:

Quoted 36 lines

Discovered the issue on a RHEL7.4 machine where the cmake build dynamically selected HOST_DIR/lib64 as the installation path for the lzo2 library.

Fixes failures like the following:
host-mtd
http://autobuild.buildroot.net/results/d31/d31581d2e60f35cf70312683df99c768e2ea8516/

host-squashfs
http://autobuild.buildroot.net/results/d9c/d9c95231ac774ed71580754a15ebb3b121764310/

---
Changes
[Yann
v1 -> v2
- Correct the condition used to determine host arch. (Previously used the target arch check)

---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Makefile +1 -1
index 9b09589..1cc474a 100644
@@ -542,7 +542,7 @@ endif
 
 .PHONY: dirs
 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
-     $(HOST_DIR) $(HOST_DIR)/usr $(BINARIES_DIR)
+     $(HOST_DIR) $(HOST_DIR)/usr $(HOST_DIR)/lib $(BINARIES_DIR)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
      $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

Makefile sdk: world · line 573

Quoted 9 lines
Makefile +6 -0
@@ -565,6 +565,13 @@ sdk: world
 $(HOST_DIR)/usr: $(HOST_DIR)
      @ln -snf . $@
 
+$(HOST_DIR)/lib: $(HOST_DIR)
+ifeq ($(HOSTARCH),x86)
+     @ln -snf lib $@32
+else
+     @ln -snf lib $@64
+endif

You will want to mkdir lib first. If you don't, you create a dangling symlink.

If lib32 (or lib64) s dangling, and if a package wants to install in there before another package has created lib, then the install will fail.

Typically, an install step would basically do something like:

    mkdir -p $(DESTDIR)$(PREFIX)/lib32/
    cp some-file $(DESTDIR)$(PREFIX)/lib32/some-file

However, the mkdir will fail there, with:

Quoted 7 lines

mkdir: cannot create directory ?/bla/bla/lib32?: File exists

Secondly, $(HOST_DIR)/lib is not a .PHONY rule, and since you do not explicitly create it in the rule, the rule will get executed every time make is called, until at last some host package creates lib.

So, forcibly create lib in that rule.

v3 based on yesterday's discussion
https://patchwork.ozlabs.org/patch/821298/

Mat