From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Romain Naour <romain.naour@gmail.com>
Cc: Nicolas CARRIER <carrier.nicolas0@gmail.com>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/qemu: force the host compiler to look at HOST_DIR first
Date: Sat, 19 Aug 2023 15:54:51 +0200 [thread overview]
Message-ID: <20230819135451.GA1778688@scaer> (raw)
In-Reply-To: <20230818234638.499248-1-romain.naour@gmail.com>
Romain, All,
+Bernd for the meson bump
On 2023-08-19 01:46 +0200, Romain Naour spake thusly:
> 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/.
So, I understand that this makes qemu actually build, but I am afraid
this is just hidign the problem.
Indeed, it is possible that we have other host packages that depend on
some of the host libs we build and that may exist on the system, and
those packages are also going to break.
For example, host-efl is a host-meson-package, and depends on
host-libglib2, so presumably we would hav e the issue there too.
We can't fix the breakage by adding -B to all the host packages one by
one. If -B is idneed the correct fix (I doubt it), then we will have to
add it to the common HOST_CFLAGS, HOST_CXXFLAGS and so on...
However, what bothers me slighhtly, is why the qemu link step uses two
different ways to link with the libglib2 libraries, e.g.:
-l/path/to/host/lib/libgio-2.0.so
-L/path/to/host/lib -lgmodule-2.0
So, why is libgio handled with an absolute path, while libgmodule is
not? Note that libgio does have a DT_NEEDED on libgmodule.
However, let's have a look at the pkg-config files, let's start with
gio-2.0.pc:
Requires: glib-2.0, gobject-2.0
Requires.private: gmodule-no-export-2.0, zlib, mount >= 2.23
Libs: -L${libdir} -lgio-2.0
Libs.private: -ldl -lresolv
OK, then gmodule-no-export-2.0.pc:
Requires: glib-2.0
Libs: -L${libdir} -lgmodule-2.0 -pthread
Libs.private: -ldl
So, the two are similar. I am not sure to understand how we end up in
this situation, though... :-/
In the meantime, since the bump to meson 1.2.0 is causing the issue with
out an easy fix in sight, I'll revert the meson bump.
Regards,
Yann E. MORIN.
> 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
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-08-19 13:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-08-19 20:27 ` Romain Naour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230819135451.GA1778688@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=carrier.nicolas0@gmail.com \
--cc=romain.naour@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox