[sane-devel] Epson perfection 660 ->Problem building on OSX

Dino Tang tang@mac.com
Sat, 21 Jun 2003 12:00:39 -0700


Hi Brian,

You have the latest system, but you might not have the latest tool set. 
  You can open the Project Builder and use the "About Project Builder" 
to find out what version you have.  If it doesn't say "Version 2.1 
(December 2002 Developer Tools)", you don't have the latest tool set.  
You can download the latest tools from the ADC ( Apple Developer 
Connection ) site.

The "multiple symbol defined" problem has to do with the way you 
compile libusb.  Mattias Ellert <mattias.ellert@tsl.uu.se> has sent me 
the following explanation and patch awhile back.

Cheers!

--Dino

--- beginning Mattias's message ---
If you get that error even when linking against libusb, I guess you 
didn't patch the libusb before compiling it. The attached patch should 
be applied to libusb before compiling. It does build without the patch, 
but the configure script cheats a bit and links frameworks as 
libraries, so the dependencies don't get recorded correctly in the 
libraries. This means that when you compile something that depends on 
libusb you might get into trouble -- as you did.

Since the libusb patch changes some autoconf/automake files you need to 
rerun those. My build instructions for libusb are as follows. (The 
--disable-static is optional of course.) In this way you get a library 
with the correct dependencies recorded.

tar -z -x -f libusb-0.1.7.tar.gz
patch -p0 < frameworks.patch
cd libusb-0.1.7
#  Remove 'missing' in order to avoid warning about it being old during 
configure.
#  A newer version will be installed by automake.
rm missing
aclocal
automake --add-missing
autoconf
./configure --disable-static
make

	Mattias

PS. I have sent the patch to the maintainer of libusb, so it might be 
included in the next official release if it is accepted. The SANE 
prerelease already has the corresponding patch included.

diff -ur libusb-0.1.7.orig/Makefile.am libusb-0.1.7/Makefile.am
--- libusb-0.1.7.orig/Makefile.am	Mon Nov 11 19:04:15 2002
+++ libusb-0.1.7/Makefile.am	Sun Mar  2 15:59:42 2003
@@ -28,7 +28,7 @@
  if DARWIN_API
  OS_SUPPORT = darwin.c
  CFLAGS_EXT = -no-cpp-precomp
-LDADDS = -lIOKit -framework "CoreFoundation"
+LDADDS = -framework IOKit -framework CoreFoundation
  else
  OS_SUPPORT =
  endif
diff -ur libusb-0.1.7.orig/configure.in libusb-0.1.7/configure.in
--- libusb-0.1.7.orig/configure.in	Sun Nov 17 19:45:15 2002
+++ libusb-0.1.7/configure.in	Sun Mar  2 15:59:42 2003
@@ -11,7 +11,8 @@

  dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions 
so they
  dnl are available for $ac_help expansion (don't we all *love* 
autoconf?)
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+			     [AC_DIVERT_PUSH(NOTICE)])

  #
  # The following version number definitions apply to libusb
@@ -76,7 +77,8 @@
  dnl Initialize maintainer mode
  AM_MAINTAINER_MODE

-AC_CANONICAL_HOST
+dnl This has already been dragged in by AM_PROG_LIBTOOL
+dnl AC_CANONICAL_HOST

  AC_MSG_CHECKING(for what USB OS support)
  case $host in
@@ -99,7 +101,7 @@
      AC_SUBST(DARWIN_API)
      os_support=darwin
      AC_MSG_RESULT(Darwin and/or MacOS 10)
-    OSLIBS="-lIOKit"
+    OSLIBS="-framework IOKit"
      ;;
  esac

@@ -111,7 +113,8 @@

  dnl figure debugging default, prior to $ac_help setup
  dnl
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+			     [AC_DIVERT_PUSH(NOTICE)])
  if test `expr $LIBUSB_MINOR_VERSION \% 2` = 1 ; then
    debug_default=yes
  else
diff -ur libusb-0.1.7.orig/ltmain.sh libusb-0.1.7/ltmain.sh
--- libusb-0.1.7.orig/ltmain.sh	Wed Mar 27 20:10:10 2002
+++ libusb-0.1.7/ltmain.sh	Sun Mar  2 15:59:42 2003
@@ -887,6 +887,11 @@
  	  prev=
  	  continue
  	  ;;
+	framework)
+	  deplibs="$deplibs -framework $arg"
+	  prev=
+	  continue
+	  ;;
  	release)
  	  release="-$arg"
  	  prev=
@@ -988,6 +993,11 @@
  	continue
  	;;

+      -framework)
+	prev=framework
+	continue
+	;;
+
        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
        # so, if we see these flags be careful not to treat them like -L
        -L[A-Z][A-Z]*:*)
@@ -1378,10 +1388,37 @@
  	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  	esac
        fi
+      prev=
        for deplib in $libs; do
+	case $prev in
+	"") ;;
+	framework)
+	  prev=
+	  if test $linkmode = oldlib && test $linkmode = obj; then
+	    $echo "$modename: warning: \`-framework' is ignored for 
archives/objects: $deplib" 1>&2
+	    continue
+	  fi
+	  if test $pass = conv; then
+	    deplibs="-framework $deplib $deplibs"
+	    continue
+	  fi
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="-framework $deplib $compile_deplibs"
+	    finalize_deplibs="-framework $deplib $finalize_deplibs"
+	  else
+	    deplibs="-framework $deplib $deplibs"
+	    test $linkmode = lib && newdependency_libs="-framework $deplib 
$newdependency_libs"
+	  fi
+	  continue
+	  ;;
+	esac
  	lib=
  	found=no
  	case $deplib in
+	-framework)
+	  prev=framework
+	  continue
+	  ;;
  	-l*)
  	  if test "$linkmode" = oldlib && test "$linkmode" = obj; then
  	    $echo "$modename: warning: \`-l' is ignored for archives/objects: 
$deplib" 1>&2
@@ -1553,12 +1590,35 @@
  	    convenience="$convenience $ladir/$objdir/$old_library"
  	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  	    tmp_libs=
+	    prev=
  	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      case $deplib in
+	      -framework)
+		prev=framework
+		continue
+		;;
+	      *)
+		case $prev in
+		framework)
+		  deplibs="-framework $deplib $deplibs"
+		  case "$tmp_libs " in
+		  *" $deplib "*)
+		    specialdeplibs="$specialdeplibs -framework $deplib" ;;
+		  esac
+		  tmp_libs="$tmp_libs -framework $deplib"
+		  ;;
+		*)
+		  deplibs="$deplib $deplibs"
+		  case "$tmp_libs " in
+		  *" $deplib "*)
+		    specialdeplibs="$specialdeplibs $deplib" ;;
+		  esac
+		  tmp_libs="$tmp_libs $deplib"
+		  ;;
+		esac
+		;;
  	      esac
-	      tmp_libs="$tmp_libs $deplib"
+	      prev=
  	    done
  	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
@@ -1668,22 +1728,34 @@
  	  fi

  	  tmp_libs=
+	  prev=
  	  for deplib in $dependency_libs; do
  	    case $deplib in
+	    -framework)
+	      prev=framework
+	      continue
+	      ;;
  	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | 
$Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  	    esac
  	    # Need to link against all dependency_libs?
  	    if test "$linkalldeplibs" = yes; then
-	      deplibs="$deplib $deplibs"
+	      case $prev in
+	      framework) deplibs="-framework $deplib $deplibs" ;;
+	      *)         deplibs="$deplib $deplibs" ;;
+	      esac
  	    else
  	      # Need to hardcode shared library paths
  	      # or/and link against static libraries
-	      newdependency_libs="$deplib $newdependency_libs"
+	      case $prev in
+	      framework) newdependency_libs="-framework $deplib 
$newdependency_libs" ;;
+	      *)         newdependency_libs="$deplib $newdependency_libs" ;;
+	      esac
  	    fi
  	    case "$tmp_libs " in
  	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  	    esac
  	    tmp_libs="$tmp_libs $deplib"
