Questions about "undefined reference to" errors

130 views
Skip to first unread message

庄震亚

unread,
Dec 15, 2013, 9:07:11 AM12/15/13
to pencil-co...@googlegroups.com

Dear all,

I've got some problems when I use "pc_build" to compile the code in the sample cylinder_deposition with MPI. The code generated a bunch of"undefined reference to" errors. A part of the output is below:

In make[2]: function*** Waiting for unfinished jobs....
 `PMPI_Info_get':
info_get.c:(.text+0x4f): undefined reference to `pthread_getspecific'
info_get.c:(.text+0x114): undefined reference to `pthread_getspecific'
info_get.c:(.text+0x34e): undefined reference to `pthread_setspecific'
info_get.c:(.text+0x373): undefined reference to `pthread_setspecific'
/usr/local/mpi/lib//libmpich.a(info_getn.o): In function `PMPI_Info_get_nkeys':
info_getn.c:(.text+0x3c): undefined reference to `pthread_getspecific'
info_getn.c:(.text+0xf2): undefined reference to `pthread_getspecific'
info_getn.c:(.text+0x285): undefined reference to `pthread_setspecific'
info_getn.c:(.text+0x2aa): undefined reference to `pthread_setspecific'
/usr/local/mpi/lib//libmpich.a(info_getnth.o): In function `PMPI_Info_get_nthkey':
info_getnth.c:(.text+0x3e): undefined reference to `pthread_getspecific'
info_getnth.c:(.text+0xf8): undefined reference to `pthread_getspecific'
info_getnth.c:(.text+0x29a): undefined reference to `pthread_setspecific'
info_getnth.c:(.text+0x2bf): undefined reference to `pthread_setspecific'
/usr/local/mpi/lib//libmpich.a(info_getvallen.o): In function `PMPI_Info_get_valuelen':
info_getvallen.c:(.text+0x4c): undefined reference to `pthread_getspecific'
info_getvallen.c:(.text+0x10c): undefined reference to `pthread_getspecific'
info_getvallen.c:(.text+0x346): undefined reference to `pthread_setspecific'
info_getvallen.c:(.text+0x36b): undefined reference to `pthread_setspecific'
collect2: error: ld returned 1 exit status
make[2]: *** [run.x] Error 1
make[2]: Leaving directory `/home/ht/pencil-code/samples/2d-tests/cylinder_deposition/src'
make[1]: *** [code] Error 2
make[1]: Leaving directory `/home/ht/pencil-code/samples/2d-tests/cylinder_deposition/src'
make: *** [default] Error 2
Make failed: <>

I thought maybe I set wrong flags in my ".conf" file in the pencil-code/config/hosts/, but I don't know which is wrong. The ".conf" file is below. And I installed the mpich2 in the '/usr/local/mpi/' directory.

#
# $Id: GNU_Linux.conf 19488 2012-09-04 14:00:20Z Bourdin.KIS $

%include compilers/GNU-GCC

%section Makefile
  FC_SLOPPY = gfortran -I/usr/include -I/usr/local/mpi/include -I.
  FC = $(FC_SLOPPY) -Wall -fbounds-check
  CFLAGS += -I/usr/lib/
  FFLAGS += -O3 -I/usr/include/ -I/usr/local/mpi/include
  FFLAGS_DOUBLE = -fdefault-real-8
  F77 = $(FC)
  MPI_LDLIBS= -lmpich
  LD_MPI = -L/usr/local/mpi/lib/ $(MPI_LDLIBS)
%endsection Makefile

%section runtime
  mpiexec=mpirun
%endsection runtime

# End of file

Any suggestions?

Thanks in advance.
Zhuang


--
Department of Energy Engineering, Zhejiang University, P.R. China
State Key Laboratory of Clean Energy Utilization
Institute for Thermal Power Engineering

Philippe-A. Bourdin

unread,
Dec 15, 2013, 9:34:58 AM12/15/13
to pencil-co...@googlegroups.com

Dear Zhuang,

as I see, you are working on a Linux derivative.
In principle, that is all fine, but I don't understand, why you want to
configure everything by yourself in a .conf file.

Instead, you could (and should) only two packages: "GCC" and e.g. the
"openmpi" package as MPI library. (I didn't test "mpich2", but that
might also work.) After that, your .conf file should look like this, see
pencil-code/config/hosts/mps/host-Bourdin-SLM0-GNU_Linux-Ubuntu.conf:

=========================================
# host-Bourdin-SLM0-GNU_Linux-Ubuntu.conf
#
# ubuntu desktop
#
# $Id$

%include compilers/GNU-GCC_MPI

%section Makefile
MAKE_VAR1 = -j4
FFLAGS += -O3 -Wall -fbounds-check -finit-real=nan
-ffpe-trap=invalid,zero,overflow,underflow,denormal -g -fbacktrace
%endsection Makefile

%section runtime
mpiexec = mpirun
%endsection runtime
=========================================

Where you can skip the "Makefile" part, maybe even the "runtime" part.
The latter I didn't check.

Please note: if you install standard components, one include is enough.

I btw. see many people trying to get complicated .conf files right, even
some long-experienced Pencil users... Please everyone check the
compiler-suite based .conf files, they pretty much work out-of-the-box.

Thanks and best regards,

Philippe.


庄震亚

unread,
Dec 15, 2013, 9:02:43 PM12/15/13
to pencil-co...@googlegroups.com
Dear Philippe,

Thanks for your help.

I'm a beginner on makefile and I was just trying to figure out how to configure the flags for a given machine. That's why I almost configure everything by myself, which causes a lot of problems.

I will modify my ".conf" file and see what will happen:-)

Best regards,
Zhuang


2013/12/15 Philippe-A. Bourdin <Bou...@kis.uni-freiburg.de>


--
You received this message because you are subscribed to the Google Groups "pencil-code-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pencil-code-dis...@googlegroups.com.
To post to this group, send email to pencil-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/pencil-code-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Philippe-A. Bourdin

unread,
Dec 15, 2013, 9:14:06 PM12/15/13
to pencil-co...@googlegroups.com

Dear Zhuang,

as you are a beginner, you might want to get started quickly.
Therefore, I would recommend to use a pre-configured (and "clean") .conf
file like the mentioned one ("host-Bourdin-SLM0-GNU_Linux-Ubuntu.conf").

>From there, the only thing you really need to change are the FFLAGS.
Please also note, that you only append to FFLAGS with the "+=" operator.

If you want to get the details, please look into the included file(s),
like "pencil-code/config/compilers/GNU-GCC_MPI.conf" for MPI support.

Thanks and best regards - welcome aboard! :-)

Philippe.


zhenyazhuang

unread,
Dec 15, 2013, 10:00:21 PM12/15/13
to pencil-code-discuss
Dear Philippe,
 
Thank you for your advice. I really appreciate your help.
 
Best regards,
Zhuang
 
2013-12-16

zhenyazhuang

发件人:"Philippe-A. Bourdin" <Bou...@KIS.Uni-Freiburg.de>
发送时间:2013-12-16 10:14
主题:Re: Questions about "undefined reference to" errors
收件人:"pencil-code-discuss"<pencil-co...@googlegroups.com>
抄送:
 
Reply all
Reply to author
Forward
0 new messages