From: Thomas Huth <thuth@redhat.com>
To: "Emmanuel Blot" <eblot.ml@gmail.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: Meson build on macOS: undefined symbol treatment
Date: Thu, 27 Aug 2020 10:16:33 +0200 [thread overview]
Message-ID: <24ac4d35-ff2b-4381-ab1b-1a8f31ba36fb@redhat.com> (raw)
In-Reply-To: <E79B1486-1C3C-4271-9B76-62B2C4B8BCA7@gmail.com>
On 26/08/2020 15.11, Emmanuel Blot wrote:
> Hi,
>
> I’ve noticed that since meson builds have been enabled, on macOS, the
> build outcome with undefined symbols has changed:
>
> - prior to meson introduction (v5.1.0):
> * referencing an undeclared symbol in source code led to a warning at
> compile stage
> * referencing an undeclared symbol at link stage led to a fatal build
> error (as usually expected)
>
> - since meson introduction
> * same behavior at compile stage
> * however, the linker does silently generate an application - which
> fails at launch since the symbol is undefined.
>
> Step to reproduce:
>
> from softmmu/main.c, replace for example call to qemu_init() with
> qemu_init2();
>
> - v5.1.0:
> softmmu/main.c:48:5: warning: implicit declaration of function
> 'qemu_init2' is invalid in C99 [-Wimplicit-function-declaration]
> qemu_init2(argc, argv, envp);
> LINK riscv64-softmmu/qemu-system-riscv64
> Undefined symbols for architecture x86_64:
> "_qemu_init2", referenced from:
> _qemu_main in main.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[1]: *** [qemu-system-riscv64] Error 1
>
> - current master:
> softmmu/main.c:49:5: warning: implicit declaration of function
> 'qemu_init2' is invalid in C99 [-Wimplicit-function-declaration]
> qemu_init2(argc, argv, envp);
> ^
> 1 warning generated.
> [3/3] Linking target qemu-system-riscv64
>
> > riscv64-softmmu/qemu-system-riscv64
> dyld: lazy symbol binding failed: Symbol not found: _qemu_init2
> Referenced from:
> /Users/eblot/Sources/Git/github.com/QEMU/upstream/build/riscv64-softmmu/qemu-system-riscv64
>
> Expected in: flat namespace
>
> 'riscv64-softmmu/qemu-system-ris…' terminated by signal SIGABRT (Abort)
>
>
> This new behavior is likely to come from the linker flag:
>
> -Wl,-undefined,dynamic_lookup
>
> I’m not sure whether it is a new feature or a bug, but if the former
> stands true, is there a way to disable this feature?
Seems like this is added by meson itself (see
meson/mesonbuild/linkers.py), not by our meson.build files ... Paolo,
any idea why this happens?
Thomas
next prev parent reply other threads:[~2020-08-27 8:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 13:11 Meson build on macOS: undefined symbol treatment Emmanuel Blot
2020-08-27 8:16 ` Thomas Huth [this message]
2020-08-30 9:35 ` Paolo Bonzini
2020-08-31 8:12 ` Emmanuel Blot
2020-08-31 10:06 ` Paolo Bonzini
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=24ac4d35-ff2b-4381-ab1b-1a8f31ba36fb@redhat.com \
--to=thuth@redhat.com \
--cc=eblot.ml@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).