+	    prev=
  	  done # for deplib
  	  continue
  	fi # $linkmode = prog...
@@ -1979,12 +2051,35 @@
  	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname 
$newdependency_libs"
  	  # ... and its dependency_libs
  	  tmp_libs=
+	  prev=
  	  for deplib in $dependency_libs; do
-	    newdependency_libs="$deplib $newdependency_libs"
-	    case "$tmp_libs " in
-	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	    case $deplib in
+	    -framework)
+	      prev=framework
+	      continue
+	      ;;
+	    *)
+	      case $prev in
+	      framework)
+		newdependency_libs="-framework $deplib $newdependency_libs"
+		case "$tmp_libs " in
+		*" $deplib "*)
+		  specialdeplibs="$specialdeplibs -framework $deplib" ;;
+		esac
+		tmp_libs="$tmp_libs -framework $deplib"
+		;;
+	      *)
+		newdependency_libs="$deplib $newdependency_libs"
+		case "$tmp_libs " in
+		*" $deplib "*)
+		  specialdeplibs="$specialdeplibs $deplib" ;;
+		esac
+		tmp_libs="$tmp_libs $deplib"
+		;;
+	      esac
+	      ;;
  	    esac
-	    tmp_libs="$tmp_libs $deplib"
+	    prev=
  	  done

  	  if test "$link_all_deplibs" != no; then
@@ -2032,8 +2127,21 @@
        done # for deplib in $libs
        if test "$pass" = dlpreopen; then
  	# Link the dlpreopened libraries before other libraries
+	prev=
  	for deplib in $save_deplibs; do
-	  deplibs="$deplib $deplibs"
+	  case $deplib in
+	  -framework)
+	    prev=framework
+	    continue
+	    ;;
+	  *)
+	    case $prev in
+	    framework) deplibs="-framework $deplib $deplibs" ;;
+	    *)         deplibs="$deplib $deplibs" ;;
+	    esac
+	    ;;
+	  esac
+	  prev=
  	done
        fi
        if test "$pass" != dlopen; then
@@ -2059,21 +2167,37 @@
  	  # Add libraries to $var in reverse order
  	  eval tmp_libs=\"\$$var\"
  	  new_libs=
+	  prev=
  	  for deplib in $tmp_libs; do
  	    case $deplib in
+	    -framework)
+	      prev=framework
+	      continue
+	      ;;
  	    -L*) new_libs="$deplib $new_libs" ;;
  	    *)
  	      case " $specialdeplibs " in
-	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *" $deplib "*)
+		case $prev in
+		framework) new_libs="-framework $deplib $new_libs" ;;
+		*)         new_libs="$deplib $new_libs" ;;
+		esac
+		;;
  	      *)
  		case " $new_libs " in
  		*" $deplib "*) ;;
-		*) new_libs="$deplib $new_libs" ;;
+		*)
+		  case $prev in
+		  framework) new_libs="-framework $deplib $new_libs" ;;
+		  *)         new_libs="$deplib $new_libs" ;;
+		  esac
+		  ;;
  		esac
  		;;
  	      esac
  	      ;;
  	    esac
+	    prev=
  	  done
  	  tmp_libs=
  	  for deplib in $new_libs; do
--- ending Mattias's message ---

On Saturday, June 21, 2003, at 02:14 AM, Brian D. Williams wrote:

> I have been trying to get sane to work with the epson perfection 660. 
> I could
> build sane with 1.0.11 but not with the snapscan addition. I could not 
> build
> 1.0.12 at all. It would stop building at when trying to make scanimage 
> but I
> didn't see any error messages that made sense to me. I am running the 
> latest os
> x (10.2.6). Sadly I don't have a scanner available (other than the 
> epson) to
> test against. Any suggestions would be greatly appreciated.
>
> Brian