Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run tests while building tarantool from source on mac os #5959

Closed
Onvember opened this issue Apr 1, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working luajit qa Issues related to tests or testing subsystem
Milestone

Comments

@Onvember
Copy link

Onvember commented Apr 1, 2021

Bug description

I tried to build Tarantool from source on MacOS and failed on running tests.

  • OS: MacOS Catalina
  • OS Version: 10.15.7

Steps to reproduce

I followed this instruction:

xcode-select --install

xcode-select -switch /Applications/Xcode.app/Contents/Developer

git clone https://github.com/tarantool/tarantool.git --recursive

cd tarantool

git submodule update --init --recursive

brew install git openssl readline curl icu4c libiconv zlib cmake

pip install --user test-run/requirements.txt

mkdir build && cd build

cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

make

make test

MAKE TEST OUTPUT
[  1%] Built target msgpuck
[  3%] Built target coro
[  3%] Built target eio
[  3%] Built target decNumber
[  3%] Built target ev
[  3%] Built target bit
[  5%] Built target small
[  5%] Built target salad
[  7%] Built target uri
[ 12%] Built target core
[ 12%] Built target stat
[ 12%] Built target uuid
[ 12%] Built target mpstream
[ 14%] Built target vclock
[ 15%] Built target box_error
[ 21%] Built target zstd
[ 21%] Built target cpu_feature
[ 21%] Built target crc32
[ 21%] Built target xlog
[ 22%] Built target yaml
[ 22%] Built target misc
[ 24%] Built target bundled-ares-project
[ 26%] Built target bundled-libcurl-project
[ 26%] Built target minilua
[ 28%] Built target buildvm
[ 28%] Built target buildvm_output
[ 38%] Built target core_static
[ 38%] Built target vm_static
[ 38%] Built target libluajit_static
[ 38%] Built target libluajit
[ 38%] Built target build_bundled_libs
[ 38%] Built target scramble
[ 38%] Built target txt2c
[ 38%] Built target http_parser
[ 38%] Built target coll
[ 38%] Built target crypto
[ 38%] Built target swim_udp
[ 38%] Built target swim_ev
[ 38%] Built target swim
[ 57%] Built target server
[ 59%] Built target shutdown
[ 59%] Built target bitset
[ 59%] Built target csv
[ 59%] Built target json
[ 61%] Built target raft
[ 61%] Built target bin2c
[ 61%] Built target lemon
[ 63%] Built target mkkeywordhash
[ 64%] Built target generate_sql_files
[ 68%] Built target tuple
[ 68%] Built target xrow
[ 94%] Built target box
[ 96%] Built target tarantool
Scanning dependencies of target libsandwich
[ 96%] Building C object third_party/luajit/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeFiles/libsandwich.dir/libsandwich.c.o
[ 96%] Linking C shared library libsandwich.dylib
[ 96%] Built target libsandwich
Scanning dependencies of target libflush
[ 98%] Building C object third_party/luajit/test/tarantool-tests/lj-flush-on-trace/CMakeFiles/libflush.dir/libflush.c.o
[ 98%] Linking C shared library libflush.dylib
[ 98%] Built target libflush
Scanning dependencies of target testgetmetrics
[ 98%] Building C object third_party/luajit/test/tarantool-tests/misclib-getmetrics-capi/CMakeFiles/testgetmetrics.dir/testgetmetrics.c.o
[100%] Linking C shared library testgetmetrics.dylib
[100%] Built target testgetmetrics
Scanning dependencies of target tarantool-tests
Running Tarantool tests
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-524-fold-conv-respect-src-irt.test.lua ... ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/or-232-unsink-64-kptr.test.lua .............. ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-4476-fix-string-find-recording.test.lua .. ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/misclib-memprof-lapi.test.lua ............... ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-494-table-chain-infinite-loop.test.lua ... ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-3196-incorrect-string-length.test.lua .... ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-505-fold-no-strref-for-ptrdiff.test.lua .. ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/misclib-getmetrics-lapi.test.lua ............ ok    
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-4773-tonumber-fail-on-NUL-char.test.lua .. ok   
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-flush-on-trace.test.lua .................. 1/? 
not ok - Trace is aborted
not ok - Trace is recorded
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-flush-on-trace.test.lua .................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 2/2 subtests 
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua ............... 1/? 
not ok - Trace is aborted
not ok - Trace is recorded
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua ............... Dubious, test returned 1 (wstat 256, 0x100)
Failed 2/2 subtests 
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/misclib-getmetrics-capi.test.lua ............ ok    

