Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/qemu: force the host compiler to look at HOST_DIR first
@ 2023-08-18 23:46 Romain Naour
  2023-08-19 13:54 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2023-08-18 23:46 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Nicolas CARRIER

Since meson 1.2.0, compiler's search path are retrieved and used
to link a library. If the same library is installed on the host
and build by Buildroot (HOST_DIR/lib), meson now link against
the one found in the compiler's search path instead of linking
agains the one provided by Buildroot.

See: https://github.com/mesonbuild/meson/issues/11914#issuecomment-1678090566

Help the compiler by setting -Bprefix that specifies a path where to find the
executables, libraries, include files, and data files of the compiler itself.
For each subprogram to be run, the compiler driver first tries the -B prefix,
if any. If that name is not found, or if -B is not specified, the driver
tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/.

Fixes:
    host/lib/libgio-2.0.so: undefined reference to `g_module_open_full'
    collect2: error: ld returned 1 exit statu

The problem only appear if we have two version of the glib2 library installed
on the system:

[Buildroot]/host/lib/libgio-2.0.so.0.7600.1
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8

This is probably a meson bug introduced by [1] since the error message is wrong!

$ strings output/host/lib/libgio-2.0.so | grep g_module_open_full
g_module_open_full

The libgio-2.0.so provided by Buildroot contains the g_module_open_full symbol
while the libgio-2.0.so installed on the host is too old to have it:

$ strings /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8 | grep g_module_open_full

[1] https://github.com/mesonbuild/meson/commit/59cfbf68e00aa774a9868101f423bd662938c15d

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Nicolas CARRIER <carrier.nicolas0@gmail.com>
---
This meson issue may be not specific to host-qemu...
---
 package/qemu/qemu.mk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index b341d0220d..8a8dddee58 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -401,7 +401,18 @@ HOST_QEMU_ARCH = sh4eb
 endif
 HOST_QEMU_SYS_ARCH ?= $(HOST_QEMU_ARCH)
 
-HOST_QEMU_CFLAGS = $(HOST_CFLAGS)
+# Since meson 1.2.0, compiler's search path are retrieved and used
+# to link a library. If the same library is installed on the host
+# and build by Buildroot (HOST_DIR/lib), meson now link against
+# the one found in the compiler's search path instead of linking
+# agains the one provided by Buildroot.
+# https://github.com/mesonbuild/meson/issues/11914#issuecomment-1678090566
+# Help the compiler by setting -Bprefix that specifies where to find the
+# executables, libraries, include files, and data files of the compiler itself.
+# For each subprogram to be run, the compiler driver first tries the -B prefix,
+# if any. If that name is not found, or if -B is not specified, the driver
+# tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/.
+HOST_QEMU_CFLAGS = $(HOST_CFLAGS) -B$(HOST_DIR)/lib
 
 ifeq ($(BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE),y)
 HOST_QEMU_TARGETS += $(HOST_QEMU_SYS_ARCH)-softmmu
-- 
2.41.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-19 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18 23:46 [Buildroot] [PATCH] package/qemu: force the host compiler to look at HOST_DIR first Romain Naour
2023-08-19 13:54 ` Yann E. MORIN
2023-08-19 20:27   ` Romain Naour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox