Java ES Prague Team Blog Java ES Prague Team

Friday May 30, 2008

Here are the steps needed to build the Allegro game programming library on Solaris 10 5/08. In short: (in the directory with unpacked Allegro, of course)
$ for i in /usr/X11/include/X11/extensions/*; do ln -s $i /usr/include/X11/extensions/`basename $i`; done
$ sed '/LDFLAGS=\"-Wl,--export-dynamic\ \$LDFLAGS\"/d' configure > configure.solaris
$ chmod 755 configure.solaris
$ ./configure.solaris
$ PATH=$PATH:/usr/ccs/bin gmake
$ PATH=/usr/ucb:$PATH:/usr/ccs/bin gmake install
For some truly obscure reasons (not to break a script somebody wrote 20 years ago, brain damage, you name it) the binaries on Solaris are spread throughout a bunch of bizarre directories, many of which are not in the default PATH. Not only does that concern binaries, but also the header files.
If I did not symlink the header files, the compilation would end with
include/xalleg.h:42:38: X11/extensions/xf86vmode.h: No such file or directory
In file included from ./src/x/xwin.h:21,
                 from ./src/x/xgfxdrv.c:21:
include/xalleg.h:125: error: syntax error before "XF86VidModeModeInfo"
include/xalleg.h:125: warning: no semicolon at end of struct or union
include/xalleg.h:149: error: syntax error before '*' token
include/xalleg.h:149: warning: type defaults to `int' in declaration of `orig_modeinfo'
include/xalleg.h:149: warning: data definition has no type or storage class
include/xalleg.h:156: error: syntax error before '}' token
include/xalleg.h:156: warning: type defaults to `int' in declaration of `_xwin'
include/xalleg.h:156: warning: data definition has no type or storage class
gmake: *** [obj/unix/shared/alleg/xgfxdrv.o] Error 1

A cleaner solution than symlinking the headers would be adding "-I /usr/X11/include" to the compile flags, but I am no programmer to actually know what I'm doing and prefer simpler approach.
Why did I modify the configure script? The ld command present in Solaris does not have the "--export-dynamic" option, so the configure script would eventually set the ALLEGRO_MODULE_TARGETS variable empty. Apparently Allegro developers do not count with such possibility and running gmake install later on would end up with
...
Installing lib/unix/liballeg-4.2.2.so to /usr/local/lib
/bin/sh: syntax error at line 1: `;' unexpected
gmake: *** [install-lib] Error 2
According to this post, the Solaris ld exports symbols by default, so I can safely remove this flag and checks.
Why $PATH:/usr/ccs/bin ? Because the command ar is present in /usr/ccs/bin. Without this step I'd get
...
rm -f lib/unix/liballeg_unsharable.a
ar rvs lib/unix/liballeg_unsharable.a obj/unix/shared/alleg/xdga2s.o obj/unix/shared/alleg/xwins.o obj/unix/shared/alleg/udummy.o
gmake: ar: Command not found
gmake: *** [lib/unix/liballeg_unsharable.a] Error 127
Why PATH=/usr/ucb:$PATH:/usr/ccs/bin ? Because man install says
This version of install (/usr/sbin/install) is not  compati-
     ble with the install binaries in many versions of Unix other
     than Solaris. For a  higher  degree  of  compatibility  with
     other   Unix   versions,   use  /usr/ucb/install,  which  is
     described in the install(1B) man page.
and is really correct about it. With the default, I'd get
...
gmake -C addons/loadpng/ install
gmake[1]: Entering directory `/all/allegro-4.3.10/addons/loadpng'
install -d -m 755 `../../allegro-config --prefix`/include
directory /usr/local/include created
install -m 644 loadpng.h `../../allegro-config --prefix`/include
install: loadpng.h was not found anywhere!
gmake[1]: *** [install-headers] Error 2
gmake[1]: Leaving directory `/all/allegro-4.3.10/addons/loadpng'
gmake: *** [loadpng_install] Error 2
Final note: this applies to version 4.2.2 of the library. The 4.9.x development branch uses quite different build process.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed