[Trilinos-Users] mingw: linking problem trilinos and clapack

Bartlett, Roscoe A rabartl at sandia.gov
Tue Feb 2 06:21:01 MST 2010


Christoph,

I would guess that you have a name mangling problem.  Can you use 'nm' to see what the names of the BLAS routines actually are?  For example, if you built the library 'libblas.a' you would search:

   $ nm libblas.a | grep -i dtrmm

See what that returns.

If you need to manually adjust the name mangling then you can do that on the configure line by setting, for example:

    -DF77_BLAS_MANGLE:STRING="(name,NAME) name ## _"

You can change the case, underscores etc., to force a match.

The joys of mix language programming!

Cheers,

- Ross


-----------------------------------------------------------------------
Dr. Roscoe A. Bartlett
Sandia National Laboratories
Department of Optimization and Uncertainty Estimation
Trilinos Software Engineering Technologies and Integration Lead
(505) 844-5097




> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
> users-bounces at software.sandia.gov] On Behalf Of Christoph Hasenbein
> Sent: Tuesday, February 02, 2010 3:42 AM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] mingw: linking problem trilinos and clapack
> 
> Hello everyone,
> 
> I hope this is the right place to ask this question.
> 
> I have used MSVC till now and everything works fine. As Microsoft
> doesn't seem to include a profiler I tried to use mingw/msys and gprof.
> I
> have this working without Trilinos (using cminpack).
> 
> I have managed to compile clapack and Trilinos with mingw. When I try
> to link my own project I get the following error:
> 
> Linking CXX executable AbsorberWieInAspenZumTesten.exe
> /C/msys/1.0/bin/g++.exe   -g
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/AbsorberWieInAspenZumTesten
> .cpp.obj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/absorber.cpp.obj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/fcnabsorber.cpp.obj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/helpfunctionsabsorber.cpp.o
> bj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/ex1.cpp.obj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/helpfunctions.cpp.obj"
> "CMakeFiles/AbsorberWieInAspenZumTesten.dir/stratimikos.cpp.obj"   -o
> AbsorberWieInAspenZumTesten.exe -Wl,--out-
> implib,libAbsorberWieInAspenZumTesten.dll.a -Wl,--major-image-
> version,0,--minor-image-version,0  -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable/../../trilinos-
> 10.0.4-
> Source/gccDebug/lib -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable/../../clapack-
> 3.2.1-
> CMAKE/gccDebug/SRC -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable/../../clapack-
> 3.2.1-
> CMAKE/gccDebug/BLAS/SRC -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable/../../clapack-
> 3.2.1-
> CMAKE/gccDebug/F2CLIBS/libf2c -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable/../cminpack -
> L/C/msys/1.0/home/christoph/git_CO2_Wash/Programmable -Wl,-Bstatic -
> lf2c
> -lepetra -lepetraext -lteuchos -lnox -lnoxepetra -Wl,-Bdynamic -
> lcminpack -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -
> loleaut32 -luuid -lcomdlg32 -ladvapi32
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/gccDebug/lib\libepetra.a(Epetra_BLAS.cpp.obj):Epetra_BLAS.cpp:
> (.text+0xab): undefined reference to `dtrmm_'
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/gccDebug/lib\libepetra.a(Epetra_BLAS.cpp.obj):Epetra_BLAS.cpp:
> (.text+0x11f): undefined reference to `strmm_'
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/gccDebug/lib\libepetra.a(Epetra_BLAS.cpp.obj):Epetra_BLAS.cpp:
> (.text+0x1a6): undefined reference to `dsymm_'
> 
> ...
> 
> Checking libblas.a with nm I see that each function has a underbar in
> front of its name, for example
> 
> $ nm libblas.a | grep dtrmm
> dtrmm.c.obj:
> 00000000 T _dtrmm_
> 
> I think that this has something to do with name mangling. My idea was
> to
> change this with the cmake variable F77_BLAS_MANGLE. Setting this to
> "UNDEFINED" it makes it search for the name in capitals. I tried things
> like
> "(name,NAME) _name ##_" (without quotes) but it fails with
> 
> $ make
> [  0%] Building CXX object
> packages/teuchos/src/CMakeFiles/teuchos.dir/Teuchos_BLAS.cpp.obj
> In file included from c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS.cpp:30:
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:309: error:
> declaration of C function 'void _name_(const int*, double*,
> const int*, double*, const int*, double*, double*)' conflicts with
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:308: error:
> previous declaration 'void _name_(double*, double*, double*,
> double*)' here
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:310: error:
> declaration of C function 'double _name_(const int*, const
> double*, const int*)' conflicts with
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:309: error:
> previous declaration 'void _name_(const int*, double*, const
> int*, double*, const int*, double*, double*)' here
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:311: error:
> declaration of C function 'void _name_(const int*, const
> double*, const double*, const int*, double*, const int*)' conflicts
> with
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:310: error:
> previous declaration 'double _name_(const int*, const
> double*, const int*)' here
> c:/msys/1.0/home/christoph/trilinos-10.0.4-
> Source/packages/teuchos/src/Teuchos_BLAS_wrappers.hpp:312: error:
> declaration of C function 'void _name_(const int*, const
> double*, const int*, double*, const int*)' conflicts with
> 
> 
> while compiling Trilinos.
> 
> www.mingw.org seems to be down at the moment so I kindly would like to
> ask if you have an idea how to proceed.
> 
> Best regards,
> 
> Christoph Hasenbein
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users



More information about the Trilinos-Users mailing list