[torqueusers] Libtorque on Mac OS X

Scott Wilson scott at epistemy.com
Mon Jul 12 02:52:32 MDT 2010

Hello all,
I've finally figured out enough JNI to get Dan Templeton's Sun Grid Engine Java DRMAA bindings ported to TORQUE (a task made much easier by their well-written nature), but I'm running into a problem when running them on our OS X test system:

> Exception in thread "main" java.lang.reflect.InvocationTargetException
> 	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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
> Caused by: java.lang.UnsatisfiedLinkError: /Users/scott/Documents/jdrmaa/src/libdrmaa.jnilib:  Symbol not found: _environ   Referenced from: /usr/local/lib/libtorque.2.dylib   Expected in: flat namespace  in /usr/local/lib/libtorque.2.dylib
> 	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> 	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
> 	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
> 	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
> 	at java.lang.System.loadLibrary(System.java:1045)
> 	at com.Epistemy.drmaa.SessionImpl$1.run(SessionImpl.java:64)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at com.Epistemy.drmaa.SessionImpl.<clinit>(SessionImpl.java:62)
> 	at com.Epistemy.drmaa.SessionFactoryImpl.getSession(SessionFactoryImpl.java:60)
> 	at com.Epistemy.DRMAA.test.DRMAATest.main(DRMAATest.java:15)
> 	... 5 more

The test machine is an Intel Xeon XServe running Mac OS X Server version 10.6.4 and TORQUE 2.4.8.

The problem seems to be that the _environ symbol, which is known to be declared but not defined on OS X (e.g. http://lists.apple.com/archives/Darwin-development/2003/Apr/msg00177.html and follow ups). There is a simple workaround - add #define environ (*_NSGetEnviron()) - to the library, which I've tried doing in my code to no avail. I'm not experienced enough with C to be certain that this is any of the TORQUE code, but it seems to be libtorque that's being expected to provide _environ (although it isn't explicitly referenced from the C code I compiled into libdrmaa.jnilib).

Does anyone have experience of using libtorque, either directly or through the C DRMAA bindings, on Mac OS X 10.5 or 10.6? Does anyone know what files I would need to edit in the source to add the workaround?


Scott Wilson
Energy Academy
EH14 4AS

tel: +44 131 564 0232
Scott.Wilson at epistemy.com
Epistemy Limited is a company registered in Scotland, number SC365481.
Registered office: Epistemy Limited c/o Technology and Research Services, Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.supercluster.org/pipermail/torqueusers/attachments/20100712/ff59b7ce/attachment.html 

More information about the torqueusers mailing list