-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add lib path env when node_shared=true
When building the node with `--shared` option, the major output is the shared library. However, we still build a node executable which links to the shared lib. It's for testing purpose. When testing with the executable, some test cases move/copy the executable, change the relative path to the shared library and fail. Using lib path env would solve the issue. However, in macOS, need to change the install name for the shared library and use rpath in the executable. In AIX, `-brtl` linker option rebinds the symbols in the executable and addon modules could use them. Signed-off-by: Yihong Wang <[email protected]> PR-URL: #18626 Refs: #18535 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
- Loading branch information
1 parent
9c52231
commit 0977f04
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable required-modules */ | ||
'use strict'; | ||
const path = require('path'); | ||
|
||
// If node executable is linked to shared lib, need to take care about the | ||
// shared lib path. | ||
exports.addLibraryPath = function(env) { | ||
if (!process.config.variables.node_shared) { | ||
return; | ||
} | ||
|
||
env = env || process.env; | ||
|
||
env.LD_LIBRARY_PATH = | ||
(env.LD_LIBRARY_PATH ? env.LD_LIBRARY_PATH + path.delimiter : '') + | ||
path.join(path.dirname(process.execPath), 'lib.target'); | ||
// For AIX. | ||
env.LIBPATH = | ||
(env.LIBPATH ? env.LIBPATH + path.delimiter : '') + | ||
path.join(path.dirname(process.execPath), 'lib.target'); | ||
// For Mac OSX. | ||
env.DYLD_LIBRARY_PATH = | ||
(env.DYLD_LIBRARY_PATH ? env.DYLD_LIBRARY_PATH + path.delimiter : '') + | ||
path.dirname(process.execPath); | ||
// For Windows. | ||
env.PATH = | ||
(env.PATH ? env.PATH + path.delimiter : '') + | ||
path.dirname(process.execPath); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters