I may be missing something. Is there a reason to open the Xmu library
with dlopen instead of linking with it?
The one reason that came to my mind is that we want to compile native
wrappers even if not all the symbols are available in the system. E.g.
you don't need opengl and you don't have libGL but still able to build
classlib and run with opengl stuff disabled. Static linkage is also
not a good choice because of the size of the xlib (and libGL and so
on). Probably there are other reasons, but it'll take a lot of efforts
to redesign wrappers anyway. It's much more simple to hardcode all
acceptable versions for all the libs as a workaround if non-versioned
symlink is missing.
On 11/27/06, Gregory Shimansky <[EMAIL PROTECTED]> wrote:
Oleg Khaschansky wrote:
>> 1) Xmu is installed
>> 2) Xmu is working
>> 3) Xmu has found the default color map
>
> Is symlink to libxmu also ok? Maybe fails not FindFunction but
> LOAD_LIB(libXmu, Xmu);
> which is, actually, a following:
> libXmu = dlopen("libXmu.so", RTLD_LAZY)
>
> Could you try this code also on that machine?
I may be missing something. Is there a reason to open the Xmu library
with dlopen instead of linking with it?
> On 11/27/06, Mark Hindess <[EMAIL PROTECTED]> wrote:
>>
>> On 27 November 2006 at 11:04, "Ivanov, Alexey A"
>> <[EMAIL PROTECTED]> wrote:
>> > Tim, Oleg, Geir, all,
>> >
>> > Some tests also fail because of this problem. See comments in
>> > HARMONY-1439 [1] and HARMONY-1979 [2]. The one that regards to this
>> > particular problem reads:
>> >
>> > "Mark Hindess [26/Oct/06 01:19 PM]
>> > Hmm... looks like the problem I'm having is because:
>> > FindFunction(libXmu, "XmuLookupStandardColormap");
>> >
>> > returns NULL. No idea why since libXmu is installed and seems to
>> contain
>> > that symbol. This is a debian/stable machine."
>> >
>> Thanks for mentioning this. I think this is crucial to getting to the
>> bottom of this. I've just run the following test program below on the
>> build machine and it returns "status = 1". This means:
>>
>> 1) Xmu is installed
>> 2) Xmu is working
>> 3) Xmu has found the default color map
>>
>> Regards,
>> Mark.
>>
>> /* Compile with:
>> * gcc -I/usr/X11R6/include -o xmutest xmutest.c -L/usr/X11R6/lib
>> -lX11 -lXmu
>> */
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>> #include <X11/Xlib.h>
>> #include <X11/Xutil.h>
>> #include <X11/Xatom.h>
>> #include <X11/Xmu/StdCmap.h>
>>
>> int main(int argc, char **argv)
>> {
>> Display *display;
>> int screen;
>> Visual* visual;
>> int depth;
>> int status;
>>
>> if ((display = XOpenDisplay(NULL)) == NULL) {
>> return (-1);
>> }
>> screen = DefaultScreen(display);
>> visual = DefaultVisual(display,screen);
>> depth = DefaultDepth(display,screen);
>> status = XmuLookupStandardColormap(display, screen,
>> XVisualIDFromVisual(visual),
>> depth,
>> XA_RGB_DEFAULT_MAP, False, True);
>> printf("status = %d\n", status);
>> }
>>
>> > [1] https://issues.apache.org/jira/browse/HARMONY-1439
>> > [2] https://issues.apache.org/jira/browse/HARMONY-1979
>> >
>> > --
>> > Alexey A. Ivanov
>> > Intel Enterprise Solutions Software Division
>> >
>> >
>> > >-----Original Message-----
>> > >From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED]
>> > >Sent: Sunday, November 26, 2006 12:46 AM
>> > >To: [email protected]
>> > >Subject: Re: [classlib][awt] Test failure
>> > >
>> > >
>> > >
>> > >Tim Ellison wrote:
>> > >> Oleg Khaschansky wrote:
>> > >>> Do you suggest to introduce the error handling for all the wrappers
>> > or
>> > >>> only for this one? If for all, do you think if it will affect the
>> > >>> performance?
>> > >>
>> > >> I was thinking of something like this. In the non-error case it
>> > would
>> > >> add an additional NULL check as the function address is being
>> cached,
>> > >> and no additional overhead after the cache has been populated.
>> > >>
>> > >> The actual exception thrown is open to debate.\
>> > >
>> > >:)
>> > >
>> > >I don't understand the context - in the event of this fault, is it
>> time
>> > >to simply shut down? Or is this survivable? My understanding is that
>> > >you just don't want to see a GPF.
>> > >
>> > >Either way, how about a hint - like "missing libxmu" or similar?
>> > >
>> > >geir
>> > >
>> > >>
>> > >> Index:
>> > >>
>> >
>> >src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_li
>> > nux_
>> > >X11.cpp
>> > >> =
>> >
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>>
>> >
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>>
>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> > >> ---
>> > >>
>> >
>> >src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_li
>> > nux_
>> > >X11.cpp
>> > >> (revision 478891)
>> > >> +++
>> > >>
>> >
>> >src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_li
>> > nux_
>> > >X11.cpp
>> > >> (working copy)
>> > >> @@ -23,6 +23,7 @@
>> > >>
>> > >> #include "org_apache_harmony_awt_nativebridge_linux_X11.h"
>> > >> #include "org_apache_harmony_awt_nativebridge_linux_ErrorHandler.h"
>> > >> +#include "exceptions.h"
>> > >>
>> > >> static libHandler libX11;
>> > >> static libHandler libXmu;
>> > >> @@ -575,6 +576,10 @@
>> > >> JNIEXPORT jint JNICALL
>> > >>
>> >
>> >Java_org_apache_harmony_awt_nativebridge_linux_X11_XmuLookupStandardCol
>> > orma
>> > >p(
>> > >> JNIEnv *env, jobject self, jlong dpy, jint screen, jlong visualid,
>> > jint
>> > >> depth, jlong property, jint replace, jint retain) {
>> > >> if (p_nbridge_XmuLookupStandardColormap =3D=3D NULL) {
>> > >> p_nbridge_XmuLookupStandardColormap =3D (int (*) (void *, =
>> > int,
>> > >> long, int, long, int, int)) FindFunction(libXmu,
>> > >> "XmuLookupStandardColormap");
>> > >> + if (p_nbridge_XmuLookupStandardColormap =3D=3D NULL) {
>> > >> + throwNewExceptionByName(env,
>> > >> "java/lang/UnsupportedOperationException", "Function not found");
>> > >> + return 0;
>> > >> + }
>> > >> }
>> > >> return (jint) (* p_nbridge_XmuLookupStandardColormap)((void *)
>> > dpy,
>> > >> (int) screen, (long) visualid, (int) depth, (long) property, (int)
>> > >> replace, (int) retain);
>> > >> }
>> > >>
>> > >>
>> > >> What do you think?
>> > >>
>> > >> Regards,
>> > >> Tim
>> > >>
>> >
>>
>>
>>
>
--
Gregory