[MPICH2-dev] MPICH2 cross compilation help

Brad Penoff penoff at cs.ubc.ca
Fri Feb 23 22:47:23 CST 2007


hey all,

Just a quick update.  Long story short, I got MPICH2 ch3:sock to cross 
compile to alpha but in the process I think I found a handful of 
bugs/strangeness.  Read on if you're interested.

---------
--disable-sharedlibs
---------

The original error reported in this email thread has nothing to do with 
cross compiling.  I saw it break in the same way when using a "normal" 
native gcc.  It seems that using --disable-sharedlibs breaks the build. 
For example the following configure succeeds but the make afterwards fails 
exactly as originally reported:

./configure --disable-f77 --disable-f90 --disable-sharedlibs --disable-cxx

So that aside, and back to my cross compilation scenario, I did the same 
series of environment variable settings and did the exact same configure 
minus the --disable-sharedlibs part.  The configure succeeded and the 
build made it further, but failed eventually.  I'll walk from this error 
onward saying how I overcame it and what I suspect may be buggy code, 
but it's in narrative form (one leads to the next).


---------------
mpid_type_create_pairtype.c
---------------

Specifically, line 210 of mpid_type_create_pairtype.c complains of an 
undefined variable HAVE_MAX_FP_ALIGNMENT.  This error is below my name on 
this email.  Should 209 be
#elif defined(HAVE_MAX_FP_ALIGNMENT)
rather than
#else
?
Making this change allows me to compile this file.

------------
ad_wait.c
------------

I did this mpid_type_create_pairtype.c edit and my cross compilation made 
it further but failed in romio inside ad_wait.c for seemingly several 
reasons:
1) line 62 for `tmp1' undeclared.  This would mean that 
ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS and ROMIO_HAVE_WORKING_AIO were set but 
ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE was not.

2) Once I changed line 44 to the following so tmp1 was declared:
#if defined(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE) || defined(ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS)
... then it complained about these:
ad_wait.c:59: warning: passing arg 1 of `aio_suspend' makes pointer from 
integer without a cast
ad_wait.c:59: warning: passing arg 2 of `aio_suspend' makes integer from 
pointer without a cast
ad_wait.c:59: error: too few arguments to function `aio_suspend'
ad_wait.c:64: error: structure has no member named `aio_handle'
ad_wait.c:66: error: structure has no member named `aio_handle'

This led me to believe that ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS was set when 
it shouldn't have been.  This makes #1 somewhat irrelevant (only that 
block uses tmp1).  Once the code makes it into the ROMIO_HAVE_WORKING_AIO 
block, I think we want it to *not* compile the 
ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS code.  I therefore changed line 55 from
#ifdef ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS
to
#if 0
.

It made it past THAT and a little bit further.  This solved my problem for 
now, but might not be general enough to solve others'.  I guess the 
general point is that ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS was set and 
aio_suspend in my setting needed more than 2 args.  Any ideas why?

----------------
ad_nfs_wait.c
----------------
The next issue was in ad_nfs_wait.c ; these were nearly identical to those 
in ad_wait.c except different line numbers (the code appeared copied). So, 
to repeat, I changed line 15 to
#if defined(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE) || defined(ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS)
and line 25 to
#if 0
.  Actually for both files, if you have the #if 0, you don't need to 
change the #ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE line.

---

After these minor changes, I was able to cross compile MPICH2 1.0.5p3 
ch3:sock for alpha.  I actually haven't tried to run it yet (I'm sure 
you'll hear from me if not ;-), just I thought I'd bring these 4 issues to 
your attention.

Thanks,
brad


<snip snip>
...
/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-gcc 
-DHAVE_CONFIG_H -I. -I. -I. -I../../../include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/datatype 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/datatype 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock/poll 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock/poll -c 
mpid_type_get_contents.c
/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-gcc 
-DHAVE_CONFIG_H -I. -I. -I. -I../../../include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/datatype 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/datatype 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock/poll 
-I/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/sock/poll -c 
mpid_type_create_pairtype.c
mpid_type_create_pairtype.c: In function `MPID_Type_create_pairtype':
mpid_type_create_pairtype.c:210: error: `HAVE_MAX_FP_ALIGNMENT' undeclared 
(first use in this function)
mpid_type_create_pairtype.c:210: error: (Each undeclared identifier is 
reported only once
mpid_type_create_pairtype.c:210: error: for each function it appears in.)
make[4]: *** [mpid_type_create_pairtype.o] Error 1
make[4]: Leaving directory 
`/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common/datatype'
make[3]: *** [all-redirect] Error 2
make[3]: Leaving directory 
`/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid/common'
make[2]: *** [all-redirect] Error 2
make[2]: Leaving directory 
`/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src/mpid'
make[1]: *** [all-redirect] Error 2
make[1]: Leaving directory `/var/tmp/brad/m5/tmp/tmp2/mpich2-1.0.5p3/src'
make: *** [all-redirect] Error 2


