[parsec-users] Compiling Parsec for i386

Joseph Greathouse jlgreath at umich.edu
Sat Jan 22 22:35:28 EST 2011

On 1/22/2011 2:43 PM, Binh Q. Pham wrote:
> Hi,
> I want to compile Parsec on my host machine, which is 64 bits; and run
> Parsec on my target machine, which is 32 bits. In order to do this, I
> have added -m32 to CFLAGS and CXXFLAGS in gcc.bldconf:
> {snip}
> I really appreciate if someone can help me with this, or suggest me
> another way to do this.
> Thank you,
> Binh

Here are the directions I use to build 32-bit PARSEC binaries on 64-bit 
versions of Fedora/RHEL.  I don't guarantee that these are the most 
efficient directions for getting everything to compile properly, but 
they work for me.

Note that I temporarily replace 'uname', which requires root access. 
There were a number of scripts (I don't remember which ones) that use 
uname to detect the architecture. If it returns x86_64, these scripts 
will always attempt to compile the 64-bit versions of libraries (or 
whatever).  If you don't have root access, you'll have to find where 
these checks are and replace them yourself. :)

1. Modify the GCC build config:
   * Open ./config/gcc.bldconf
   * Change CC_HOME="/n/fs/parsec/local/gcc-4.4.0-static" to CC_HOME="/usr"
   * Change BINUTIL_HOME="/usr/local" to BINUTIL_HOME="/usr"
   * Make sure GNUTOOL_HOME is set to ="/usr"
   * Make sure BINARY_PREFIX is set to =""
   * Add in 'export INCLUDES="-m32"'
   * Remove '-L${CC_HOME}/lib64' from LDFLAGS
2. Change the environment variable HOSTTYPE to i386
   * In bash: 'HOSTTYPE=i386' 'export HOSTTYPE'
   * In csh: 'setenv HOSTTYPE i386'
3. Make sure /usr/lib/libXmu.so and /usr/lib/libX11.so exist. If they don't:
   * 'ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so'
   * 'ln -s /usr/lib/libX11.so.6 /usr/lib/libX11.so'
4. Make a copy of uname
   * 'sudo mv /bin/uname /bin/uname.orig'
5. Make a wrapper shell script to make uname return i686 instaed of x86_64:
   * Open a new file /bin/uname and add in:
         /bin/uname.orig $* | sed 's/x86_64/i686/g'
   * 'sudo chmod a+x uname'
6. Change ./pkgs/apps/facesim/src/TaskQ/lib/Makefile 'CXXARGS' to 'CXXFLAGS'
7. Modify ./pkgs/libs/ssl/src/Configure.pl
   * Add '$cflags .= " -m32 ";' to line 976 (below the big list of "my" 
variable declarations.
8. Change ./pkgs/libs/mesa/src/configure line 4685 to 'asm_arch=x86'
9. Change ./pkgs/libs/glib/src/configure line 40390 to 'G_ATOMIC_I486'
10. Run compilation
   * ./bin/parsecmgmt -a build -p all -c gcc
   * Note that you'll need to do "./bin/parsecmgmt -a build -p freqmine 
-c gcc-openmp" if you want freqmine to compile, as it doesn't use pthreads.
11. Return the original uname
   * 'sudo mv /bin/uname.orig /bin/uname'

Good luck!

Joseph Lee Greathouse
Ph.D. Candidate
Electrical Engineering and Computer Science, University of Michigan

More information about the parsec-users mailing list