[lsb-discuss] SANE and LSB: libusb does not compile

Till Kamppeter till.kamppeter at gmail.com
Wed Jun 20 08:25:23 PDT 2007


Wichmann, Mats D wrote:
> yeah, this is buried in the chain of inclusions.
> in general, LSB does not include things that are
	> specifically defined in linux/foo headers, and
> here including <sys/ioctl.h> does not get you these
> defines.
> 

Now I succeeded to compile libusb by adding "#include <asm/ioctl.h>" to 
linux.h. This uses the platform-specific (32/64 bit) asm/ioctl.h of the 
LSB Build Environment chroot.

Problem is now libieee1284. Also adding "#include <asm/ioctl.h>" to 
every file with "#include <sys/ioctl.h>" and doing

perl -p -i -e 's/\bsize_t\b/long/g' `grep -l size_t */*`

due to "size_t" not existing in the LSB I get everything compiled but 
have a linking problem (I have used "./configure --enable-static 
--disable-shared --without-python"):

------------------------------------------------------------------------
mkdir .libs

*** Warning: Linking the shared library libieee1284.la against the
*** static library /usr/lib/libc_nonshared.a is not portable!
ar cru .libs/libieee1284.a /usr/lib/libc_nonshared.a  src/detect.o 
src/ports.o src/deviceid.o src/state.o src/delay.o src/default.o 
src/access_io.o src/access_ppdev.o src/access_lpt.o src/interface.o 
src/debug.o src/conf.o /usr/lib/libc_nonshared.a
ranlib .libs/libieee1284.a
creating libieee1284.la
(cd .libs && rm -f libieee1284.la && ln -s ../libieee1284.la libieee1284.la)
source='tests/test.c' object='tests/test.o' libtool=no \
         DEPDIR=.deps depmode=gcc /bin/sh ./depcomp \
         /opt/lsb/bin/lsbcc -DHAVE_CONFIG_H -I. -I. -I./include 
-I./include    -O2 -g -march=i486 -c -o tests/test.o tests/test.c
/bin/sh ./libtool --mode=link --tag=CC /opt/lsb/bin/lsbcc  -O2 -g 
-march=i486  -O2 -g -march=i486 /usr/lib/libc_nonshared.a -L/opt/lsb/lib 
-o libieee1284_test  tests/test.o libieee1284.la
/opt/lsb/bin/lsbcc -O2 -g -march=i486 -O2 -g -march=i486 -o 
libieee1284_test tests/test.o  /usr/lib/libc_nonshared.a -L/opt/lsb/lib 
./.libs/libieee1284.a
./.libs/libieee1284.a(access_io.o): In function `raw_inb':
src/access_io.c:132: undefined reference to `inb'
./.libs/libieee1284.a(access_io.o): In function `init':
src/access_io.c:206: undefined reference to `ioperm'
src/access_io.c:206: undefined reference to `ioperm'
./.libs/libieee1284.a(access_io.o): In function `raw_outb':
src/access_io.c:152: undefined reference to `outb_p'
./.libs/libieee1284.a(detect.o): In function `check_io':
src/detect.c:176: undefined reference to `ioperm'
src/detect.c:177: undefined reference to `ioperm'
collect2: ld returned 1 exit status
make: *** [libieee1284_test] Error 1
error: Bad exit status from /home/till/tmp/rpm-tmp.66831 (%build)

------------------------------------------------------------------------

I have tried without modification of LDFLAGS, but also with adding 
"/usr/lib/libc_nonshared.a" and get the result above. Adding 
"/usr/lib/libc.a" already gives an error in the "./configure" step. 
"./configure" tells that the compiler is not able to create executables. 
In config.log I get

------------------------------------------------------------------------
configure:2310: /opt/lsb/bin/lsbcc -O2 -g -march=i486  -O2 -g 
-march=i486 /usr/l
ib/libc.a -L/opt/lsb/lib conftest.c  >&5
/usr/lib/libc.a(syslog.o): In function `__libc_cleanup_routine':
../nptl/sysdeps/pthread/bits/libc-lock.h:415: undefined reference to 
`_Unwind_Re
sume'
/usr/lib/libc.a(syslog.o): In function `__libc_cleanup_routine':
../misc/syslog.c:325: undefined reference to `_Unwind_Resume'
../misc/syslog.c:416: undefined reference to `_Unwind_Resume'
/usr/lib/libc.a(syslog.o): In function `__libc_cleanup_routine':
../nptl/sysdeps/pthread/bits/libc-lock.h:415: undefined reference to 
`_Unwind_Re
sume'
/usr/lib/libc.a(syslog.o):(.eh_frame+0x12): undefined reference to 
`__gcc_person
ality_v0'
/usr/lib/libc.a(backtrace.o): In function `__backtrace':
../sysdeps/i386/backtrace.c:122: undefined reference to `_Unwind_Backtrace'
/usr/lib/libc.a(backtrace.o): In function `backtrace_helper':
../sysdeps/i386/backtrace.c:70: undefined reference to `_Unwind_GetIP'
../sysdeps/i386/backtrace.c:75: undefined reference to `_Unwind_GetGR'
../sysdeps/i386/backtrace.c:76: undefined reference to `_Unwind_GetCFA'
/usr/lib/libc.a(iofclose.o):(.eh_frame+0x11): undefined reference to 
`__gcc_pers
onality_v0'
/usr/lib/libc.a(iofflush.o): In function `_IO_acquire_lock_fct':
/usr/src/glibc-2.4/libio/libioP.h:1002: undefined reference to 
`_Unwind_Resume'
/usr/lib/libc.a(iofflush.o):(.eh_frame+0x12): undefined reference to 
`__gcc_pers
onality_v0'
/usr/lib/libc.a(iofwrite.o): In function `_IO_acquire_lock_fct':
/usr/src/glibc-2.4/libio/libioP.h:1002: undefined reference to 
`_Unwind_Resume'
/usr/lib/libc.a(iofwrite.o):(.eh_frame+0x12): undefined reference to 
`__gcc_pers
onality_v0'
/usr/lib/libc.a(wfileops.o): In function `_IO_acquire_lock_fct':
../libio/libioP.h:1002: undefined reference to `_Unwind_Resume'
/usr/lib/libc.a(wfileops.o):(.eh_frame+0x12): undefined reference to 
`__gcc_pers
onality_v0'
/usr/lib/libc.a(fileops.o): In function `_IO_new_file_fopen':
/usr/src/glibc-2.4/libio/fileops.c:406: undefined reference to 
`_Unwind_Resume'
/usr/lib/libc.a(fileops.o): In function `_IO_acquire_lock_fct':
/usr/src/glibc-2.4/libio/libioP.h:1002: undefined reference to 
`_Unwind_Resume'
/usr/lib/libc.a(fileops.o):(.eh_frame+0x12): undefined reference to 
`__gcc_perso
nality_v0'
collect2: ld returned 1 exit status
configure:2313: $? = 1
------------------------------------------------------------------------

/usr/lib/libc.a contains the symbol "ioperm" (checked by simply grepping 
"ioperm"), /usr/lib/libc_nonshared.a and /opt/lsb/lib/libc* not.

Which library I should link statically (to keep everything LSB-compliant)?

Everything compiled in the 32-bit LSB Build Environment chroot.

    Till




More information about the lsb-discuss mailing list