build: always link plugins with unresolved symbols allowed

we're quite surprised that this hasn't caused problems sooner.

Change-Id: I33b779c1563e15db715c7fd4d3cb6516cf34391d
This commit is contained in:
eldritch horrors
2026-06-21 17:16:17 +02:00
parent 10845bfe63
commit 0cddd2d38a
3 changed files with 14 additions and 22 deletions
+7 -13
View File
@@ -1,19 +1,13 @@
# Darwin: don't link liblix* into plugins (host process provides them at runtime).
# Explicitly link curl so it binds to Nix-store libcurl, not /usr/lib/libcurl.
if is_darwin
plugin_deps = [
liblix.partial_dependency(includes : true, compile_args : true),
curl,
]
else
plugin_deps = [liblix, curl]
endif
plugin_mtls_store = shared_module( plugin_mtls_store = shared_module(
'plugin_mtls_store', 'plugin_mtls_store',
'plugin_mtls_store.cc', 'plugin_mtls_store.cc',
dependencies : plugin_deps, # don't link liblix* into plugins (host process provides them at runtime).
# Explicitly link curl so it binds to Nix-store libcurl, not /usr/lib/libcurl.
dependencies : [
liblix.partial_dependency(includes : true, compile_args : true),
curl,
],
install : false, install : false,
build_by_default : true, build_by_default : true,
link_args : is_darwin ? shared_module_link_args : strict_shared_module_link_args, link_args : plugin_link_args,
) )
+3 -5
View File
@@ -246,13 +246,11 @@ endif
# allows unresolved symbols to be resolved from the host process at runtime, avoiding the # allows unresolved symbols to be resolved from the host process at runtime, avoiding the
# symbol binding issues that occur with -flat_namespace (where plugin curl_* calls could # symbol binding issues that occur with -flat_namespace (where plugin curl_* calls could
# resolve to /usr/lib/libcurl instead of the Nix-store libcurl used by the host). # resolve to /usr/lib/libcurl instead of the Nix-store libcurl used by the host).
shared_module_link_args = [] plugin_link_args = []
# This is a stricter additional set of link flags (for non-plugin shared modules).
strict_shared_module_link_args = []
if is_darwin if is_darwin
shared_module_link_args += ['-Wl,-undefined,dynamic_lookup'] plugin_link_args += ['-Wl,-undefined,dynamic_lookup']
elif is_linux elif is_linux
strict_shared_module_link_args += ['-Wl,-z,defs'] plugin_link_args += ['-Wl,-z,undefs']
endif endif
configdata = configuration_data() configdata = configuration_data()
+4 -4
View File
@@ -2,10 +2,10 @@ libplugintest = shared_module(
'plugintest', 'plugintest',
'plugintest.cc', 'plugintest.cc',
dependencies : [ dependencies : [
liblix, liblix.partial_dependency(includes : true, compile_args : true),
], ],
build_by_default : false, build_by_default : false,
link_args : shared_module_link_args, link_args : plugin_link_args,
) )
libplugintestfail_link_args = [] libplugintestfail_link_args = []
@@ -17,9 +17,9 @@ libplugintestfail = shared_module(
'plugintestfail', 'plugintestfail',
'plugintestfail.cc', 'plugintestfail.cc',
dependencies : [ dependencies : [
liblix, liblix.partial_dependency(includes : true, compile_args : true),
], ],
cpp_args : ['-DMISSING_REFERENCE'], cpp_args : ['-DMISSING_REFERENCE'],
link_args : shared_module_link_args + libplugintestfail_link_args, link_args : plugin_link_args + libplugintestfail_link_args,
build_by_default : false, build_by_default : false,
) )