-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Describe the bug
When a static library has dependencies that add linker flags, those flags (at least in some situations) are not deduplicated. For instance, it happens with static_library(..., dependencies: dependency('openmp') or static_library(..., dependencies: meson.get_compiler('c').find_library('z')).
This of course works correctly, but when you see the command line it looks like something has gone awry , especially in a more complex scenario than the example below (we have around 100 -fopenmp arguments in our build at the moment).
To Reproduce
$ touch empty.c
$ cat meson.build
project('example', 'c')
lib1 = static_library('lib1', 'example.c', dependencies: dependency('openmp'))
lib2 = static_library('lib2', 'example.c', dependencies: dependency('openmp'))
shared_library('example', 'example.c', link_with: [lib1, lib2])
$ meson setup build
[...]
$ grep 'LINK_ARGS.*openmp' build/build.ninja
LINK_ARGS = -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libexample.so -Wl,--start-group liblib1.a liblib2.a -Wl,--end-group -fopenmp -fopenmpNote the duplicate -fopenmp arguments.
Expected behavior
-fopenmp arguments are deduplicated.
system parameters
- Rocky Linux 9.7
- Python 3.9.25
- Meson 1.10.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels