Building on macos location of dylib differs from expected.
Opened this issue · 0 comments
niloch commented
On intel i7 2015 MacBook Pro running HighSierra 10.13.5
Mismatch between "os.arch" in sbt.build vs NativeUtils.java path
.
In sbt.build os.arch = x86_64.
Building beanpiece libsentencepiece.dylib
is placed in /osx/x86_64/libsentencepiece.dylib
.
However at runtime when NativeUtils.java
attempts to load the appropriate libary it searches in /osx/i386/libsentencepiece.dylib
in NativeUtils path returns i386 due to
private static Architecture architecture() {
String arch = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
// arch = "x86_64"
if (arch.contains("ppc")) {
return Architecture.PPC;
} else if (arch.contains("i386") || arch.contains("x86")) {
return Architecture.I386;
} else if (arch.contains("amd64") || arch.contains("x86_64")) {
return Architecture.AMD64;
} else {
throw new IllegalArgumentException("Unsupported architecture: " + arch);
}
}