[Dune] problem using ug and the gmshreader

Franz Rammerstorfer franz.rammerstorfer at tugraz.at
Wed May 5 15:33:16 CEST 2010


On 05/05/2010 09:32 AM, Bernd Flemisch wrote:
> Hey Franz and Jö,
>
> 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.
>
> By the way, to get the complete command that is passed to the linker, 
> you can use
> make VERBOSE=1
> And then, as Jö suggested, it is a matter of comparing with autotools.
>
> Kind regards
> Bernd
>
> On 05/05/2010 09:18 AM, Jö Fahlke wrote:
>> Am Tue,  4. May 2010, 20:02:05 +0200 schrieb Franz Rammerstorfer:
>>    
>>> 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.
>>>      
>> 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ö.
>>
>>    
>>
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>    
>
> -- 
> _____________________________________________________________________
>
> Bernd Flemisch                               phone: +49 711 685 69162
> IWS, Universität Stuttgart                   fax:   +49 711 685 60430
> Pfaffenwaldring 61                  email:bernd at iws.uni-stuttgart.de
> D-70569 Stuttgart                  url:www.hydrosys.uni-stuttgart.de
> _____________________________________________________________________
>    
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
Hi,
thanks for the answers, but unfortunately I couldn't solve my problem.
Actually I'm using the cmake files of Bernd with minor changes, just my 
path's and stuff like that.
I noticed a difference in Joe's linking sequence compared to mine:
Joe:  ugS2, ugS3, devS, dunegrid, dunecommon
Mine: dunegrid, dunecommon, gS2, ugS3, devS
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.

Verbose mode gives following:

franz at fmech04:~/work/coding/couple/cmk$ make VERBOSE=1
/usr/bin/cmake -H/home/franz/work/coding/couple/cmk 
-B/home/franz/work/coding/couple/cmk --check-build-system 
CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start 
/home/franz/work/coding/couple/cmk/CMakeFiles 
/home/franz/work/coding/couple/cmk/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/franz/work/coding/couple/cmk'
make -f test/CMakeFiles/test.dir/build.make test/CMakeFiles/test.dir/depend
make[2]: Entering directory `/home/franz/work/coding/couple/cmk'
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=
make[2]: Leaving directory `/home/franz/work/coding/couple/cmk'
make -f test/CMakeFiles/test.dir/build.make test/CMakeFiles/test.dir/build
make[2]: Entering directory `/home/franz/work/coding/couple/cmk'
Linking CXX executable test
cd /home/franz/work/coding/couple/cmk/test && /usr/bin/cmake -E 
cmake_link_script CMakeFiles/test.dir/link.txt --verbose=1
/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
make[2]: Leaving directory `/home/franz/work/coding/couple/cmk'
make[1]: Leaving directory `/home/franz/work/coding/couple/cmk'
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)':
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> >)'
collect2: ld returned 1 exit status
make[2]: *** [test/test] Error 1
make[1]: *** [test/CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2


Thanks, bye, Franz.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20100505/a3dc0952/attachment.htm>


More information about the Dune mailing list