We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


X lib errors

muesli asked
Medium Priority
Last Modified: 2013-12-15

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.

Watch Question

> 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



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

Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.