• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 813
  • Last Modified:

X lib errors


I get lots of errors like the following when trying to compile the example KDE programs:

/usr/X11R6/lib/libXext.a(extutil.o): In function `XextAddDisplay':
extutil.o(.text+0x1e8): undefined reference to `_XLockMutex_fn'
extutil.o(.text+0x1f2): undefined reference to `_Xglobal_lock'
extutil.o(.text+0x20b): undefined reference to `_XUnlockMutex_fn'
extutil.o(.text+0x215): undefined reference to `_Xglobal_lock'

And, when trying to execute 'java' from the jdk1.1.6v2glibc, I get the following error:

/usr/local/jdk/bin/i586/green_threads/java: error in loading shared libraries
/usr/X11R6/lib/libXp.so.6: undefined symbol: _Xglobal_lock

I'd appreciate any help saying what the problem is, or advising what I should do to check my system out.  Like,
what do these messages exactly mean?  What tool can I use to find out what doesn't exist or is outdated, or has a broken dependency?

Here are the results of running "ldd" on the two named libraries.  (I'm not sure exactly what the results mean):

>ldd /usr/X11R6/lib/libXp.so.6
        libc.so.6 => /lib/libc.so.6 (0x4000a000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
> ldd /usr/X11R6/lib/libXext.a
ldd: warning: you do not have execution permission for `/usr/X11R6/lib/libXext.a'
        not a dynamic executable

My system:
Redhat i386 5.0

...Plus, I've upgraded several *lib* rpms.

  • 2
1 Solution
> In function `XextAddDisplay':

   add -lXext to the link command line

for the other undefs try to find in which lib they are:

   foreach l (/usr/X11R6/lib/lib*)
     echo $lib; nm -gop $lib | grep Xglobal_lock

> /usr/local/jdk/bin/i586/green_threads/java: error in loading shared libraries

please post the output of:

    ldd /usr/local/jdk/bin/i586/green_threads/java
muesliAuthor Commented:

Thanks for the advice. Here's what I've done so far:

1)  Your advice helped me solved the problem with compiling the KDE code.  -lXext was already being used, so I ran your script - it found that the symlink for libXext was pointing to a nonexistent file.  After fixing the link, the code compiles.  Awesome.  Here is the current output of the script, fyi:
foreach lib (/usr/X11R6/lib/lib*)
foreach? echo $lib; nm -gop $lib | grep Xglobal_lock
foreach? end
/usr/X11R6/lib/libX11.a:Quarks.o:         U _Xglobal_lock
/usr/X11R6/lib/libX11.a:ConnDis.o:         U _Xglobal_lock
/usr/X11R6/lib/libX11.a:ErrDes.o:         U _Xglobal_lock
/usr/X11R6/lib/libX11.a:ErrHndlr.o:         U _Xglobal_lock
/usr/X11R6/lib/libX11.a:XlibInt.o:00000004 D _Xglobal_lock
/usr/X11R6/lib/libX11.a:locking.o:         U _Xglobal_lock
/usr/X11R6/lib/libXext.a:extutil.o:         U _Xglobal_lock
/usr/X11R6/lib/libXp.a:XpExtUtil.o:         U _Xglobal_lock
/usr/X11R6/lib/libXp.a:XpLocale.o:         U _Xglobal_lock
/usr/X11R6/lib/libXp.so:         U _Xglobal_lock
/usr/X11R6/lib/libXp.so.6:         U _Xglobal_lock
/usr/X11R6/lib/libXp.so.6.2:         U _Xglobal_lock

2) Executing the command on the Java executable gives the following output:
ldd /usr/local/jdk/bin/i586/green_threads/java
        libjava.so => not found
        libm.so.6 => /lib/libm.so.6 (0x40003000)
        libdl.so.2 => /lib/libdl.so.2 (0x4001c000)
        libawt.so => not found
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x40020000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x4002d000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4007c000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40090000)
        libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x40099000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x400a0000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x400ac000)
        libc.so.6 => /lib/libc.so.6 (0x40166000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
        libdl.so.1 => /lib/libdl.so.1 (0x4020a000)
        libXintl.so.6 => /usr/X11R6/lib/libXintl.so.6 (0x4020f000)

.By using locate, I found the directory that libjava.so, etc are in (/usr/local/jdk1.1.6/lib/i586/green_threads), added it to /etc/ld.so.conf, and ran ldconfig.  The output of ldd now looks better:
ldd /usr/local/jdk/bin/i586/green_threads/java
        libjava.so => /usr/local/jdk1.1.6/lib/i586/green_threads/libjava.so (0x40003000)
        libm.so.6 => /lib/libm.so.6 (0x40074000)
        libdl.so.2 => /usr/local/jdk1.1.6/lib/i586/green_threads/libdl.so.2 (0x4008d000)
        libawt.so => /usr/local/jdk1.1.6/lib/i586/green_threads/libawt.so (0x40091000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x400d9000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x400e6000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40135000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40149000)
        libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x40152000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40159000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40165000)
        libc.so.6 => /usr/local/jdk1.1.6/lib/i586/green_threads/libc.so.6 (0x4021f000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
        libdl.so.1 => /lib/libdl.so.1 (0x402c3000)
        libXintl.so.6 => /usr/X11R6/lib/libXintl.so.6 (0x402c8000)

.BUT, executing Java still produces the same error message:
$ java
/usr/local/jdk/bin/i586/green_threads/java: error in loading shared libraries
/usr/X11R6/lib/libXp.so.6: undefined symbol: _Xglobal_lock

I suggest to move your libjava to /usr/lib (or /lib) and then run ldconfig again.

For testing you also may set the LD_LIBRARY_PATH environment variable to the needed lib-directories:

    setenv LD_LIBRARY_PATH \

Anyway, the message reported by  java  is strange, looks like a
recursive dependency (which should not be a problem for shared libs). Is  java  as called in your last comment a script which
points to (execs) the executable from another path? then please
execute the binary, /usr/local/jdk/bin/i586/green_threads/java,
itself (probably with the above LD_LIBRARY_PATH).

Also keep in mind that some shells need to be restarted after a ldconfig (csh has a rehash command:-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now