Building Software Packages for Linux: Second Example: Xloadimage

prev-3720765 next-2556799 toc-9036815

The second example poses an easier problem. The xloadimage program seemed a useful addition to my set of graphic tools. I copied the xloadi41.gz file directly from the source directory on the CD included with the excellent X User Tools book, by Mui and Quercia. As expected, tar xzvf unarchives the files. Make, however, produces a nasty-looking error and terminates.

gcc -c -O -fstrength-reduce -finline-functions -fforce-mem
-fforce-addr -DSYSV  -I/usr/X11R6/include
-DSYSPATHFILE=\"/usr/lib/X11/Xloadimage\" mcidas.c

In file included from /usr/include/stdlib.h:32,
                 from image.h:23,
                 from xloadimage.h:15,
                 from mcidas.c:7:
/usr/lib/gcc-lib/i486-linux/2.6.3/include/stddef.h:215:
conflicting types for `wchar_t'
/usr/X11R6/include/X11/Xlib.h:74: previous declaration of
`wchar_t'
make[1]: *** [mcidas.o] Error 1
make[1]: Leaving directory
`/home/thegrendel/tst/xloadimage.4.1'
make: *** [default] Error 2

The error message contains the essential clue.

Looking at the file image.h, line 23…

       #include 

Aha, somewhere in the source for xloadimage, wchar_t has been redefined from what was specified in the standard include file, stdlib.h. Let us first try commenting out line 23 in image.h, as perhaps the stdlib.h include is not, after all, necessary.

At this point, the build proceeds without any fatal errors. The xloadimage program functions correctly now.

prev-3720765 next-2556799 toc-9036815

READ  News Bytes LG #43