qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Meson build on macOS: undefined symbol treatment
@ 2020-08-26 13:11 Emmanuel Blot
  2020-08-27  8:16 ` Thomas Huth
  0 siblings, 1 reply; 5+ messages in thread
From: Emmanuel Blot @ 2020-08-26 13:11 UTC (permalink / raw)
  To: qemu-devel

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?


Thanks,
Emmanuel.


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

end of thread, other threads:[~2020-08-31 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26 13:11 Meson build on macOS: undefined symbol treatment Emmanuel Blot
2020-08-27  8:16 ` Thomas Huth
2020-08-30  9:35   ` Paolo Bonzini
2020-08-31  8:12     ` Emmanuel Blot
2020-08-31 10:06       ` Paolo Bonzini

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).