Nick's Tech Blog: Cappuccino > narwhal-rhino fails to load library from "noexec" /tmp directory

Pages

Friday, June 15, 2012

Cappuccino > narwhal-rhino fails to load library from "noexec" /tmp directory

Problem

When executing "jake deploy", I received the following stacktrace:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jna868211880998617115.tmp: /tmp/jna868211880998617115.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:744)
at com.sun.jna.Native.loadNativeLibrary(Native.java:678)
at com.sun.jna.Native.(Native.java:106)
at com.sun.jna.NativeLibrary.(NativeLibrary.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1702)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:845)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen._usr_local_cappuccino_packages_jake_lib_jake_js_7._c_anonymous_13(Unknown Source)
at org.mozilla.javascript.gen._usr_local_cappuccino_packages_jake_lib_jake_js_7.call(Unknown Source)

Solution

The cause of this issue, is because the /tmp directory is mounted noexec on our operating system. Current workarounds exist by specifying the java.io.tmpdir JVM arg (as another executable directory).

The version of narwhal-rhino shipped with cappuccino 0.9.5 currently ignores the JAVA_OPTS environment variable.

To fix:
1. Modify the line 25 in $CAPPUCCINO_HOME/engines/rhino/bin/narwhal-rhino
from
JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy"
to
JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy $JAVA_OPTS"

2. Then a new tmpdir can be specified by setting the JAVA_OPTS env var.
E.g.
export JAVA_OPTS=-Djava.io.tmpdir=/somedir-that-is-executable

This should do the trick.

See also
https://github.com/cappuccino/cappuccino/issues/1512

No comments:

Post a Comment