Bug 212308 - libksane does not compile under Mac OS X
Summary: libksane does not compile under Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: libksane
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Other
: NOR normal
Target Milestone: ---
Assignee: Kåre Särs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-29 18:22 UTC by Jan Gosmann
Modified: 2015-09-17 09:29 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to exclude acquireimages from compilation under OS X (412 bytes, patch)
2009-10-29 18:23 UTC, Jan Gosmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Gosmann 2009-10-29 18:22:54 UTC
Version:           0.7.0 (using KDE 4.3.2)
Compiler:          i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) 
OS:                OS X
Installed from:    Compiled From Sources

kipi-plugins does not compile under Mac OS X. I tried it under Snow Leopard,
but it will probably effect all Mac OS versions.

The problem is, that kipi-plugins get in a way configured, that it tries to
build the aquireimages plugin which uses ksane. Ksane is not available for Mac
OS as far as I know.

It seems to me that a if-clause was forgotten in the CMakeLists.txt for
excluding aquireimages on Mac systems. I will attach a patch to this bug report
adding the missing if-clause to CMakeLists.txt. After applying this patch kipi-plugins compiles.
Comment 1 Jan Gosmann 2009-10-29 18:23:59 UTC
Created attachment 37954 [details]
Patch to exclude acquireimages from compilation under OS X
Comment 2 caulier.gilles 2009-10-30 14:50:10 UTC
Jan,

in current implementation from svn (0.8.0), i have dropped twainiface from AquireImages plugin and deleguate all backend job to libksane, which have twain interface code now.

If libksane is not found, AquireImage will not be compiled. that all. There is no need to patch lead CMakeLists.txt anymore...

TWAIN is MAC and WINDOWS scanner interface. libksane must compile fine to MACOS-X (if not it must...) We must check this point with a MACOS-X computer

I move this entry to libksane as well...

Gilles Caulier
Comment 3 Kåre Särs 2009-10-31 11:19:26 UTC
Hi,

There is probably an error in the cmake script for libksane. It requires sane on all platforms except win32. As far as I know sane should be available also on OS X. As I do not have a Mac, I have not been able to test. 

The reason I made sane "required" was that I do not know if LoadLibraryA("TWAIN_32.DLL"); works on OS X.
Comment 4 caulier.gilles 2009-10-31 12:28:50 UTC
Kare,

libksane compile fine under Win32. I use it with kipi-plugins...

For MAC-OS-x, there is a solution to test with a shared computer provided by a digiKam user few month ago.

Thomas, do you always have this MacOS-X computer on internet to help Kare to port libksane over this os ? Thanks in advance...

Gilles Caulier
Comment 5 caulier.gilles 2009-10-31 12:32:00 UTC
Rishi,

I CC you there for info... as you is another MAC-OS-X user. Perhaps you can guide Kare to some points...

KAre,

In the MAC-OS-X computer, you will need to install Twain tools to emulate a dumy scanner device connected to computer. I do it under win32 and it work fine to test...

Gilles Caulier
Comment 6 Jan Gosmann 2009-10-31 18:34:19 UTC
I'm just trying to build the SVN version. It might work, if acquireimages is really not build if libksane is not found.

Might also be the case that libksane compiles under OS X. However neither I was able to find this library in the files installed by my MacPorts KDE installtion, nor I was able to find the source code to download.

Of course I also have a Mac computer and can do some testing on it (only problem is that my free time is currently very limited).

Hope I could answer all important questions from above.

Jan Gosmann
Comment 7 Jan Gosmann 2009-10-31 18:46:47 UTC
The SVN version does not compile. Here is my console output:

[ 38%] Built target kipiplugin_imageviewer
Scanning dependencies of target kipiplugin_acquireimages_automoc
Generating saveimgthread.moc
Generating scandialog.moc
Generating plugin_acquireimages.moc
[ 38%] Built target kipiplugin_acquireimages_automoc
Scanning dependencies of target kipiplugin_acquireimages
[ 39%] Building CXX object acquireimages/CMakeFiles/kipiplugin_acquireimages.dir/kipiplugin_acquireimages_automoc.o
[ 39%] Building CXX object acquireimages/CMakeFiles/kipiplugin_acquireimages.dir/plugin_acquireimages.o
In file included from /opt/local/libexec/qt4-mac/include/QtCore/qatomic.h:45,
                 from /opt/local/libexec/qt4-mac/include/QtCore/qvariant.h:45,
                 from /opt/local/libexec/qt4-mac/include/QtCore/QVariant:1,
                 from /Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.h:28,
                 from /Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp:23:
