Page 2 of 11

Re: Building Scan Tailor on OSX

Posted: 28 May 2010, 12:56
by univurshul
Thanks TIm. Yeah, I thought briefly maybe I was supposed to enter all these lines into Xcode....there's at least 3 apps involved to get this one going.

Re: Building Scan Tailor on OSX

Posted: 28 May 2010, 17:50
by matt
Hi all,
I'm having a bit of trouble building the latest versions of ScanTailor on OSX 10.6.3. RELEASE_0_9_8_1 builds fine (sweet! -- so much better than running the Windows version using a VM...) but the 0.9.9pre4 and current HEAD versions fail at this same point in the make process:

Code: Select all

[ 82%] Building CXX object CMakeFiles/scantailor.dir/ErrorWidget.cpp.o
[ 82%] Building CXX object CMakeFiles/scantailor.dir/OrthogonalRotation.cpp.o
[ 82%] Building CXX object CMakeFiles/scantailor.dir/NewOpenProjectPanel.cpp.o
[ 83%] Building CXX object CMakeFiles/scantailor.dir/ProjectFilesDialog.cpp.o
[ 83%] Building CXX object CMakeFiles/scantailor.dir/WorkerThread.cpp.o
/opt/local/libexec/qt4-mac/include/QtCore/qsettings.h: In member function ‘WorkerThread::Dispatcher::UpdatePriorityResult WorkerThread::Dispatcher::updateThreadPriority(const BackgroundTask&)’:
/opt/local/libexec/qt4-mac/include/QtCore/qsettings.h:304: error: ‘QSettings::QSettings(const QSettings&)’ is private
/Users/matt/Applications/scantailor/WorkerThread.cpp:161: error: within this context
make[2]: *** [CMakeFiles/scantailor.dir/WorkerThread.cpp.o] Error 1
make[1]: *** [CMakeFiles/scantailor.dir/all] Error 2
make: *** [all] Error 2
Any ideas on how to proceed/troubleshoot?

Thanks,
Matt

Re: Building Scan Tailor on OSX

Posted: 28 May 2010, 18:43
by Tulon
Try now Matt.

Re: Building Scan Tailor on OSX

Posted: 28 May 2010, 23:13
by matt
Newest version now works for me. Thanks!

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 01:43
by n9yty
Just a note - working on an OSX standard .app version of this. Unfortunately, it may be 10.6/Intel only.

Hmmm... File is too big to upload here. I don't normally use file sharing sites, so I just picked one from a Google search. :)

Anyone care to try this out? I do have one other non-development Snow Leopard computer here, and I transferred it to that computer and it seemed to work OK so I am hopeful this will work.

---FILE REMOVED--- PLEASE USE ONE A FEW POSTS DOWN.

It is a DMG (disk image) format, just download and click to run (maybe copy to your Desktop or Applications folder).

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 08:28
by Tim
n9yty wrote:Just a note - working on an OSX standard .app version of this. Unfortunately, it may be 10.6/Intel only.
Nice. I had made a basic info.plist file that did work and sent it to Tulon, but I didn't know how to fit it into the build infrastructure to make it easy on him. You're way beyond my simple efforts.

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 11:25
by univurshul
n9yty wrote:Just a note - working on an OSX standard .app version of this...Anyone care to try this out?
This is killer news for the Mac crowd. I've been procrastinating to get this app going; the hardware environment has fully consumed my time.

Excellent work.

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 13:00
by n9yty
Anyone want to donate a nice icon? :)

And, looks like it may be easy to include a larger segment of the Mac user base....

Here is a build that is 10.5/10.6 - i386/ppc. I tested it on a 10.5 PPC machine, seems to work OK.

No 64bit, but the only thing stopping that is that Qt is not yet distributing a build of their libraries that is ppc/i386/x86_64. It may come in the future.

For now, enjoy. And, the build notes will be posted next so that anyone could replicate this if they wanted.

http://www.4shared.com/file/brJuZB33/Sc ... -0991.html

MD5 (ScanTailor-0.9.9.1.dmg) = 4c50d8016e0abae3dc127c3f69ec5a09
(UPDATED: 10:20PM CST 2010-07-29)

I'm still learning a lot about Qt / Boost / CMake / etc. . . This one is built a little differently, but I think a better way.

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 13:16
by n9yty
[UPDATED 2010-08-09]

Now builds for Tiger (10.4) and forward.

Subject to more modifications, but here is the gist of how I build the standalone apps. When you see how simple it was, I won't seem so important at all. :)

First, I downloaded the QtLib SDK. You could get by with just the libs/build tools, not the whole SDK. I used Carbon, because it had ppc and x86, the Cocoa one had x86 and x86_64 but no ppc.

http://qt.nokia.com/

You will also need CMake, thankfully a binary downloadable version is available.

http://www.cmake.org/cmake/resources/software.html

For the rest, I made a directory and then downloaded and compiled all of the following in directories under it.

In a Terminal window:

Code: Select all

mkdir /usr/local/src/scantailor
cd /usr/local/src/scantailor
Save the following files in this directory. I just do them using vi, or pico, or whatever editor you like:

Code: Select all

vi {filename}
(press i on the keyboard to enter insert mode in vi)
{paste in the text}
hit : then type wq and hit enter to save
Info.plist.in:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleExecutable</key>
	<string>ScanTailor</string>
	<key>CFBundleName</key>
	<string>ScanTailor</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleIdentifier</key>
	<string>net.sourceforge.Scantailor</string>
	<key>CFBundleSignature</key>
	<string>sctl</string>
	<key>CSResourcesFileMapped</key>
	<true/>
	<key>CFBundleIconFile</key>
	<string>ScanTailor.icns</string>
	<key>CFBundleShortVersionString</key>
	<string>ScanTailor-@VERSION@</string>
	<key>LSMinimumSystemVersion</key>
	<string>10.4.0</string>
</dict>
</plist>
makeapp.sh:

Code: Select all

#!/bin/bash
export APP=ScanTailor.app
export APPC=$APP/Contents
export APPM=$APPC/MacOS
export APPR=$APPC/Resources
export APPF=$APPC/Frameworks

rm -rf ScanTailor.app
mkdir -p $APPC
mkdir -p $APPM
mkdir -p $APPR
mkdir -p $APPF

cp $STHOME/ScanTailor.icns $APPR
cp scantailor_*.qm $APPR
cp scantailor $APPM/ScanTailor

stver=`cat version.h | grep 'VERSION "' | cut -d ' ' -f 3 | tr -d '"'`
cat $STHOME/Info.plist.in | sed "s/@VERSION@/$stver/" >  $APPC/Info.plist

otool -L $APPM/ScanTailor | tail -n +2 | tr -d '\t' | cut -f 1 -d ' ' | while read line; do
  case $line in
    $BUILDDIR/*)
      ourlib=`basename $line`
      cp $line $APPF >/dev/null 2>&1
      install_name_tool -change $line @executable_path/../Frameworks/$ourlib $APPM/ScanTailor
      install_name_tool -id @executable_path/../Frameworks/$ourlib $APPF/$ourlib
      ;;
    esac
done

# libtiff has a dependency on libjpeg, or can depending on how it is built
[ -e $APPF/libtiff.3.dylib ] && install_name_tool -change /usr/local/lib/libjpeg.8.dylib @executable_path/../Frameworks/libjpeg.8.dylib $APPF/libtiff.3.dylib

rm -rf ScanTailor.dmg ScanTailor-$stver.dmg
macdeployqt ScanTailor.app -dmg
mv ScanTailor.dmg ScanTailor-$stver.dmg
user-config.jam:

Code: Select all

using darwin : 4.0 : g++-4.0 ;
buildscantailor.sh:

Code: Select all

#!/bin/bash

export STHOME=/usr/local/src/scantailor
export BUILDDIR=$STHOME/build
export CMAKE_PREFIX_PATH=$BUILDDIR
export CMAKE_INCLUDE_PATH=$BUILDDIR
export CMAKE_LIBRARY_PATH=$BUILDDIR
export CMAKE_INSTALL_PREFIX=$BUILDDIR
mkdir -p $BUILDDIR

export CC=gcc-4.0
export CPP=cpp-4.0
export CXX=g++-4.0
export LD=g++-4.0

export MAC_OS_X_VERSION_MIN_REQUIRED=10.4
export MACOSX_DEPLOYMENT_TARGET=10.4
export MYCFLAGS="-m32 -arch i386 -arch x86_64 -arch ppc -mmacosx-version-min=10.4"
export MYLDFLAGS="-m32 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
export BOOST_ROOT=/usr/local/src/scantailor/boost_1_43_0

# LIBTIFF
curl -O "http://download.osgeo.org/libtiff/tiff-3.9.4.tar.gz"
tar xzvvf tiff-3.9.4.tar.gz
cd tiff-3.9.4
make clean
env CFLAGS="$MYCFLAGS" CXXFLAGS="$MYCFLAGS" LDFLAGS="$MYLDFLAGS" ./configure --prefix=$BUILDDIR --disable-dependency-tracking --enable-shared --enable-static
make
make install
cd $STHOME

# LIBJPG
curl -O "http://www.ijg.org/files/jpegsrc.v8b.tar.gz"
tar xzvvf jpegsrc.v8b.tar.gz
cd jpeg-8b
make clean
env CFLAGS="$MYCFLAGS" CXXFLAGS="$MYCFLAGS" LDFLAGS="$MYLDFLAGS" ./configure --prefix=$BUILDDIR --disable-dependency-tracking --enable-shared --enable-static
make
make install
cd $STHOME

# LIBPNG
curl -O "ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.4.3.tar.gz"
tar xzvvf libpng-1.4.3.tar.gz
cd libpng-1.4.3
make clean
env CFLAGS="$MYCFLAGS" CXXFLAGS="$MYCFLAGS" LDFLAGS="$MYLDFLAGS" ./configure --prefix=$BUILDDIR --disable-dependency-tracking --enable-shared --enable-static
make
make install
cd $STHOME


# BOOST
curl -L -o  boost_1_43_0.tar.gz "http://sourceforge.net/projects/boost/files/boost/1.43.0/boost_1_43_0.tar.gz/download"
tar xzvvf boost_1_43_0.tar.gz
cd boost_1_43_0
make clean
./bootstrap.sh --prefix=$BUILDDIR --with-libraries=test,system,signals
# ./bjam --prefix=$BUILDDIR --user-config=$STHOME/user-config.jam --toolset=darwin-4.0 --build-dir=$BUILDDIR --with-test --with-system --with-signals link=static runtime-link=static architecture=combined address-model=32_64 macosx-version=10.4 macosx-version-min=10.4 install
./bjam --toolset=darwin-4.0 --prefix=$BUILDDIR --user-config=$STHOME/user-config.jam --build-dir=$BUILDDIR --with-test --with-system --with-signals link=static runtime-link=static architecture=combined address-model=32 macosx-version=10.4 macosx-version-min=10.4 --debug-configuration install
export BOOST_ROOT=`pwd` install
cd $STHOME

# SCANTAILOR
curl -o scantailor.tar.gz -L "http://scantailor.git.sourceforge.net/git/gitweb.cgi?p=scantailor/scantailor;a=snapshot;h=5cdf6456a849c831b218bcaa608babc522674ad1;sf=tgz"
tar xzvvf scantailor.tar.gz
cd scantailor
make clean
rm CMakeCache.txt
# These edis are needed for the boost library version we are using
sed -i '.old' -e '1,$ s/^#include <boost/test/auto_unit_test\.hpp>/#include <boost/test/included/unit_test.hpp>/g' imageproc/tests/main.cpp
sed -i '.old' -e '1,$ s/^#include <boost/test/auto_unit_test\.hpp>/#include <boost/test/included/unit_test.hpp>/g' tests/main.cpp
ccmake -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_OSX_ARCHITECTURES="ppc;i386" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.4" -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.4u.sdk" -DPNG_INCLUDE_DIR=$BUILDDIR .
make
../makeapp.sh
cd $STHOME
And, after you've saved the "buildscantailor.sh" and "makeapp.sh" files, you need to make them "executable":

Code: Select all

chmod +rx buildscantailor.sh makeapp.sh
Then just run the main build script:

Code: Select all

./buildscantailor.sh
Anyway, that's the rough guide. Feel free to improve it.

Re: Building Scan Tailor on OSX

Posted: 29 Jul 2010, 20:29
by knappen
Absolutely fabbo news. Thanks so much for making this.

The program crashed when I tried to make it work on a folder with mixed jpg/png images and the same thing occurred when I tried to edit in the mixed mode, but when tailoring from a straight jpg folder and choosing b/w only, it really worked like a dream. I'd say the whole process went a bit faster than I'm used to when doing this on a pc.