Skip to content

Commit 4da73b2

Browse files
committed
Make all Mac OS dynamic libraries be relocatable
In order for Mac OS to correctly load `libscalaz3` it needs to be able to find it’s dependencies. They’re `libz3` and `libz3java`. This commit modifies the dependency information in all binaries to use `@loader_path`, which makes them relative to the calling library (or app). This makes the test suite (and stainless) pass all tests via Z3. More info: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html#//apple_ref/doc/uid/TP40008306-SW1 Fix #56
1 parent 731e37d commit 4da73b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

project/Build.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,13 @@ object ScalaZ3Build extends Build {
220220
val frameworkPath = "/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
221221

222222
exec("install_name_tool -id @loader_path/"+z3Name+" "+z3BinFilePath.absolutePath, s)
223+
exec("install_name_tool -id @loader_path/"+javaZ3Name+" "+javaZ3BinFilePath.absolutePath, s)
224+
// make the dependency to z3 be relative to the caller's location
225+
exec("install_name_tool -change "+z3Name+" @loader_path/"+z3Name+" "+javaZ3BinFilePath.absolutePath, s)
223226

224227
exec("gcc -std=gnu89 -o " + libBinFilePath.absolutePath + " " +
225228
"-dynamiclib" + " " +
226-
"-install_name "+extractDir(cs)+soName + " " +
229+
"-install_name @loader_path/"+soName + " " +
227230
"-I" + jdkIncludePath.absolutePath + " " +
228231
"-I" + jdkMacIncludePath.absolutePath + " " +
229232
"-I" + frameworkPath + " " +

0 commit comments

Comments
 (0)