On Fri, 23 Feb 2007, Brad Penoff wrote:

> Greetings,
>
> I'm trying to use a series of cross tools to build alpha binaries on an i686 
> machine.  We have access to some simulation tools that run real kernels and 
> binaries, but they must be in alpha.  I don't have access to a real alpha 
> machine so it is my only choice to cross compile.  I know that the cross 
> tools work as I can already boot the Linux kernel, run python, use ssh, and 
> even run my own simple applications.  In fact, I was able to run the 
> maint/getcross.c file to produce a getcross.out text file to feed into 
> --with-cross.
>
> The main problem is that I can't get MPICH2 to build.  This is my first time 
> cross compiling something other than the Linux kernel and simple apps, but I 
> haven't been able to find much documentation on cross compiling MPICH2; I 
> figured I'd ask this list for some advice.
>
> The steps I did was try to point all standard tools to use the cross tools. 
> I did this as follows (in bash):
> export 
> CC=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-gcc
> export 
> AR=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-ar
> export 
> RANLIB=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-ranlib
> export 
> AS=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-as
> export 
> LD=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-ld
> export 
> NM=/var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-nm
>
>
> Once this was done, I ran MPICH2 1.0.5p3's configure successfully in the 
> following way:
>
> ./configure --disable-f77 --disable-f90 --disable-sharedlibs 
> --prefix=/var/tmp/brad/m5/mpich2/ch3_sock --build=i686-pc-linux-gnu 
> --host=alpha-unknown-linux-gnu --disable-cxx
>
> The arch names are following the format of strings generated by 
> "config.guess"
>
> The configure completes but the make fails miserably thereafter.  I've 
> included the relevant portion of the output below.  Why is it that sometimes 
> the cross compiler (CC) is used but other times it simply tries to use 
> "true"?  The generated Makefile has C_LINK_SHL equal to "true" so either I'm 
> doing something wrong with my configure command or something funny is going 
> on... any advice with my cross compiling nightmare?
>
> Thanks ahead of time,
> brad
>
> <snip snip>
> ...
> make[7]: Entering directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll'
> /var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-gcc 
> -DHAVE_CONFIG_H -I. 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll 
> -I../../../../include -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/datatype 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/datatype 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll -c sock.c
> /var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-ar 
> cr ../../../../../lib/libmpich.a sock.o
> /var/tmp/brad/crosstool/gcc-3.4.3-glibc-2.3.5/alpha-unknown-linux-gnu/bin/alpha-unknown-linux-gnu-ranlib 
> ../../../../../lib/libmpich.a
> date > .libstamp0
> make[8]: Entering directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll'
> true -DHAVE_CONFIG_H -I. 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll 
> -I../../../../include -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/datatype 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/datatype 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels/sock/include 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll 
> -I/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll -c sock.c -o 
> _ssock.o
> mv: cannot stat `_ssock.o': No such file or directory
> make[8]: *** [sock.lo] Error 1
> make[8]: Leaving directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll'
> make[7]: *** [all-redirect] Error 2
> make[7]: Leaving directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock/poll'
> make[6]: *** [all-redirect] Error 1
> make[6]: Leaving directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/common/sock'
> make[5]: *** [all-redirect] Error 2
> make[5]: Leaving directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels/sock'
> make[4]: *** [all-redirect] Error 1
> make[4]: Leaving directory 
> `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3/channels'
> make[3]: *** [all-redirect] Error 2
> make[3]: Leaving directory `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid/ch3'
> make[2]: *** [all-redirect] Error 1
> make[2]: Leaving directory `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src/mpid'
> make[1]: *** [all-redirect] Error 2
> make[1]: Leaving directory `/var/tmp/brad/m5/tmp/mpich2-1.0.5p3/src'
> make: *** [all-redirect] Error 2
>




More information about the mpich2-dev mailing list