Subject: x11 buildlink symlinks wrong when LOCALBASE is /usr
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 02/04/2004 12:21:38
This is NetBSD 1.6.2_RC3. My LOCALBASE is /usr.

Building graphics/glut fails with:

cc -c -I../../../include -O2
-I/tmp/pkgsrc/graphics/glut/work.bigfour/.x11-buildlink/include
glut_bitmap.c  -fPIC -DPIC -o .libs/glut_bitmap.o
In file included from glut_bitmap.c:8:
glutint.h:23: X11/Xlib.h: No such file or directory
glutint.h:24: X11/Xutil.h: No such file or directory
In file included from glutint.h:26,
                 from glut_bitmap.c:8:
../../../include/GL/glx.h:38: X11/Xlib.h: No such file or directory
../../../include/GL/glx.h:39: X11/Xutil.h: No such file or directory
*** Error code 1

The symlink is like:
bigfour:/usr/pkgsrc/graphics/glut/work.bigfour/.buildlink$ ls -l
./include/X11/Xlib.h
lrwxr-xr-x  1 reed  wheel  36 Feb  4 11:51 ./include/X11/Xlib.h ->
../../../../X11R6/include/X11/Xlib.h

I noticed it has extra .. for the includes, but the libraries are fine.
For example:

bigfour:/usr/pkgsrc/graphics/glut$ ls -l
/tmp/pkgsrc/graphics/glut/work.bigfour/.buildlink/lib/libfreetype.so
lrwxr-xr-x  1 reed  wheel  33 Feb  4 11:51
/tmp/pkgsrc/graphics/glut/work.bigfour/.buildlink/lib/libfreetype.so ->
../../../X11R6/lib/libfreetype.so
bigfour:/usr/pkgsrc/graphics/glut$ ls -l ../../../X11R6/lib/libfreetype.so
lrwxr-xr-x  1 root  wheel  18 Oct 29 19:20
../../../X11R6/lib/libfreetype.so -> libfreetype.so.9.0

The above is buildlink3. I was able to reproduce with buildlink2. This is
with x11/aterm:

bigfour:/usr/pkgsrc/x11/aterm$ ls -l
/tmp/pkgsrc/x11/aterm/work.bigfour/.buildlink/include/freetype2/freetype/tttags.h
lrwxr-xr-x  1 reed  wheel  56 Feb  4 11:51
/tmp/pkgsrc/x11/aterm/work.bigfour/.buildlink/include/freetype2/freetype/tttags.h
-> ../../../../../X11R6/include/freetype2/freetype/tttags.h
bigfour:/usr/pkgsrc/x11/aterm$ ls -l
../../../../../X11R6/include/freetype2/freetype/tttags.h
ls: ../../../../../X11R6/include/freetype2/freetype/tttags.h: No such file
or directory

So the include headers are linked wrong, but libraries work fine:

bigfour:/usr/pkgsrc/x11/aterm$ ls -l
/tmp/pkgsrc/x11/aterm/work.bigfour/.buildlink/lib/libXv.so
lrwxr-xr-x  1 reed  wheel  27 Feb  4 11:51
/tmp/pkgsrc/x11/aterm/work.bigfour/.buildlink/lib/libXv.so ->
../../../X11R6/lib/libXv.so
bigfour:/usr/pkgsrc/x11/aterm$ ls -l ../../../X11R6/lib/libXv.so
lrwxr-xr-x  1 root  wheel  12 Oct 29 19:20 ../../../X11R6/lib/libXv.so ->
libXv.so.1.0

I have other packages that built fine, but none have any +REQUIRED_BY (no
dependencies yet). I have installed curl, jpeg, libtool-base, png, sudo,
x11-links, unzip.

So I tried building vim which doesn't use any X (no x11-links). And the
links were correct.

As far as I can tell the issue is X related. (My X11BASE is default.)

Again, this is NetBSD 1.6.2_RC3 and my LOCALBASE is /usr.

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