Test Summary Report
-------------------
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/lj-flush-on-trace.test.lua                (Wstat: 256 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 1
/Users/n.ogoreltseva/tarantool/third_party/luajit/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua             (Wstat: 256 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 1
Files=12, Tests=44,  1 wallclock secs ( 0.10 usr  0.04 sys +  0.42 cusr  0.15 csys =  0.71 CPU)
Result: FAIL
make[3]: *** [tarantool-tests] Error 1
make[2]: *** [third_party/luajit/test/tarantool-tests/CMakeFiles/tarantool-tests.dir/all] Error 2
make[1]: *** [test/CMakeFiles/test.dir/rule] Error 2
make: *** [test] Error 2
@Onvember Onvember added the bug Something isn't working label Apr 1, 2021
@igormunkin igormunkin added 2sp luajit qa Issues related to tests or testing subsystem labels Apr 2, 2021
@igormunkin igormunkin self-assigned this Apr 2, 2021
@igormunkin igormunkin added this to the 1.10.10 milestone Apr 2, 2021
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 5, 2021
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>
igormunkin added a commit that referenced this issue Apr 5, 2021
LuaJIT submodule is bumped to introduce the following changes:
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Within this changeset SIP issues are worked around and dynamic modules
loading on MacOS is fixed. As a result LuaJIT tests can be enabled for
static build target on MacOS.

Closes #5959
Follows up #4862

Signed-off-by: Igor Munkin <imun@tarantool.org>
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 6, 2021
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>
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 7, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
igormunkin added a commit that referenced this issue Apr 7, 2021
LuaJIT submodule is bumped to introduce the following changes:
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Within this changeset SIP issues are worked around and dynamic modules
loading on MacOS is fixed. As a result LuaJIT tests can be enabled for
static build target on MacOS.

Closes #5959
Follows up #4862

Reviewed-by: Alexander V. Tikhonov <avtikhon@tarantool.org>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 7, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit fae1681)
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 7, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit fae1681)
igormunkin added a commit to tarantool/luajit that referenced this issue Apr 7, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit fae1681)
igormunkin added a commit that referenced this issue Apr 7, 2021
LuaJIT submodule is bumped to introduce the following changes:
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Within this changeset SIP issues are worked around and dynamic modules
loading on MacOS is fixed. As a result LuaJIT tests can be enabled for
static build target on MacOS.

Closes #5959
Follows up #4862

Reviewed-by: Alexander V. Tikhonov <avtikhon@tarantool.org>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit 0c4d52a)
igormunkin added a commit that referenced this issue Apr 7, 2021
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Closes #5959
Follows up #4862
igormunkin added a commit that referenced this issue Apr 7, 2021
LuaJIT submodule is bumped to introduce the following changes:
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Within this changeset SIP issues are worked around and dynamic modules
loading on MacOS is fixed. As a result LuaJIT tests can be enabled for
static build target on MacOS.

Closes #5959
Follows up #4862

Reviewed-by: Alexander V. Tikhonov <avtikhon@tarantool.org>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit 0c4d52a)
igormunkin added a commit that referenced this issue Apr 7, 2021
LuaJIT submodule is bumped to introduce the following changes:
* test: fix dynamic modules loading on MacOS
* test: make utils.selfrun usage easier
* test: remove excess dependency for tests target

Within this changeset SIP issues are worked around and dynamic modules
loading on MacOS is fixed. As a result LuaJIT tests can be enabled for
static build target on MacOS.

Closes #5959
Follows up #4862

Reviewed-by: Alexander V. Tikhonov <avtikhon@tarantool.org>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
@igormunkin
Copy link
Collaborator

The issue is resolved in scope of tarantool/luajit@fae1681. The submodule was updated in tarantool in 2.8.0-204-g0c4d52a23 (0c4d52a), 2.7.1-187-g9719804b9 (9719804), 2.6.2-182-g82573a913 (82573a9), 1.10.9-114-g96e0397e7 (96e0397).

Shishqa pushed a commit to Shishqa/luajit that referenced this issue May 8, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
Shishqa pushed a commit to Shishqa/luajit that referenced this issue May 9, 2021
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
igormunkin added a commit to tarantool/luajit that referenced this issue Jun 16, 2022
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
igormunkin added a commit to tarantool/luajit that referenced this issue Jun 16, 2022
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 to be 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>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Reviewed-by: Sergey Ostanevich <sergos@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
@igormunkin igormunkin removed the teamL label Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working luajit qa Issues related to tests or testing subsystem
Projects
None yet
Development

No branches or pull requests

2 participants