fintanr's weblog

Archives

« April 2005 »
MonTueWedThuFriSatSun
    
2
3
4
6
8
9
10
11
12
13
14
15
16
17
21
22
23
24
25
28
29
30
 
       
Today

the links




Twitter Updates

    follow me on Twitter
















    20050419 Tuesday April 19, 2005

    libnjb on Solaris
    My mp3 player is a Creative Zen Xtra (I just don't drink enough Martini to own an iProduct [1]). 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 class
    
    And 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
    #endif
    
    and 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.
    [1] Actually I like the fact that I can replace the battery myself in the Zen.
    (2005-04-19 03:35:53.0) Permalink Comments [2]