Linking (was: [sane-devel] How to find out if USB is available for compilation)

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 17 Mar 2002 17:45:51 +0100


Hi,

On Fri, Mar 08, 2002 at 11:26:07AM -0600, Frank Zago wrote:
[Patch to only link to libraries necessary for the specific backend]

> Check that patch: http://fz.eryx.net/sane/#configure
> 
> It works here. It greatly reduces the number of libraries linked with the
> backends and the fontend. I haven't tested with gphoto or *bsd.

I tested on the following platforms:

* Linux: shared libs: ok,
  static linking: (while linking scanimage):
  ../backend/.libs/libsane.a(dc210.o): In function sane_dc210_start':
  /usr/src/sane-cvs/sane-conf/sane-backends/backend/dc210.c:1210:
  undefined reference to jpeg_std_error'
  (and many many more errors concerning libjpeg and libusb).
  
* AIX, Solaris: shared libs ok, statis untested
* Irix: shared and static ok
* FreeBSD: shared and static have problems with the cam library:
  gcc -o sane-find-scanner sane-find-scanner.o ../sanei/libsanei.a ../lib/liblib.a -lm
  ../sanei/libsanei.a(sanei_scsi.o): In function `sanei_scsi_open':
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x4f): undefined reference to `cam_open_pass'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x99): undefined reference to `cam_close_device'
  ../sanei/libsanei.a(sanei_scsi.o): In function `sanei_scsi_close':
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x272): undefined reference to `cam_close_device'
  ../sanei/libsanei.a(sanei_scsi.o): In function `sanei_scsi_cmd2':
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x2c5): undefined reference to `cam_getccb'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x37e): undefined reference to `cam_send_ccb'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x38f): undefined reference to `cam_freeccb'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x3fb): undefined reference to `cam_freeccb'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x409): undefined reference to `cam_freeccb'
  ../sanei/libsanei.a(sanei_scsi.o): In function `cam_compare_inquiry':
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x52c): undefined reference to `cam_strmatch'
  /usr/local/src/sane-backends-1.0.7-cvs/sanei/sanei_scsi.c(.text+0x54b): undefined reference to `cam_strmatch'
  gmake[1]: *** [sane-find-scanner] Error 1
  gmake[1]: Leaving directory `/usr/local/src/sane-backends-1.0.7-cvs/tools'
  gmake: *** [all-recursive] Error 1
* NetBSD: static ok, shared as usual doesn't work (libtool problem?)
* OpenBSD both ok

So in short, no problems with inter-library-dependancies as far as I
can see.

BTW: Which functions are in libnsl and for what do we need it?

Bye,
  Henning