/opt/local/libexec/qt4-mac/include/QtCore/qglobal.h:315:6: warning: #warning "Support for this version of Mac OS X is still preliminary"
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp:42:28: error: libksane/ksane.h: No such file or directory
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp: In member function ‘void Plugin_AcquireImages::slotActivate()’:
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp:99: error: invalid use of incomplete type ‘struct KSaneIface::KSaneWidget’
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.h:46: error: forward declaration of ‘struct KSaneIface::KSaneWidget’
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp:103: error: invalid use of incomplete type ‘struct KSaneIface::KSaneWidget’
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.h:46: error: forward declaration of ‘struct KSaneIface::KSaneWidget’
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.cpp:107: error: invalid use of incomplete type ‘struct KSaneIface::KSaneWidget’
/Volumes/Home/blubb/Desktop/digikam/kipi-plugins-0.8.0/graphics/kipi-plugins/acquireimages/plugin_acquireimages.h:46: error: forward declaration of ‘struct KSaneIface::KSaneWidget’
make[2]: *** [acquireimages/CMakeFiles/kipiplugin_acquireimages.dir/plugin_acquireimages.o] Error 1
make[1]: *** [acquireimages/CMakeFiles/kipiplugin_acquireimages.dir/all] Error 2
make: *** [all] Error 2
Comment 8 Kåre Särs 2009-11-05 23:17:43 UTC
Gilles,

I have borrowed a Mac and installed Digikam through Macports and there the kdegraphics package was missing the sane-backends dependency. This is why libksane was not available with Macports. After installing sane-backends it was quite straight forward to compile libksane and Skanlite. I filed a  bug report to add sane-backends to the kdegraphics dependencies.

I also tried to modify the cmake file to allow compiling the twain version, but there are some windows dependencies like windows.h, so no luck with that yet.


Jan:

You do not seem have libksane installed. How have you installed kdegraphics?
Comment 9 Jan Gosmann 2009-11-09 13:17:21 UTC
It is quite obvious that I am missing libksane. In fact "find /opt/local/ -name ksane.h" cannot find the file.

But I have installed kdegraphics 4.3.2 and sane-backends 1.0.20.

Maybe snae-backends has been installed after kdegraphics in my installation and therefore libksane did not get compiled? I will try to reinstall/recompile kdegraphics the next days.

Jan
Comment 10 Kåre Särs 2009-11-09 14:07:07 UTC
If sane-backends is not installed when kdegraphics is compiled, libksane will not be compiled. Here is the link to the ticket I filed to MacPorts:  https://trac.macports.org/ticket/22384
Comment 11 Jan Gosmann 2009-11-12 16:49:17 UTC
Installing sane-backends and recompiling kdegraphics got me a bit further. However kipi-plugins (now trying with version 0.8.0 since it the newest stable) does not compile completly, yet. When acquireimages gets linked I get the following output:

