[Mac OSX RCP]: Resolution of dependencies of dynamic libraries
Scenario: Open AF3 app on Mac on try to execute the DSE workflow in which Z3 is invoked (described below)
Expected: you should be able to execute the scenario successfully.
Actual: The scenario fails and an error message is logged in the log file.
Detailed analysis:
In the current build setup, the RCP application for Mac OSX is not an
Mac OSX application, but an application that is run in the Unix
subsystem. The reason for this is that in the Unix subsystem the
DYLD_LIBRARY_PATH
environment variable can be used to to enable the
resolution of dependencies of native libraries, i.e. other native
libraries of libraries that are called from Java code. However, in the
native Mac subsystem, DYLD_LIBRARY_PATH is purged by MacOS System
Integrity Protection:
https://developer.apple.com/library/content/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
The following code was used the build shell script executed in the
af3-phoenix-04-product-macosx
Jenkins job to generate shell wrapper
script that sets DYLD_LIBRARY_PATH.
echo "Creating launcher shell script."
echo '#!/bin/bash' > start-autofocus3-phoenix
echo 'BASEDIR=$(dirname $0)' >> start-autofocus3-phoenix
echo 'cd $BASEDIR/Contents/MacOS' >> start-autofocus3-phoenix
echo "DYLD_LIBRARY_PATH=\$DYLD_LIBRARY_PATH:${msdir}/lib/x64 ./autofocus3-phoenix \$*" >> start-autofocus3-phoenix
chmod a+x start-autofocus3-phoenix
In order to have a native Mac OS application again, the approach with
the shell script has now been abandoned, and the shared libraries
(*.dylib
files) are copied in the same directory as the
autofocus3-phoenix
binary: Contents/MacOS/
. (Side note: native Mac
OS applications are located in a folder that has the extension .app
,
such as AutoFOCUS3.app
).
Currently this affects only Z3, hence the appropriate *.dylib
library
files from Contents/Eclipse/plugins/com.microsoft.z3_[\.0-9]*
are
copied.
In this ticket, the above workaround should be replaced with a proper
solution (hint: -vmargs -Djava.library.path=...
does not work either).
Testing:
- Load the attached model AF3-Project (4 ECUs) Strong Causality
- Open DSE Perspective
- Home
- Select / Change Project
- Unfold AF3-Project (4 ECUs) Strong Causality node
- Select NEW DSE… node
- Finish
- Schedule
- Generate
- If all Z3 libraries have been resolved properly, the schedule view opens and the resulting schedule is shown
- Otherwise, errors are logged to
<workspace>/.metadata/.log
As a reference, also the version of the shell scripts that create the AutoFOCUS3 wrapper script that is executed in the Unix subsystem are attached.
(from redmine: issue id 3385, created on 2018-04-18, closed on 2019-09-30)
- Uploads:
- AF3-Project_4-ECUs_strong_causality.af3_23 Test case
- af3-macos-wrapper-64bit.sh Old MacOS build script (64 bit)
- af3-macos-wrapper-32bit.sh Old MacOS build script (32 bit)