[yocto] musl and /lib{32,64} directories

Martin Dickopp mdickopp at phoenixcontact.com
Mon Feb 5 07:55:12 PST 2018


Hello,

I'm new to Yocto, so please bear with me if I'm missing something
obvious.

When I build Poky (current master) with a vendor-provided BSP layer for
an ARM64 board and musl as the C library, shared libraries are installed
in /lib64 (and /usr/lib64), where the musl dynamic runtime linker does
not find them.

I noticed that there is a patch for GLIBC that causes /lib, /lib32,
/lib64, and the corresponding directories under /usr to be searched [1],
but there is no such patch for musl. If I patch musl myself [2], all
shared libraries are found. However, I'm not sure if this is the correct
fix.

Is it intentional that GLIBC and musl behave differently in this regard,
or is this something that has simply not (yet) been implemented? Are
there any reasons why patching musl in this way is a bad idea?

Best regards,
Martin


[1] meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch

[2]
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 4b4841f9..12ccb2a6 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1008,7 +1008,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
 					sys_path = "";
 				}
 			}
-			if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
+			if (!sys_path) sys_path = "/lib:/usr/lib:/lib32:/usr/lib32:/lib64:/usr/lib64";
 			fd = path_open(name, sys_path, buf, sizeof buf);
 		}
 		pathname = buf;



More information about the yocto mailing list