/usr/bin/g++-4.2   -O2 -arch x86_64  -fno-common -Woverloaded-virtual -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG -DQT_NO_DEBUG -Wl,-search_paths_first -headerpad_max_install_names -fPIC -L/opt/local/lib CMakeFiles/scangui.dir/scangui_automoc.o CMakeFiles/scangui.dir/scangui.o CMakeFiles/scangui.dir/scandialog.o CMakeFiles/scangui.dir/saveimgthread.o  -o scangui.app/Contents/MacOS/scangui  -L/opt/local/var/macports/build/_Volumes_Home_blubb_Public_ports_kde_kipi-plugins/work/build/lib -L/opt/local/lib /opt/local/lib/libkio.5.3.0.dylib /opt/local/lib/libkipi.dylib /opt/local/lib/libkexiv2.dylib /opt/local/lib/libkdcraw.dylib ../lib/libkipiplugins.1.0.0.dylib /opt/local/lib/libkio.5.3.0.dylib -F/opt/local/libexec/qt4-mac/lib -framework QtNetwork -F/opt/local/libexec/qt4-mac/lib -framework QtXml /opt/local/lib/libsolid.4.3.0.dylib /opt/local/lib/libkdeui.5.3.0.dylib -F/opt/local/libexec/qt4-mac/lib -framework QtGui -F/opt/local/libexec/qt4-mac/lib -framework QtSvg /opt/local/lib/libkdecore.5.3.0.dylib -F/opt/local/libexec/qt4-mac/lib -framework QtDBus -F/opt/local/libexec/qt4-mac/lib -framework QtCore -lpthread -framework Carbon 
Undefined symbols:
  "KSaneIface::KSaneWidget::make() const", referenced from:
      KIPIAcquireImagesPlugin::ScanDialog::slotSaveImage(QByteArray&, int, int, int, int)in scandialog.o
  "KSaneIface::KSaneWidget::model() const", referenced from:
      KIPIAcquireImagesPlugin::ScanDialog::slotSaveImage(QByteArray&, int, int, int, int)in scandialog.o
  "KSaneIface::KSaneWidget::openDevice(QString const&)", referenced from:
      _main in scangui.o
  "KSaneIface::KSaneWidget::toQImage(QByteArray const&, int, int, int, KSaneIface::KSaneWidget::ImageFormat)", referenced from:
      KIPIAcquireImagesPlugin::ScanDialog::slotSaveImage(QByteArray&, int, int, int, int)in scandialog.o
  "KSaneIface::KSaneWidget::scanCancel()", referenced from:
      KIPIAcquireImagesPlugin::ScanDialog::closeEvent(QCloseEvent*)        in scandialog.o
  "KSaneIface::KSaneWidget::KSaneWidget(QWidget*)", referenced from:
      _main in scangui.o
  "KSaneIface::KSaneWidget::selectDevice(QWidget*)", referenced from:
      _main in scangui.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [acquireimages/scangui.app/Contents/MacOS/scangui] Error 1
make[1]: *** [acquireimages/CMakeFiles/scangui.dir/all] Error 2
make: *** [all] Error 2

Error: Status 1 encountered during processing.

Seems to me that either -lksane or /opt/local/lib/libksane.dylib is missing in the linker options. If that's right, how can I add theme?
Comment 12 Kåre Särs 2009-11-12 18:10:28 UTC
Did you do a clean build of acquireimage? Could it be that you have something left in CMake cache?
Comment 13 Jan Gosmann 2009-11-12 18:57:01 UTC
Yes, it was a complete clean build of the whole kipi-plugins package. I did the compilation via MacPorts with a portfile I'm writing. 

However, I get also linking errors with KSane when compiling the tarball manually. Strangly, these errors occur already at an earlier stage.
Comment 14 Kåre Särs 2009-11-14 16:00:59 UTC
I just committed a cmake fix for this to kipiplugins.
Comment 15 Jan Gosmann 2009-11-14 19:45:46 UTC
kipi-plugins (SVN version) now compiles without any problems. Thank you very much!
Comment 16 rishi.j.sanyal 2009-11-19 03:25:44 UTC
I'm so sorry to join this discussion so late in the game. Looks like you guys got things figured out. But, just to add my 2 cents:

I download and install the sane-backends & libusb binaries from here:
http://www.ellert.se/twain-sane/

Before I 'sudo port install kdegraphics4'. 

I have now upgraded to OS X 10.6 and fully expect a host of new problems in compiling and running digiKam :) Already, lprof won't compile. Argh!

Cheers,
Rishi
Comment 17 Kåre Särs 2009-11-19 07:49:02 UTC
I think it will not be necessary to download and install sane-backends separately in a near future (or even already). 

If you read the last entry in the MacPort ticket (link in comment #10) you will notice that MacPort will install it automatically :)
Comment 18 Jan Gosmann 2009-11-19 14:13:37 UTC
digikam compiled fine for me under OS X 10.6. However, I had some problems with the latest kdegraphcis4 macport (but I have to investigate this a little bit further).

Moreover I submitted portfiles for the current digikam and kipi-plugins package. Therefore installing should get much easier, as soon as these ports get accepted.