qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Meson build on macOS: undefined symbol treatment


From: Emmanuel Blot
Subject: Meson build on macOS: undefined symbol treatment
Date: Wed, 26 Aug 2020 15:11:11 +0200

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]