Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native JFFI library not found on Mac #2935

Closed
chrisseaton opened this issue May 13, 2015 · 2 comments
Closed

Native JFFI library not found on Mac #2935

chrisseaton opened this issue May 13, 2015 · 2 comments

Comments

@chrisseaton
Copy link
Contributor

There something wrong with where JFFI is looking for its native library on the Mac in JRuby. We are getting the fallback version. You may not notice this in normal JRuby, as it's silently ignored, but in Truffle we require the native version and so we're seeing the error.

$ bin/jruby -X+T -e 'puts 14'
Truffle internal error: java.lang.RuntimeException: Error while calling the constructor of Truffle's RubyContext
java.lang.RuntimeException: Error while calling the constructor of Truffle's RubyContext
    at org.jruby.Ruby.loadTruffleContext(Ruby.java:939)
    at org.jruby.Ruby.getTruffleContext(Ruby.java:918)
    at org.jruby.Ruby.runInterpreter(Ruby.java:871)
    at org.jruby.Ruby.runInterpreter(Ruby.java:885)
    at org.jruby.Ruby.runNormally(Ruby.java:757)
    at org.jruby.Ruby.runFromMain(Ruby.java:574)
    at org.jruby.Main.doRunFromMain(Main.java:401)
    at org.jruby.Main.internalRun(Main.java:296)
    at org.jruby.Main.run(Main.java:225)
    at org.jruby.Main.main(Main.java:197)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.jruby.Ruby.loadTruffleContext(Ruby.java:937)
    ... 9 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder
    at jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:282)
    at jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
    at jnr.posix.MacOSPOSIX.<init>(MacOSPOSIX.java:11)
    at jnr.posix.POSIXFactory.loadMacOSPOSIX(POSIXFactory.java:147)
    at jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:118)
    at jnr.posix.POSIXFactory.getNativePOSIX(POSIXFactory.java:72)
    at org.jruby.truffle.runtime.RubyContext.<init>(RubyContext.java:129)
    ... 14 more

The error is not actually NoClassDefFoundError - but a static initialiser in there is failing. If you attach a debugger you see whereabouts it's going wrong. It looks like it's looking for the wrong type of file.

Workaround: cp lib/jni/Darwin/libjffi-1.2.jnilib lib/jni/Darwin/libjffi-1.2.dylib

@chrisseaton
Copy link
Contributor Author

This was ok in pre2 - if you go back and modify Truffle to load POSIX as

posix = POSIXFactory.getNativePOSIX(new TrufflePOSIXHandler(this));

It works fine.

@chrisseaton
Copy link
Contributor Author

No longer a problem.

@enebo enebo added this to the Invalid or Duplicate milestone Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants