Setting up a core development environment on Macintosh Snow Leopard 64-bit

[Original blog post by Shane Steinkamp - 09/08/2015]

It took me some time to work out the details for creating a viable development environment on Snow Leopard, and I thought my notes might be useful to others. This is the quick and dirty version.

Macintosh Snow Leopard 64 Bit Development Environment

1. Install Xcode.

Xcode includes Subversion command line tools, but you'll have to download and install RapidSVN if you use it.

2. Download, configure, and install PostgreSQL. Version 8.2.15 was used in this example.

3. Create a folder called \opt\postgresql\source and extract the files there.

4. Create a second folder called \opt\postgresql\psql . This is where we will build.

5. While you are at it, create a folder called \opt\qt and \opt\xtuple as well.

6. Open a terminal window and issue the following commands:

cd \opt\postgresql\source
sudu -s

CFLAGS="-arch x86_64" LDFLAGS="-ltcl" ./configure --with-krb5 --with-pam --with-ldap --with-openssl --with-readline --with-bonjour --prefix=/opt/postgresql/psql
make
make check
cd contrib/pgcrypto
make
cd ../..
make install
cd contrib/pgcrypto
make install

PostgreSQL is now configured and installed. Close the terminal window.

7. Create .bash_profile file at user root ~/

The contents of this file will set the PATH. The contents are:

#**** BEGIN .bash_profile *****

# Add to the original path

PATH=/opt/postgresql/psql/bin:$PATH
PATH=/opt/postgresql/psql/lib:$PATH
PATH=/opt/postgresql/psql/include:$PATH
PATH=/opt/qt/bin:$PATH
PATH=/opt/qt/lib:$PATH
export PATH

#**** END .bash_profile *****

8. Download QT SDK 

9. Extract the file to the /opt/qt/ directory.

10. Open terminal window and issue the following commands:

cd /opt/qt/qt-everywhere-opensouce-src-4.6.2
sudo -s

CFLAGS="-arch x86_64" LDFLAGS="-ltcl" ./configure -prefix-install -prefix /opt/qt -platform macx-g++-64 -plugin-sql-psql -plugin-sql-odbc -plugin-sql-sqlite -qt3support -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-framework -I/opt/postgresql/psql/include -L/opt/postgresql/psql/lib 

make
make -j1 install

Qt is now installed. Close terminal window.

11. Download OpenRPT and PostBooks source through SVN into the \opt\xtuple folder.

12. Open terminal window and issue the following commands:

cd \opt\xtuple\openrpt
sudo -s

qmake
make

cd \opt\xtuple\postbooks
qmake
make

13. When the process completes, in order to run the applications, you will need to include certain resources in the .app file. To do this, open Finder and locate

opt\xtuple\openrpt\bin\openrpt.app.

14. Right click on the application and select SHOW PACKAGE CONTENTS.

15. Browse to /Contents/Resources.

16. Open another finder window and browse to /opt/qt/qt-everywhere-opensource-src-4.6.2/src/gui/mac and copy the three objects (1 folder, 2 files) from that location into the /Contents/Resources folder. 

17. Copy these three objects also into the /Contents/Resources folder of all the .app files in /opt/xtuple/openrpt/bin/ and /opt/xtuple/postbooks/bin/xtuple.app as well. 

The applications should now work.

Oddball tip

If you get an error that looks like this: 

ISO C++ says that these are ambiguous, even
though the worst conversion for the first is
better than the worst conversion for the second:

during the build, it's probably caused by \opt\xtuple\openrpt\openrpt\wrtembed\fontutils.cpp. Open it and find the code that looks like this:

void setItemFontSize(QGraphicsItem *gi, const QString s)
{
int size = s.toInt();
if(s<=0)
return;

QFont font = getItemFont(gi);
font.setPointSize(size);
setItemFont(gi, font);
}

and change the if statement to read:

if(size<=0)

and rebuild.