On Tuesday, August 10, 2010, Andrew Haley wrote: > You are trying to redefine one of gcj's core classes, > sun.reflect.Reflection. This is never going to work, no matter what > combination of options you try to use: the compiled binary interface > requires core classes to be unique. > > So, I removed the classes that already exist in libgcj, and it gets > much further. oops. don't remember where I got that jar file, but the ReflectionHack was to avoid errors like: undefined reference to `hidden alias for java::lang::Class* sun::reflect::Reflection::getCallerClass(int)' from the classes in the jar file. I downloaded the reference implementation of JSR 223 and I extract the javax part (as I get other "undefined reference to `hidden alias" errors if I use the extracted script.jar from the reference implementation of JSR 223 as you can see when you run my script). Now the SIGSEGV is gone. Thanks! > You have to call JvAttachCurrentThread. oops I missed that when I created the test case from my real application. > -findirect-dispatch -fno-indirect-classes is correct. That's what I reasoned after a vast research on the net. However now I do get a "java.lang.NoClassDefFoundError: javax.script.ScriptEngineManager" Error. I would expect a NoClassDefFoundError for the jython script engine itself, as I did not provide it on the classpath, but ScriptEngineManager is in the shared library compiled from the jar, so why do I get a NoClassDefFoundError? To run my new script you need to get the reference implementation of JSR 223. Please download sjp-1_0-ea-linux-i586.tar.gz from http://jcp.org/aboutJava/communityprocess/pr/jsr223/index.html Thanks! > Andrew. Lothar
Attachment:
gcjtest.tar.bz2
Description: application/bzip-compressed-tar
$ ./build.sh Archive: jars/script.jar creating: META-INF/ inflating: META-INF/MANIFEST.MF creating: META-INF/services/ inflating: META-INF/services/javax.script.ScriptEngineFactory creating: com/ creating: com/sun/ creating: com/sun/script/ creating: com/sun/script/groovy/ inflating: com/sun/script/groovy/GroovyCompiledScript.class inflating: com/sun/script/groovy/GroovyScriptEngine$GroovyNamespace.class inflating: com/sun/script/groovy/GroovyScriptEngine.class inflating: com/sun/script/groovy/GroovyScriptEngineFactory.class creating: com/sun/script/http/ inflating: com/sun/script/http/ScriptServlet$EngineRepository.class inflating: com/sun/script/http/ScriptServlet$TagProcessor.class inflating: com/sun/script/http/ScriptServlet.class creating: com/sun/script/invocation/ inflating: com/sun/script/invocation/ConversionException.class inflating: com/sun/script/invocation/GenericConverter.class inflating: com/sun/script/invocation/InvocationException.class inflating: com/sun/script/invocation/Invoker.class inflating: com/sun/script/invocation/TypeConverter.class creating: com/sun/script/javascript/ inflating: com/sun/script/javascript/ExternalScriptable.class inflating: com/sun/script/javascript/RhinoCompiledScript.class inflating: com/sun/script/javascript/RhinoScriptContext.class inflating: com/sun/script/javascript/RhinoScriptEngine.class inflating: com/sun/script/javascript/RhinoScriptEngineFactory.class inflating: com/sun/script/javascript/RhinoServlet.class creating: com/sun/script/php/ inflating: com/sun/script/php/CommonResolver.class inflating: com/sun/script/php/ConfigTomcat.class inflating: com/sun/script/php/PHPBridge.class inflating: com/sun/script/php/PHPScriptEngine$1.class inflating: com/sun/script/php/PHPScriptEngine.class inflating: com/sun/script/php/PHPScriptEngineFactory.class inflating: com/sun/script/php/PHPServlet.class inflating: com/sun/script/php/PhpZvalProxy.class creating: com/sun/script/util/ inflating: com/sun/script/util/DeTagifier$CharHolder.class inflating: com/sun/script/util/DeTagifier.class inflating: com/sun/script/util/InterfaceImplementor$InterfaceImplementorInvocationHandler.class inflating: com/sun/script/util/InterfaceImplementor.class inflating: com/sun/script/util/JwsdpCobundleInstallHelper.class inflating: com/sun/script/util/NamespaceBase.class inflating: com/sun/script/util/NamespaceEntrySet$NamespaceEntry.class inflating: com/sun/script/util/NamespaceEntrySet$NamespaceIterator.class inflating: com/sun/script/util/NamespaceEntrySet.class inflating: com/sun/script/util/NamespaceImpl.class inflating: com/sun/script/util/ScriptEngineInfoBase.class inflating: com/sun/script/util/ScriptEnginePool.class creating: javax/ creating: javax/script/ inflating: javax/script/Compilable.class inflating: javax/script/CompiledScript.class inflating: javax/script/GenericScriptContext.class inflating: javax/script/GenericScriptEngine.class inflating: javax/script/Invocable.class inflating: javax/script/Namespace.class inflating: javax/script/ScriptContext.class inflating: javax/script/ScriptEngine.class inflating: javax/script/ScriptEngineFactory.class inflating: javax/script/ScriptEngineInfo.class inflating: javax/script/ScriptEngineManager.class inflating: javax/script/ScriptException.class inflating: javax/script/SimpleNamespace.class creating: javax/script/http/ inflating: javax/script/http/GenericHttpScriptContext$RequestWrapper.class inflating: javax/script/http/GenericHttpScriptContext.class inflating: javax/script/http/HttpScriptContext.class inflating: javax/script/http/HttpScriptRequest.class inflating: javax/script/http/HttpScriptResponse.class inflating: javax/script/http/HttpScriptServlet.class adding: META-INF/ (stored 0%) adding: META-INF/services/ (stored 0%) adding: META-INF/services/javax.script.ScriptEngineFactory (deflated 48%) adding: META-INF/MANIFEST.MF (deflated 11%) adding: javax/ (stored 0%) adding: javax/script/ (stored 0%) adding: javax/script/Namespace.class (deflated 33%) adding: javax/script/GenericScriptEngine.class (deflated 59%) adding: javax/script/CompiledScript.class (deflated 53%) adding: javax/script/ScriptContext.class (deflated 53%) adding: javax/script/Compilable.class (deflated 41%) adding: javax/script/http/ (stored 0%) adding: javax/script/http/HttpScriptContext.class (deflated 53%) adding: javax/script/http/HttpScriptResponse.class (deflated 29%) adding: javax/script/http/GenericHttpScriptContext$RequestWrapper.class (deflated 54%) adding: javax/script/http/GenericHttpScriptContext.class (deflated 55%) adding: javax/script/http/HttpScriptRequest.class (deflated 29%) adding: javax/script/http/HttpScriptServlet.class (deflated 51%) adding: javax/script/ScriptEngineInfo.class (deflated 53%) adding: javax/script/Invocable.class (deflated 49%) adding: javax/script/ScriptEngine.class (deflated 63%) adding: javax/script/SimpleNamespace.class (deflated 54%) adding: javax/script/ScriptException.class (deflated 55%) adding: javax/script/GenericScriptContext.class (deflated 56%) adding: javax/script/ScriptEngineFactory.class (deflated 37%) adding: javax/script/ScriptEngineManager.class (deflated 54%) ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::putValue(java::lang::String*, java::lang::Object*)' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::init()' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::execute(java::io::Reader*, java::io::Writer*, javax::servlet::http::HttpServletRequest*, javax::servlet::http::HttpServletResponse*, javax::servlet::Servlet*, javax::script::Namespace*, bool)' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::pushArrayElem(java::lang::String*, java::lang::String*, long long)' ./libscripting0.so: undefined reference to `hidden alias for java::lang::Object* com::sun::script::php::PHPBridge::invokeMethod(java::io::Writer*, long long, java::lang::String*, JArray<java::lang::Object*>*)' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::resetRequest()' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::sleep()' ./libscripting0.so: undefined reference to `hidden alias for java::lang::Object* com::sun::script::php::PHPBridge::getValue(java::lang::String*)' ./libscripting0.so: undefined reference to `hidden alias for void com::sun::script::php::PHPBridge::term()' collect2: ld returned 1 exit status testgcj Create JavaVM ... Create JavaVM done. Java Exception: java.lang.NoClassDefFoundError: javax.script.ScriptEngineManager