[mpich-discuss] Compile error with "undefined reference"

Anthony Chan chan at mcs.anl.gov
Mon Jun 20 09:04:24 CDT 2011


The libraries seem to be built OK (compiled by mpif90). But your program is still
linked by ifort (from bldit.cctm_errorlog_whole110617.txt), the link command that
caused unresolved symbols is

/opt/intel/composerxe-2011.4.191/bin/intel64/ifort -liomp5 -lpthread VGRD_DEFN.o CGRID_SPCS.o HGRD_DEFN.o GRID_CONF.o PCGRID_DEFN.o STD_CONC.o AVG_CONC.o WVEL_DEFN.o PMEM_DEFN.o BIOG_EMIS.o BEIS_DEFN.o DEPVVARS.o DEPV_DEFN.o UDTYPES.o STK_EMIS.o STK_PRMS.o PTMAP.o PTBILIN.o PTMET.o PT3D_DEFN.o AERO_EMIS.o EMIS_DEFN.o VDIFF_MAP.o hrdata_mod.o AERO_INFO.o SOA_NEWT.o PAGRD_DEFN.o advstep.o driver.o hcontvel.o hveloc.o sciproc.o wr_aconc.o wr_cgrid.o wr_conc.o distr_env.o par_init.o par_term.o diffmsg.o flcheck.o grdcheck.o initscen.o load_cgrid.o opconc.o setup_logdev.o couple.o ppmv_msmr.o advbc_map.o hadvyppm.o hppm.o rdbcon.o x_ppm.o x_yamo.o y_ppm.o y_yamo.o zfdbc.o vppm.o zadvyppm.o deform.o hcdiff3d.o hdiff.o rho_j.o beis3.o cgrid_depv.o checkmem.o chkgrid.o conv_cgrid.o czangle.o delta_zs.o eddyx.o fire_plmris.o gas_depv_map.o getfline.o getparb.o hrno.o m3dry.o matrix.o opddep.o opdepv_diag.o opemis.o openlayout.o opmet.o oppt3d_diag.o opssemis.o parsline.o plmris.o plsprd.o preplm.o rddepv.o rdmet.o ssemis.o tmpbeis.o tri.o ungridb2.o vdiffacm2.o wrdaymsg.o write3_distr.o phot.o hrcalcks.o hrdriver.o hrg1.o hrg2.o hrg3.o hrg4.o hrinit.o hrprodloss.o hrrates.o hrsolver.o aero_driver.o aero_subs.o hetchem.o isocom.o isofwd.o isorev.o opdiam.o opvis.o orgaer5.o aero_depv.o acmcld.o aq_map.o aqchem.o cldproc_acm.o convcld_acm.o getalpha.o hlconst.o indexn.o rescld.o scavwdep.o set_aeconcmin.o pa_init.o pa_irr.o pa_irr_ctl.o pa_mkhdr.o pa_output.o pa_update.o cksummer.o findex.o get_envlist.o lstepf.o subhdomain.o subhfile.o  -L/home/jesc/cmaqv4.7.1/lib/stenex/Linux2_x86_64 -lse_snl -L/home/jesc/cmaqv4.7.1/lib/pario/Linux2_x86_64 -lpario  -L/usr/local/mpich2-1.4/lib -lmpich -L/home/jesc/cmaqv4.7.1/lib/ioapi/Linux2_x86ifc -lioapi -L/home/jesc/cmaqv4.7.1/lib/netCDF/Linux2_x86_64ifort -lnetcdf -o CCTM_e1a_Linux2_x86_64intel

Notice that you only linked with -lmpich with ifort.  You need to use mpif90 instead.

A.Chan


----- Original Message -----
> Thank you very much for your consideration, Mr. Chan.
> 
> I attach below the whole log file generated when the build script of
> my
> program was run ("bldit.cctm_errorlog_whole110617.txt"), as well as
> the log
> files of the required libraries ("bldit.se.log.txt" and
> "bldit.pario.log.txt"). If you need any other information, please ask
> me.
> 
> Kind regards,
> 
> Tetsuro
> 
> (See attached file: bldit.cctm_errorlog_whole110617.txt)(See attached
> file:
> bldit.se.log.txt)(See attached file: bldit.pario.log.txt)
> 
> 
> 
> 
> 
> Since we don't have your source code, so looking your build scripts
> isn't
> easy for us to spot the errors. Given you are still getting unresolved
> reference
> of MPICH2's internal symbols, my guess is that your linking is still
> wrong.
> Could you send us the output of your Makefiles (as seen on your
> terminal)
> which
> could be easier for us to spot the errors.
> 
> A.Chan
> 
> ----- Original Message -----
> > 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&param).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&param).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
> >
> >
> >
> >
> > _______________________________________________
> > 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
> 
> 
> 
> 
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list