Skip to main content
University of Glasgow
A-Z : ACADEMIC DEPARTMENTS | SERVICES | STAFF |
Faculty of Information and Mathematical Systems > Department of Computing Science

Languages and Machines

2009-12-07

Building SystemC-2.2 on Snow Leopard

Upgrading to Snow Leopard on my MacBook Pro broke my SystemC builds. The reason is that Snow Leopard is by default a 64-bit OS, and the build tools default to 64 bits. But SystemC only works in 32-bit mode. The solution is simple enough, just add the following flag to your compilation and link commands:

-arch i386

I use SCons to build my SystemC apps, so I added this flag to CXXFLAGS and LINKFLAGS.

If you upgraded from Leopard and did not rebuild SystemC itself, that's it.

Building SystemC itself is slightly more complicated: running configure results in an error: cannot not guess build type. To fix that, specify --build=i386-pc-macosx. However, the build will then fail on the line

as -o qtmds.o qtmds.s -I. \ 
-I../../../../src/sysc/qt -I../../../../src

The QuickThreads library uses an assembly file i386.s but the assember assumes its x86_64. To fix this, you have to pass the arch flag to the assembler. To do so, the best way is to edit configure.in. Look for i386-pc-macosx and add the -arch i386 flags as follows:

--- configure.in.ORIG   2008-11-05 10:43:46.000000000 +0000
+++ configure.in    2009-12-06 11:21:10.000000000 +0000
@@ -148,7 +148,7 @@
     i386-pc-macosx*)
         case "$CXX_COMP" in
             c++ | g++)
-                EXTRA_CXXFLAGS="-Wall"
+                EXTRA_CXXFLAGS="-Wall -arch i386"
                 DEBUG_CXXFLAGS="-g"
                 OPT_CXXFLAGS="-O3"
                 TARGET_ARCH="macosx"
@@ -159,7 +159,7 @@
                 AC_MSG_ERROR("sorry...compiler not supported")
        ;;
         esac
-   AS="as"
+   AS="as -arch i386"
         QT_ARCH="iX86"
         ;;

Now run autoconf to generate a new configure file. Run configure in objdir:

../configure --build=i386-pc-macosx

I verified the build with make check and it passes all tests.

Leave a comment...

powered by Blosxom