Subject: no work/.buildlink-x11 and ld: cannot find -lX11 under Linux
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 11/25/2002 19:03:31
x11/gtk and xpenguin wouldn't build under Linux due to configure failing.

Then I see that my netBSD box has work/.buildlink-x11, but under Linux
this is not created (and not openwin either).

I am not sure how it is used though, because under NetBSD:

configure:5393: checking for XOpenDisplay in -lX11
configure:5412: cc -o conftest -O2 -I/usr/pkg/include -I/usr/X11R6/include
-Wall -I/usr/X11R6/include -I/usr/pkg/include -I/usr/X11R6/include
-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
-L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib conftest.c -lX11
-lintl -lintl 1>&5

Under Linux:

configure:5393: checking for XOpenDisplay in -lX11
configure:5412: cc -o conftest -g -I/usr/include -I/usr/X11R6/include
-Wall -I/usr/X11R6/include -I/usr/include -I/usr/X11R6/include
-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/lib -L/usr/lib
-L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib conftest.c -lX11
-lintl -lintl 1>&5
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
configure: failed program was:
#line 5401 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char XOpenDisplay();

int main() {
XOpenDisplay()
; return 0; }


configure'ing gtk works fine if done manually:

configure:5393: checking for XOpenDisplay in -lX11
configure:5412: gcc -o conftest -g -O2 -Wall  -I/usr/X11R6/include
-L/usr/X11R6/lib conftest.c -lX11    1>&5

And X11 works fine. And X11 development libraries work: I built and
installed and used x11/xcolors via pkgsrc under Linux.


antelope:~/netbsd/usr/pkgsrc/x11/gtk $ ls -l /usr/X11R6/lib/libX11.so*
lrwxrwxrwx    1 root     root           13 Nov 20 19:23
/usr/X11R6/lib/libX11.so -> libX11.so.6.2
lrwxrwxrwx    1 root     root           13 Nov 20 19:23
/usr/X11R6/lib/libX11.so.6 -> libX11.so.6.2
-rwxr-xr-x    1 root     root       869143 Nov 20 19:23
/usr/X11R6/lib/libX11.so.6.2


I assume the problem is caused because of wrong OS is detected (or some
missing file).

I am unfamiliar with mk Makefiles related to X11. Any ideas on how I can
troubleshoot this better?

   Jeremy C. Reed
   http://www.reedmedia.net/

p.s. By the way, XFree86 4.2.1 is installed via pkgsrc :)