15 messages in net.java.dev.jna.usersRe: [jna-users] linux libc link error
FromSent OnAttachments
QuartzOct 27, 2007 7:55 am 
Timothy WallOct 27, 2007 8:14 am 
QuartzOct 27, 2007 11:10 am 
Timothy WallOct 27, 2007 12:54 pm 
QuartzOct 28, 2007 11:03 am 
QuartzOct 28, 2007 12:44 pm 
Timothy WallOct 28, 2007 1:44 pm 
Timothy WallOct 28, 2007 1:49 pm 
Timothy WallOct 28, 2007 1:55 pm 
Timothy WallOct 28, 2007 2:30 pm 
QuartzOct 29, 2007 8:23 am 
Timothy WallOct 29, 2007 1:56 pm 
QuartzOct 29, 2007 7:39 pm 
Timothy WallOct 30, 2007 6:37 am 
QuartzNov 3, 2007 9:39 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] linux libc link errorActions...
From:Quartz (quar@yahoo.com)
Date:Oct 28, 2007 12:44:12 pm
List:net.java.dev.jna.users

Hi,

I tried to run the ant's build.xml on our buildbox. Worked well until the X11 stuff, likely because our buildbox is headless and was not planned to have X.

Is there a way to turnoff all the X11 stuff with an ant property, turning into a
makefile's env property I guess, some kind of #define HEADLESS?

I am afraid that even if compiled, the library may not load on X-less server's
JVM. Any clue? I suspect it may require moving X related native methods into a
separate class (out of Native.java). Could it be the case?

Help! Thanks.

PS: failed build log below:

native: [exec] In file included from dispatch.c:55: [exec] /usr/lib/j2sdk1.5-sun/jre/../include/linux/jawt_md.h:11:22: error:
X11/Xlib.h: No such file or directory [exec] /usr/lib/j2sdk1.5-sun/jre/../include/linux/jawt_md.h:12:23: error:
X11/Xutil.h: No such file or directory [exec] /usr/lib/j2sdk1.5-sun/jre/../include/linux/jawt_md.h:13:27: error:
X11/Intrinsic.h: No such file or directory [exec] In file included from dispatch.c:55: [exec] /usr/lib/j2sdk1.5-sun/jre/../include/linux/jawt_md.h:25: error:
expected specifier-qualifier-list before 'Drawable' [exec] gcc -W -Wall -Wno-unused -Wno-parentheses -fPIC
-fno-omit-frame-pointer -fno-strict-aliasing -D_REENTRANT -DNEED_JAWT_HACK -DHAVE_PROTECTION -I"/usr/lib/j2sdk1.5-sun/jre/../include"
-I"/usr/lib/j2sdk1.5-sun/jre/../include/linux" -I"/coradiant/build/dd/jnasvn/jna/jnalib/build/native" -I/coradiant/build/dd/jnasvn/jna/jnalib/build/native/libffi/include -c
dispatch.c -o /coradiant/build/dd/jnasvn/jna/jnalib/build/native/dispatch.o [exec] dispatch.c: In function 'Java_com_sun_jna_Native_getWindowHandle0': [exec] dispatch.c:1497: error: 'JAWT_X11DrawingSurfaceInfo' has no member
named 'drawable' [exec] make: ***
[/coradiant/build/dd/jnasvn/jna/jnalib/build/native/dispatch.o] Error 1

BUILD FAILED /coradiant/build/dd/jnasvn/jna/jnalib/build.xml:214: exec returned: 2

--- Timothy Wall <twal@dev.java.net> wrote:

Looks like your system has an older glibc (probably 2.3) installed, and the jna.jar you have was compiled against glibc 2.4 (the current trunk binary build for linux uses glibc 2.3).

Do "/lib/libc.so.6" on the command line and it'll print the version of glibc in use.

On Oct 27, 2007, at 2:10 PM, Quartz wrote:

Hi,

//I made an interface Pthread.java: import com.sun.jna.Library; import com.sun.jna.Native; public interface Pthread extends Library { Pthread INSTANCE = (Pthread)Native.loadLibrary("pthread", Pthread.class); int pthread_self(); }

//And them I made a simple test class: public class TaskId { public static void main(String[] args) throws Exception { System.out.println("pthread_self() returned "+Pthread.INSTANCE.pthread_self()); } }

//Then I compiled and ran it, and got: javac -cp jna.jar *.java java -cp jna.jar:. TaskId

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/ jna47643.tmp: /lib/libc.so.6: version `GLIBC_2.4' not found (required by /tmp/jna47643.tmp) at java.lang.ClassLoader$NativeLibrary.load(Native Method) ...

What's going on? (forgive my lack of knowlege)

--- Timothy Wall <twal@dev.java.net> wrote:

I would guess linux uses pthreads, but you could browse the JVM source to be sure. I would imagine you might find what you're looking for in the native java.lang.Thread sources.

I'm inferring that task corresponds to thread, so if you make a pthread call to get the thread id, that might be what you're looking for.

The thread/task id might even be tucked away in a private member of a platform-specific class (this is the case with 1.6+ for AWT window handles).