[Dune] Problems with linking an external library
Sacconi, Andrea
a.sacconi11 at imperial.ac.uk
Mon Sep 15 21:15:28 CEST 2014
Hi Bernd,
thanks for your answer, but unfortunately it is still not working.
I changed the Makefile.am to be:
dune_LDLtest_LDADD = \
$(DUNE_LDFLAGS) $(DUNE_LIBS) \
$(ALUGRID_LDFLAGS) $(ALUGRID_LIBS) \
$(ALBERTA_LDFLAGS) $(ALBERTA_LIBS) \
$(AMIRAMESH_LDFLAGS) $(AMIRAMESH_LIBS) \
$(UG_LDFLAGS) $(UG_LIBS) \
$(DUNEMPILIBS) \
$(UMFPACK_LDFLAGS) \
$(LDADD) \
-L/usr/local_machine/suitesparse-4.2.1/lib \
-lldl -lamd -lrt -lblas -lgfortran -lm
dune_LDLtest_LDFLAGS = $(AM_LDFLAGS) \
$(DUNEMPILDFLAGS) \
$(UG_LDFLAGS) \
$(AMIRAMESH_LDFLAGS) \
$(ALBERTA_LDFLAGS) \
$(ALUGRID_LDFLAGS) \
$(UMFPACK_LDFLAGS) \
$(DUNE_LDFLAG)
but I still get the same error. Precisely, here it is:
libtool: link: g++ -std=c++11 -O3 -Wall -DNDEBUG -funroll-loops -finline-functions -pthread -fomit-frame-pointer -ffast-math -mfpmath=sse -msse3 -o dune_LDLtest dune_LDLtest-dune_LDLtest.o -pthread -Wl,--export-dynamic -pthread -Wl,--export-dynamic -L/usr/local_machine/suitesparse-4.2.1/lib -L/usr/local_machine/ug-3.10.0/lib -L/usr/local_machine/openmpi-1.6.5/lib -lldl -lamd -L/usr/local_machine/parmetis-4.0.3/lib -L/usr/local_machine/zoltan-3.8/lib -L/usr/lib /usr/local_machine/dune-2.3.1/dune-fem-1.4.0/lib/.libs/libdunefem.a /usr/local_machine/dune-2.3.1/dune-alugrid-2.3.0/lib/.libs/libdunealugrid.a /usr/local_machine/dune-2.3.1/dune-alugrid-2.3.0/lib/.libs/libalugrid_2d.a /usr/local_machine/dune-2.3.1/dune-alugrid-2.3.0/lib/.libs/libalugrid_parallel.a -lgmpxx -lgmp -lzoltan -lparmetis -lmetis /usr/local_machine/dune-2.3.1/dune-alugrid-2.3.0/lib/.libs/libalugrid_serial.a -lz -lm /usr/local_machine/dune-2.3.1/dune-grid-2.3.1/lib/.libs/libdunegrid.a /usr/local_machine/ug-3.10.0/lib/libugS2.a /usr/local_machine/ug-3.10.0/lib/libugS3.a /usr/local_machine/ug-3.10.0/lib/libdevS.a /usr/local_machine/openmpi-1.6.5/lib/libmpi.so -lrt -lnsl -lutil -ldl /usr/local_machine/dune-2.3.1/dune-geometry-2.3.1/lib/.libs/libdunegeometry.a /usr/local_machine/dune-2.3.1/dune-common-2.3.1/lib/.libs/libdunecommon.a -llapack -lblas -lgfortran -lquadmath -pthread -Wl,-rpath -Wl,/usr/local_machine/openmpi-1.6.5/lib -Wl,-rpath -Wl,/usr/local_machine/openmpi-1.6.5/lib
dune_LDLtest-dune_LDLtest.o: In function `main':
dune_LDLtest.cc:(.text.startup+0x12f): undefined reference to `ldl_symbolic(int, int*, int*, int*, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status
make: *** [dune_LDLtest] Error 1
Thanks!
Andrea
__________________________________________________________
Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk
________________________________________
From: Bernd Flemisch [bernd at iws.uni-stuttgart.de]
Sent: 15 September 2014 19:50
To: Sacconi, Andrea; dune at dune-project.org
Subject: Re: [Dune] Problems with linking an external library
Hi Andrea,
I would put everything into LDADD instead of LDADD + LDFLAGS. I don't have a very good explanation for this, maybe you find this sufficient:
www.ttocp.blogspot.de/2011/06/ldadd-vs-ldflags.html
If this doesn't get you any further, please post the actual command that is passed to libtool / the linker.
Kind regards
Bernd
On Mon, 15 Sep 2014 17:00:41 +0000
"Sacconi, Andrea" <a.sacconi11 at imperial.ac.uk> wrote:
>Hi DUNErs,
>
>I would like to ask you a question about linking external libraries. I'm trying to link the library associated to the package LDL, which belongs to the same family UMFPACK is from.
>The library is saved as libldl.a in a convenient folder.
>Well, what I put in my Makefile.am is the following (relevant part):
>
>dune_LDLtest_SOURCES = dune_LDLtest.cc
>
>dune_LDLtest_CPPFLAGS = $(AM_CPPFLAGS) \
> $(DUNEMPICPPFLAGS) \
> $(UG_CPPFLAGS) \
> $(AMIRAMESH_CPPFLAGS) \
> $(ALBERTA_CPPFLAGS) \
> $(ALUGRID_CPPFLAGS) \
> -I/usr/local_machine/suitesparse-4.2.1/include
>
>dune_LDLtest_LDADD = \
> $(DUNE_LDFLAGS) $(DUNE_LIBS) \
> $(ALUGRID_LDFLAGS) $(ALUGRID_LIBS) \
> $(ALBERTA_LDFLAGS) $(ALBERTA_LIBS) \
> $(AMIRAMESH_LDFLAGS) $(AMIRAMESH_LIBS) \
> $(UG_LDFLAGS) $(UG_LIBS) \
> $(DUNEMPILIBS) \
> $(LDADD) \
> -L/usr/local_machine/suitesparse-4.2.1/lib
>
>dune_LDLtest_LDFLAGS = $(AM_LDFLAGS) \
> $(DUNEMPILDFLAGS) \
> $(UG_LDFLAGS) \
> $(AMIRAMESH_LDFLAGS) \
> $(ALBERTA_LDFLAGS) \
> $(ALUGRID_LDFLAGS) \
> $(DUNE_LDFLAGS) \
> -lldl -lamd -lrt -lblas -lgfortran -lm
>
>but the linker keeps telling me that
>
>undefined reference to `ldl_symbolic(int, int*, int*, int*, int*, int*, int*, int*, int*)'
>
>i.e., the routine that performs the symbolic decomposition is not correctly referenced.
>It's strange, for two reasons:
>
>1) I have already used the same approach with other external libraries (GMSH, for example), and I have never had any troubles;
>2) if I just copy&paste the demo LDL code, eliminating all the DUNE stuff, and compile it from command line, everything goes well.
>
>Any smart ideas ?
>Thanks in advance!
>
>Andrea
>__________________________________________________________
>
>Andrea Sacconi
>PhD student, Applied Mathematics
>AMMP Section, Department of Mathematics, Imperial College London,
>London SW7 2AZ, UK
>a.sacconi11 at imperial.ac.uk
>
>_______________________________________________
>Dune mailing list
>Dune at dune-project.org
>http://lists.dune-project.org/mailman/listinfo/dune
_______________________________________________________________
Bernd Flemisch phone: +49 711 685 69162
IWS, Universitaet Stuttgart fax: +49 711 685 67020
Pfaffenwaldring 61 email: bernd at iws.uni-stuttgart.de
D-70569 Stuttgart url: www.hydrosys.uni-stuttgart.de
_______________________________________________________________
More information about the Dune
mailing list