forked from LuaJIT/LuaJIT
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix dynamic modules loading on MacOS
This patch resolves the issue with running the tests with auxiliary dynamically loaded modules in case of out-of-source build. The first issue relates to the way modules loaded at runtime are built on MacOS. Since the auxiliary libraries are built as a dynamically loaded modules on MacOS instead of shared libraries as it is done on Linux and BSD, another environment variable should be used to guide <ffi.load> while searching the extension. Hence the values collected in scope of <BuildTestCLib> macro need to be set to DYLD_LIBRARY_PATH variable instead of LD_LIBRARY_PATH on MacOS. Unfortunately, this rather small change doesn't resolve the problem at all and the root cause lies much deeper than it seems at the beginning. Apple tries their best to "protect their users from malicious software". As a result SIP[1] has been designed and released. Now, Apple developers are *so protected*, that they can load nothing being not installed in the system, since some programs sanitize the environment before they start child processes. Specifically, environment variables starting with DYLD_ and LD_ are unset for child process started by system programs[2]. That which does not kill us makes us stronger: fortunately, these environment variables are used by FFI machinery to find the proper shared library, hence we can still tweak testing environment before calling <ffi.load>. However, the value can't be passed via the standard environment variable, so we prepend TEST_ prefix to its name to get around SIP magic tricks. Finally, to set the variable required by FFI machinery the introduced <utils.tweakenv> routine is used. PROFIT! Your move, Cupertino geniuses. [1]: https://support.apple.com/en-us/HT204899 [2]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html Resolves tarantool/tarantool#5959 Follows up tarantool/tarantool#4862 Co-authored-by: Sergey Ostanevich <sergos@tarantool.org> Co-authored-by: Mons Anderson <mons@cpan.org> Signed-off-by: Igor Munkin <imun@tarantool.org>
- Loading branch information
1 parent
d21791a
commit e0f02ca
Showing
4 changed files
with
77 additions
and
9 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
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