libnjb on Solaris
By fintanr on Apr 19, 2005
My mp3 player is a Creative Zen Xtra (I just don't drink enough Martini to own an iProduct ). Anyway I obviously would prefer to use Solaris rather than Windows for this little gadget, so I compiled up gnomad2 which requires libnjb. One of the issues compiling was a relatively common problem that I've encountered recently, that of types being defined for Linux but not for Solaris. The error in this case looks like
[fintanr@tiresias libnjb-2.0] $ make cd src && make prefix=/usr/local /usr/bin/bash ..//libtool --mode=compile gcc -I/usr/local/include -DHAVE_GETOPT_H -DHAVE_LIBGEN_H -DHAVE_USLEEP -Wall -Wmissing-prototypes -c base.c gcc -I/usr/local/include -DHAVE_GETOPT_H -DHAVE_LIBGEN_H -DHAVE_USLEEP -Wall -Wmissing-prototypes -c base.c -fPIC -DPIC -o .libs/base.o In file included from base.c:9: libnjb.h:163: error: syntax error before "u_int8_t" libnjb.h:163: warning: no semicolon at end of struct or union libnjb.h:164: warning: type defaults to `int' in declaration of `usb_interface' libnjb.h:164: warning: data definition has no type or storage classAnd when we take a look at libnjb.h we see that our types are assumed to be the those that are on Linux. Anyway the fix for this is simple, just add the following to libnjb.h
#ifdef __sun #define u_int8_t uint8_t #define u_int16_t uint16_t #define u_int32_t uint32_t #define u_int64_t uint64_t #endifand away you go. A patch has been submitted to the libnjb folks on Sourceforge all ready (the patch is actually for libnjb.h.in). If your really interested you can view it here.
 Actually I like the fact that I can replace the battery myself in the Zen.