Opened 8 years ago

Closed 8 years ago

#1277 closed defect (fixed)

Crash on Mac OS X

Reported by: sjamaan Owned by:
Priority: critical Milestone: 4.11.0
Component: unknown Version: 4.10.x
Keywords: Cc:
Estimated difficulty:


When running make check on OS X, it was reported that the compiler tests failed with the following error:

======================================== compiler tests ...
/Users/joni/Scratch/scheme/chicken-4.11.0rc1/tests/../chicken 'compiler-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /Users/joni/Scratch/scheme/chicken-4.11.0rc1/tests/..
[panic] `##sys#error-hook' is not defined - the `library' unit was probably not linked with this executable - execution terminated

Change History (4)

comment:1 Changed 8 years ago by sjamaan

This turns out to be caused by a new "security" feature in OS X El Capitan (System Integrity Protection), which breaks backward compatibility by obliterating environment variables like DYLD_LIBRARY_PATH for so-called "system" binaries, like /bin/sh. When csc invokes chicken, it will do so through the shell, which means we lose DYLD_LIBRARY_PATH.

This affects many other projects:

See also this Stack Overflow post for one possible workaround.

Last edited 8 years ago by sjamaan (previous) (diff)

comment:2 Changed 8 years ago by Jim Ursetto

I am getting a similar but different error with both 4.10.1 and 4.11.0rc1 snapshots on OS X 10.11.4 with Xcode 7.2.1

$ make PLATFORM=macosx PREFIX=$PWD/inst check
cd tests; sh
======================================== version tests ...
Checking major and minor version numbers against chicken-version... ok
Checking the registered feature chicken-<major>.<minor>... ok
======================================== compiler tests ...
/Users/jim/Downloads/chicken-4.11.0rc1/tests/../chicken 'compiler-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /Users/jim/Downloads/chicken-4.11.0rc1/tests/..
dyld: Library not loaded: libchicken.dylib
  Referenced from: /Users/jim/Downloads/chicken-4.11.0rc1/tests/../chicken
  Reason: image not found

Error: shell command terminated with non-zero exit status 5: /Users/jim/Downloads/chicken-4.11.0rc1/tests/../chicken 'compiler-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /Users/jim/Downloads/chicken-4.11.0rc1/tests/..
make: *** [check] Error 1

But, the installed binary starts fine (the libchicken.dylib path is hardcoded into the binary). DYLD_LIBRARY_PATH being clobbered may well be the issue, as the uninstalled binary in tests/../chicken does not have a hardcoded path.

comment:3 Changed 8 years ago by Jim Ursetto

I am positive this is caused by the stripping of DYLD_LIBRARY_PATH. Symlinking the library into the current working directory makes the tests work:

ln -sf $PWD/libchicken.dylib tests/
ln -sf $PWD/libchicken.dylib tests/reverser/tags/1.0
ln -sf $PWD/libchicken.dylib tests/reverser/tags/1.1

After this all tests pass except for the last test (deployment), which still fails with a nursery error; unsure if related.

/Users/jim/Downloads/chicken-4.11.0rc1/tests/../chicken 'rev-app.scm' -output-file 'rev-app.c' -verbose -include-path /Users/jim/Downloads/chicken-4.11.0rc1/tests/.. -verbose -include-path /Users/jim/Downloads/chicken-4.11.0rc1/tests/..

[panic] nursery is too small - try higher setting using the `-:s' option - execution terminated
Version 0, edited 8 years ago by Jim Ursetto (next)

comment:4 Changed 8 years ago by sjamaan

Resolution: fixed
Status: newclosed

Fixed with a minimally invasive change: a606eb8 / 87c1bab / 9d21c95

Note: See TracTickets for help on using tickets.