Subject: meta-pkgs/xorg on Sparc Solaris
To: None <joerg@NetBSD.org, pkgsrc-users@NetBSD.org>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: pkgsrc-users
Date: 07/12/2006 14:58:42
Hi, I'm trying to build meta-pkgs/xorg on Sparc Solaris. There are problems
with the build, so I'm slowly making progress. Once it builds OK, I'll submit
patches. Basically I'm hoping to use Xorgs accelerated sunffb driver with my
Creator3D on Ultra 10.

At the moment the build fails with x11/xorg-clients:

making all in programs/xrandr...
cc -xO4 -xbuiltin=%all -xlibmil -xstrconst -xarch=v8plus -Xa -v  -z lazyload -z combreloc -xstrconst -xildoff     -I/opt/pkg.obj/x11/xorg-clients/work.e450/xc -I/opt/pkg.obj/x11/xorg-clients/work.e450/xc/exports/include  -I/opt/pkg.obj/x11/xorg-clients/work.e450/.buildlink/include -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64        -c  xrandr.c
rm -f xrandr
LD_RUN_PATH=/opt/pkg/xorg/lib cc -o xrandr -xO4 -xbuiltin=%all -xlibmil -xstrconst -xarch=v8plus -Xa -v  -z lazyload -z combreloc -xstrconst -xildoff  -B direct -M/usr/lib/ld/map.bssalign -M/usr/lib/ld/map.noexstk   -L/opt/pkg.obj/x11/xorg-clients/work.e450/xc/exports/lib   xrandr.o -lXrandr -lXrender -lXext -lX11    -lsocket -lnsl  -L/opt/pkg/lib -L/opt/pkg/xorg/lib -Wl,-R/opt/pkg/lib -Wl,-R/opt/pkg/xorg/lib
ld: fatal: library -lXrandr: not found
ld: fatal: library -lXrender: not found
ld: fatal: File processing errors. No output written to xrandr
*** Error code 1
make: Fatal error: Command failed for target `xrandr'
Current working directory /opt/pkg.obj/x11/xorg-clients/work.e450/xc/programs/xrandr
*** Error code 1


The problem here is the following command line:

-L/opt/pkg/lib -L/opt/pkg/xorg/lib -Wl,-R/opt/pkg/lib -Wl,-R/opt/pkg/xorg/lib

it is placed to be the last, so for some reason Solaris linker cannot find the
libraries uner /opt/pkg/lib. If the above line precedes '-lXrandr -lXrender'
directives, then I think it compiles OK.

The Makefile has the following declaration:

$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

Here $(EXTRA_LOAD_FLAGS) expand to:

-L/opt/pkg/lib -L/opt/pkg/xorg/lib -Wl,-R/opt/pkg/lib -Wl,-R/opt/pkg/xorg/lib

So I think to fix the problem, each Makefile needs to change CCLINK command to:

$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(EXTRA_LOAD_FLAGS) $(LOCAL_LIBRARIES) $(LDLIBS)

I think Makefiles are generated by Imake, does anyone know which Imake file is
responsible for this? Or what would be the best way to fix this?