[mpich-discuss] Compile error with "undefined reference"
tetsuro_kikuchi at jesc.or.jp
tetsuro_kikuchi at jesc.or.jp
Fri Jun 17 01:01:13 CDT 2011
Thank you very much for your advice, Mr. Dave Goodell.
I have tried again to build my program. I used the latest version of MPICH2
(mpich2-1.4) this time. I have configured it as follows to let the compiler
flags being included in the wrappers (the configure log
("c_mpich2-1.4.txt") is attached below):
./configure --disable-fast CFLAGS=-O2 FFLAGS=-O2 CXXFLAGS=-O2 FCFLAGS=-O2
My program, called "CCTM", uses two kinds of library for parallel
processing (named "STENEX" and "PARIO"). These libraries are compiled using
the wrapper of MPICH (mpif90). (Please refer to the part "#> Set full path
of Fortran 90 compiler" in "User Input Section" of the attached compile
scripts for these libraries ("bldit.se_script.txt" and
"bldit.pario_script.txt").)
I run the build script of CCTM after recompiling the two above-mentioned
libraries using the new MPICH wrapper. However, it failed again with
messages "undefined reference to '...'". The C source codes for which
"undefined reference" errors were annouced were a little bit different from
the previous ones. The error part of the build log
("bldit.cctm_errorlog110617.txt") is attached below.
Then, I assembled the working compile line of the build script by using
"mpif90 -show". (Please refer to "mpif90 -show.txt" attached below.) The
modified build script ("bldit.cctm_script_modified110617.txt") is also
attached below. The modifications in the build script I made were as
follows (all in "User Input Section"):
1. "-lopa -lmpl -lrt" was added to "LINK_FLAGS".
2. "-O2" was added to "C_FLAGS".
3. The line "set FC_FLAGS = "-O2"" was added.
This build script could not also build the executable of CCTM with the same
error messages as the first trial this time.
Could you provide the suggestion for solving this problem?
Kind regards,
Tetsuro
(See attached file: c_mpich2-1.4.txt) (See attached file:
bldit.se_script.txt)(See attached file: bldit.pario_script.txt)(See
attached file: bldit.cctm_errorlog110617.txt)(See attached file: mpif90
-show.txt)(See attached file: bldit.cctm_script_modified110617.txt)
How are you building your application? Based on skimming the error
messages it looks like you are not using the compiler wrappers ("mpicc" and
friends) and are instead attempting to link with the libmpich directly.
If this is the case, that will not work unless you are very careful.
MPICH2 uses several libraries internally and they must all be present and
listed on the link line in the correct order. My recommendation is to use
the compiler wrappers. If you can't or won't do that for some reason, you
can try to assemble a working compile line for yourself by using "mpicc
-show" to show the compile/link flags that you will need to use.
-Dave
On Jun 16, 2011, at 2:26 AM CDT, tetsuro_kikuchi at jesc.or.jp wrote:
> Hello.
>
> I'm trying to compile an executable of a program using MPICH2 (version:
> 1.3.2p1). However, it failed with messages "undefined reference to
'...'".
> The error part of the compile log ("bldit.cctm_errorlog110616.txt") is
> attached below. Could anyone teach me what is wrong and how to solve this
> problem?
> My system uses Ubuntu Linux (version 11.04 (64-bit)) as OS and Intel
> Fortran Composer XE 2011 for Linux as compiler. I also attach the
configure
> log of MPICH2 ("c.txt") and a set of the related C source codes to this
> error ("initthread.c", "param_vals.c", "mpid_vc.c", "init.c" and
> "tcp_init.c") below.
>
> Tetsuro
>
> (See attached file: bldit.cctm_errorlog110616.txt)(See attached file:
> c.txt)(See attached file: initthread.c(mpich2-1.3.2p1&src&mpi&init).txt)
> (See attached file: param_vals.c(mpich2-1.3.2p1&src&util¶m).txt)(See
> attached file: mpid_vc.c(mpich2-1.3.2p1&src&mpid&ch3&src).txt)(See
attached
> file: init.c(mpich2-1.3.2p1&src&mpi&init).txt)(See attached file:
>
tcp_init.c(mpich2-1.3.2p1&src&mpid&ch3&channels&nemesis&nemesis&netmod&tcp).txt)
>
<bldit.cctm_errorlog110616.txt><c.txt><initthread.c(mpich2-1.3.2p1&src&mpi&init).txt><param_vals.c(mpich2-1.3.2p1&src&util¶m).txt><mpid_vc.c(mpich2-1.3.2p1&src&mpid&ch3&src).txt><init.c(mpich2-1.3.2p1&src&mpi&init).txt><tcp_init.c(mpich2-1.3.2p1&src&mpid&ch3&channels&nemesis&nemesis&netmod&tcp
).txt>_______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
_______________________________________________
mpich-discuss mailing list
mpich-discuss at mcs.anl.gov
https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c_mpich2-1.4.txt
Type: application/octet-stream
Size: 137872 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bldit.se_script.txt
Type: application/octet-stream
Size: 4482 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0007.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bldit.pario_script.txt
Type: application/octet-stream
Size: 4254 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bldit.cctm_errorlog110617.txt
Type: application/octet-stream
Size: 3518 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpif90 -show.txt
Type: application/octet-stream
Size: 176 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bldit.cctm_script_modified110617.txt
Type: application/octet-stream
Size: 23126 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110617/934a7cb7/attachment-0011.obj>
More information about the mpich-discuss
mailing list