teuben / nemo

a Stellar Dynamics Toolbox (Not Everybody Must Observe)
https://astronemo.readthedocs.io
GNU General Public License v2.0
57 stars 42 forks source link

MacOSX 10.15.7 looses NEMO environment? (SIP) #45

Open teuben opened 3 years ago

teuben commented 3 years ago

To very weird issues on my latest mac update:

1) /usr/bin/time COMMAND

looses (some ) environment variables , notably $DYLD_LIBRARY_PATH

2) A simple bash script

! /bin/bash

echo $SHELL echo $DYLD_LIBRARY_PATH

shows $SHELL, but not an existent exported $DYLD_LIBRARY_PATH

3) using a more modern bash (apple ships with 3.2.27) via brew it does manage to see $DYLD_LIBRARY_PATH, but clearly something odd is going on the latest macos.x

teuben commented 3 years ago

It seems the big new word on the block is "System Integrity Protection" (SIP)

https://developer.apple.com/forums/thread/9233

and it appears I'm finally catching up with this.

teuben commented 3 years ago

As an example, scripts with the following first line will not work anymore:

! /usr/bin/env bash

but this will:

! /usr/local/bin/bash

even if /usr/local/bin is in your PATH before /bin

teuben commented 3 years ago

Well, the pragmatic solution is to skip the building of shared libs (or use an -rpath style linking). The default is now that shared libs are disabled, with --enable-shared it can be turned back on. "disk space is cheap"....

Also note that on this version of Mac the Xcode (clang) compiler does not compile gyrfalcON. Use the gcc-10/g++-10 version from brew:

  CC=gcc-10 CXX=g++-10 ./configure
teuben commented 3 years ago

SIP bites back: expression parsers (bodyfunc) now fail because there is no shared lib. This means it works in linux, but on a Mac currently broken. thank you apple.

teuben commented 3 years ago

Walter Dehnen reported he solved it by placing a symlink to the falcON shared libraries in /usr/local/lib, then not use $DYLD_LIBRARY_PATH and let the system linker resolved it (which is allowed in /usr/local) Since this requires admin access, it's not attractive for NEMO.

teuben commented 3 years ago

Saw a tip, which I have not tried, to work around certain SIP issues: To solve this issue, create the following file in your home directory:

  '.launchd.conf'

with the contents:

  launchctl setenv PYTHONPATH $PYTHONPATH

  launchctl setenv DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH

but as my loyal reader will know, I minimize my life on a mac. Linux is still the way to go.