<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 05/05/2010 09:32 AM, Bernd Flemisch wrote:
<blockquote cite="mid:4BE11F0D.7060606@iws.uni-stuttgart.de" type="cite">
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
Hey Franz and Jö, <br>
  <br>
I remember that I ran into the same problem with CMake but as usual I
do not remember how I solved it. I attach my CMake files, maybe you can
compare with yours. <br>
  <br>
By the way, to get the complete command that is passed to the linker,
you can use <br>
make VERBOSE=1<br>
And then, as Jö suggested, it is a matter of comparing with autotools. <br>
  <br>
Kind regards <br>
Bernd <br>
  <br>
On 05/05/2010 09:18 AM, Jö Fahlke wrote:
  <blockquote cite="mid:20100505071859.GD12200@paranoia" type="cite">
    <pre wrap="">Am Tue,  4. May 2010, 20:02:05 +0200 schrieb Franz Rammerstorfer:
  </pre>
    <blockquote type="cite">
      <pre wrap="">I've updated all my modules and rebuilt them.
I've also checked the linking sequence within my buildingsystem cmake.
Linking seems to work, because e.g. I'm able to construct a UGGrid
object like in your example code unitcube.hh in dune-grid-howto.
    </pre>
    </blockquote>
    <pre wrap="">Works for me [tm]:  After adding the necessary include files your example
looks as follows:
=== testp.cc =========================================================
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <string>

#include <dune/grid/uggrid.hh>
#include <dune/grid/io/file/gmshreader.hh>

int main(int argc, char **argv)
{
  const int dim=3;
  const std::string filename(argv[1]);
  typedef Dune::UGGrid<dim> GT;
  GT grid;
  Dune::GmshReader<GT>::read(grid, filename);
  return 0;
}
=== testp.cc =========================================================

I added  the following snippet for compilation to my Makefile.am:
=== Makefile.am ======================================================
noinst_PROGRAMS = testp
testp_SOURCES = testp.cc
testp_CPPFLAGS = $(AM_CPPFLAGS) \
        $(UG_CPPFLAGS)
testp_LDFLAGS = $(AM_LDFLAGS)   \
        $(UG_LDFLAGS)
testp_LDADD =                   \
        $(UG_LIBS)                              \
        $(LDADD)
=== Makefile.am ======================================================

With that in place, everything works fine (except for an unrelated warning
from UG):
=== make output ======================================================
-*- mode: compilation; default-directory: "~/src/dune2/dune-edyn/dune/edyn/utilities/" -*-
Compilation started at Wed May  5 09:10:03

cd ~/src/dune2/dune-edyn/dune/edyn/utilities && make testp
 cd ../../.. && /bin/bash /home/joe/src/dune2/dune-edyn/missing --run automake-1.9 --foreign  dune/edyn/utilities/Makefile
 cd ../../.. && /bin/bash ./config.status dune/edyn/utilities/Makefile depfiles
config.status: creating dune/edyn/utilities/Makefile
config.status: executing depfiles commands
if g++ -std=c++0x -DHAVE_CONFIG_H -I. -I. -I../../..  -I/home/joe/src/dune2/dune-common -I/home/joe/src/dune2/dune-grid -I/home/joe/src/dune2/dune-localfunctions -I/home/joe/src/dune2/dune-istl -I/home/joe/src/dune2/dune-pdelab -I../../.. -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread -DMPIPP_H -DENABLE_MPI=1 -I/home/joe/src/dune2/UGinst/include -DENABLE_UG -DModelP -DNDEBUG  -ggdb3 -O3 -funroll-loops -fno-strict-aliasing -Wall -MT testp-testp.o -MD -MP -MF ".deps/testp-testp.Tpo" -c -o testp-testp.o `test -f 'testp.cc' || echo './'`testp.cc; \
        then mv -f ".deps/testp-testp.Tpo" ".deps/testp-testp.Po"; else rm -f ".deps/testp-testp.Tpo"; exit 1; fi
In file included from /home/joe/src/dune2/dune-grid/dune/grid/uggrid.hh:44,
                 from testp.cc:7:
/home/joe/src/dune2/dune-grid/dune/grid/uggrid/ugwrapper.hh:578:2: warning: #warning Method isLeaf() for nodes will not work properly in case of vertical load balancing
In file included from testp.cc:9:
/home/joe/src/dune2/dune-grid/dune/grid/io/file/gmshreader.hh: In member function ‘void Dune::GmshReaderParserBase<GridType, DimImp>::read(const std::string&) [with GridType = Dune::UGGrid<3>, DimImp = Dune::GmshReaderParser<Dune::UGGrid<3>, 3>]’:
/home/joe/src/dune2/dune-grid/dune/grid/io/file/gmshreader.hh:380: warning: ‘physical_entity’ may be used uninitialized in this function
/bin/bash ../../../libtool --tag=CXX --mode=link g++ -std=c++0x  -ggdb3 -O3 -funroll-loops -fno-strict-aliasing -Wall   -o testp    testp-testp.o -L/home/joe/src/dune2/UGinst/lib -lugS2 -lugS3 -ldevS -pthread -L/usr/lib/openmpi/lib -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl ../../../lib/libduneedyn.la -L/home/joe/src/dune2/dune-grid/lib -ldunegrid  -L/home/joe/src/dune2/dune-common/lib -ldunecommon  -lm 
libtool: link: g++ -std=c++0x -ggdb3 -O3 -funroll-loops -fno-strict-aliasing -Wall -o .libs/testp testp-testp.o -pthread -Wl,--export-dynamic  -L/home/joe/src/dune2/UGinst/lib /home/joe/src/dune2/UGinst/lib/libugS2.so /home/joe/src/dune2/UGinst/lib/libugS3.so /home/joe/src/dune2/UGinst/lib/libdevS.so -L/usr/lib/openmpi/lib /usr/lib/openmpi/lib/libmpi.so /usr/lib/openmpi/lib/libopen-rte.so /usr/lib/openmpi/lib/libopen-pal.so -lnsl -lutil -ldl ../../../lib/.libs/libduneedyn.so -L/home/joe/src/dune2/dune-grid/lib /home/joe/src/dune2/dune-grid/lib/.libs/libdunegrid.so -L/home/joe/src/dune2/dune-common/lib /home/joe/src/dune2/dune-common/lib/.libs/libdunecommon.so -lm -pthread -Wl,-rpath -Wl,/home/joe/src/dune2/UGinst/lib -Wl,-rpath -Wl,/usr/lib/openmpi/lib

Compilation finished at Wed May  5 09:10:08
=== make output ======================================================

So, to help you any further, I will really need the exact command line cmake
uses to call the linker.

Bye,
Jö.

  </pre>
    <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Dune mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:Dune@dune-project.org">Dune@dune-project.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://lists.dune-project.org/mailman/listinfo/dune">http://lists.dune-project.org/mailman/listinfo/dune</a>
  </pre>
  </blockquote>
  <br>
  <pre class="moz-signature" cols="72">-- 
_____________________________________________________________________

Bernd Flemisch                               phone: +49 711 685 69162
IWS, Universität Stuttgart                   fax:   +49 711 685 60430
Pfaffenwaldring 61                  email: <a moz-do-not-send="true"
 class="moz-txt-link-abbreviated"
 href="mailto:bernd@iws.uni-stuttgart.de">bernd@iws.uni-stuttgart.de</a>
D-70569 Stuttgart                  url: <a moz-do-not-send="true"
 class="moz-txt-link-abbreviated"
 href="http://www.hydrosys.uni-stuttgart.de">www.hydrosys.uni-stuttgart.de</a>
_____________________________________________________________________
  </pre>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Dune mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Dune@dune-project.org">Dune@dune-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.dune-project.org/mailman/listinfo/dune">http://lists.dune-project.org/mailman/listinfo/dune</a></pre>
