test: fix test when linked with shared libraries #60027
Closed
+8
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the
nopbinary used inparallel/test-process-execve-no-argshas been linked to external libraries, it may need an environment variable such asLD_LIBRARY_PATHto be set to be able to run.Assume if
nodehas been configured to link against any external libraries thennophas also been, and in that case pass through the environment variables to the test.Refs: nodejs/build#4156 (comment)
This is a really subtle problem with
parallel/test-process-execve-no-argsthat has not been caught until now because we've been running thesharedlibs_*CI on Ubuntu with gcc and suddenly came up when we tested switching over to clang.With many of the
sharedlibs_*builds we add libraries onto the command line, e.g. for OpenSSLThe
nopbinary used by the test doesn't need any of that, so gcc on Ubuntu (and other Debian-derived Linux distributions) will not link thenopbinary to those additional libraries1. Howevergccon other Linux distributions, and clang do not do this by default so thenopbinary will be linked to the additional libraries.parallel/test-process-execve-no-argscurrently doesn't pass on the environment variables, so ifLD_LIBRARY_PATH(or equivalent for the platform) needed to be set to find those additional libraries the test would not be able to successfully runnop.For completeness, it's possible to replicate the Ubuntu gcc default behaviour by passing
--as-neededthrough to the linker (e.g.-Wl,--as-needed) but that's sensitive to the linker being used (e.g. the default linker on AIX/Illumos does not support that flag). In an ideal world we would not be appending the additional libraries onto the command line when linkingnop, but that would be tricky to do with the wayconfigureandgypcurrently work.FYI @nodejs/distros