diff --git a/changes/build/481.bugfix.md b/changes/build/481.bugfix.md new file mode 100644 index 000000000..e217c6e60 --- /dev/null +++ b/changes/build/481.bugfix.md @@ -0,0 +1,2 @@ +Gate the use of `--undefined-version` in the linker because it breaks on older +GNU `ld`. diff --git a/meson.build b/meson.build index 609540dbd..1ba005a41 100644 --- a/meson.build +++ b/meson.build @@ -143,9 +143,14 @@ configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1) configh_data.set('WIN32_LEAN_AND_MEAN', 1) # Supports -Wl,--version-script? +if cc.has_link_argument('-Wl,--undefined-version') + extra_linker_args = ',--undefined-version' +else + extra_linker_args = '' +endif have_version_script = cc.links( 'int main(){}', - args: '-Wl,--undefined-version,--version-script=' + meson.current_source_dir()/'xkbcommon.map', + args: '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map' + extra_linker_args, name: '-Wl,--version-script', )