</blockquote>
Hi, <br>
thanks for the answers, but unfortunately I couldn't solve my problem. <br>
Actually I'm using the cmake files of Bernd with minor changes, just my
path's and stuff like that.<br>
I noticed a difference in Joe's linking sequence compared to mine:<br>
Joe:  ugS2, ugS3, devS, dunegrid, dunecommon<br>
Mine: dunegrid, dunecommon, gS2, ugS3, devS<br>
But thats the way Bernd's build system do it, and if I try to do it
like Joe not even a simple UGGrid object is possible.<br>
<br>
Verbose mode gives following: <br>
<br>
franz@fmech04:~/work/coding/couple/cmk$ make VERBOSE=1<br>
/usr/bin/cmake -H/home/franz/work/coding/couple/cmk
-B/home/franz/work/coding/couple/cmk --check-build-system
CMakeFiles/Makefile.cmake 0<br>
/usr/bin/cmake -E cmake_progress_start
/home/franz/work/coding/couple/cmk/CMakeFiles
/home/franz/work/coding/couple/cmk/CMakeFiles/progress.marks<br>
make -f CMakeFiles/Makefile2 all<br>
make[1]: Entering directory `/home/franz/work/coding/couple/cmk'<br>
make -f test/CMakeFiles/test.dir/build.make
test/CMakeFiles/test.dir/depend<br>
make[2]: Entering directory `/home/franz/work/coding/couple/cmk'<br>
cd /home/franz/work/coding/couple/cmk && /usr/bin/cmake -E
cmake_depends "Unix Makefiles" /home/franz/work/coding/couple/cmk
/home/franz/work/coding/couple/test /home/franz/work/coding/couple/cmk
/home/franz/work/coding/couple/cmk/test
/home/franz/work/coding/couple/cmk/test/CMakeFiles/test.dir/DependInfo.cmake
--color=<br>
make[2]: Leaving directory `/home/franz/work/coding/couple/cmk'<br>
make -f test/CMakeFiles/test.dir/build.make
test/CMakeFiles/test.dir/build<br>
make[2]: Entering directory `/home/franz/work/coding/couple/cmk'<br>
Linking CXX executable test<br>
cd /home/franz/work/coding/couple/cmk/test && /usr/bin/cmake -E
cmake_link_script CMakeFiles/test.dir/link.txt --verbose=1<br>
/usr/bin/c++      CMakeFiles/test.dir/test.C.o  -o test -rdynamic
/home/franz/work/coding/dune/dune-grid/lib/.libs/libdunegrid.a
/home/franz/work/coding/dune/dune-common/lib/.libs/libdunecommon.a
/home/franz/work/coding/dune/uggrid/lib/libugS2.a
/home/franz/work/coding/dune/uggrid/lib/libugS3.a
/home/franz/work/coding/dune/uggrid/lib/libdevS.a <br>
make[2]: Leaving directory `/home/franz/work/coding/couple/cmk'<br>
make[1]: Leaving directory `/home/franz/work/coding/couple/cmk'<br>
CMakeFiles/test.dir/test.C.o: In function
`Dune::GmshReaderParser<Dune::UGGrid<3>,
3>::pass2HandleElement(_IO_FILE*, int, std::map<int, unsigned
int, std::less<int>, std::allocator<std::pair<int const,
unsigned int> > >&,
std::vector<Dune::FieldVector<double, 3>,
std::allocator<Dune::FieldVector<double, 3> > >
const&, int)':<br>
test.C:(.text._ZN4Dune16GmshReaderParserINS_6UGGridILi3EEELi3EE18pass2HandleElementEP8_IO_FILEiRSt3mapIijSt4lessIiESaISt4pairIKijEEERKSt6vectorINS_11FieldVectorIdLi3EEESaISH_EEi[Dune::GmshReaderParser<Dune::UGGrid<3>,
3>::pass2HandleElement(_IO_FILE*, int, std::map<int, unsigned
int, std::less<int>, std::allocator<std::pair<int const,
unsigned int> > >&,
std::vector<Dune::FieldVector<double, 3>,
std::allocator<Dune::FieldVector<double, 3> > >
const&, int)]+0x8cc): undefined reference to
`Dune::GridFactory<Dune::UGGrid<3>
>::insertBoundarySegment(std::vector<unsigned int,
std::allocator<unsigned int> > const&,
Dune::shared_ptr<Dune::BoundarySegment<3, 3> >)'<br>
collect2: ld returned 1 exit status<br>
make[2]: *** [test/test] Error 1<br>
make[1]: *** [test/CMakeFiles/test.dir/all] Error 2<br>
make: *** [all] Error 2<br>
<br>
<br>
Thanks, bye, Franz.<br>
<br>
<br>
</body>
</html>