[Trilinos-Users] Two compilation problems with MultiLevelPreconditioner

Jonathan Hu jhu at sandia.gov
Thu Nov 29 11:44:26 MST 2007


Hi Ernesto,

     The HAVE_CONFIG_H macro should be defined in the makefile compiling 
your application.

Alternatively, you could use the Makefile.export approach.   To do this, 
add the following line to your application Makefile:

include 
/absolute/path/to/your/Trilinos/build/directory/packages/ml/Makefile.export.ml

This defines two make variables, ML_INCLUDES and ML_LIBS, that 
encapsulate all of the Trilinos headers and libraries that ML depends 
on.  Use these two variables in your application compile and link lines, 
respectively.   Makefile.export.ml also defines the HAVE_CONFIG_H macro.

Regards,
Jonathan

Ernesto Prudencio wrote:
>
> Thanks, Jim.
>
> In which Makefile should I use it: in some package Makefile or in the 
> Makefile compiling my application?
>
> Ernesto.
>
> On Thu, 29 Nov 2007, James Willenbring wrote:
>
>> Ernesto,
>>
>> Did you use -DHAVE_CONFIG_H?  It looks like you might not have.  We are
>> currently looking at lifting the requirement of defining HAVE_CONFIG_H,
>> but for now, that may help you avoid these problems.
>>
>> Jim
>>
>> On Wed, 2007-11-28 at 21:58 -0800, Ernesto Prudencio wrote:
>>> Hi. In a include file of mine, called trilinos.hpp, I have:
>>>
>>> // BEGIN FILE trilinos.hpp
>>>
>>> #include <Epetra_MpiComm.h>
>>> #include <Epetra_Map.h>
>>> #include <Epetra_Vector.h>
>>> #include <Epetra_CrsMatrix.h>
>>> #include <AztecOO.h> // line 14
>>> #include <ml_include.h>
>>> #include <ml_MultiLevelOperator.h>
>>> #include <Teuchos_ParameterList.hpp> // line 17
>>> #include <ml_MultiLevelPreconditioner.h>
>>> #include <ml_epetra_utils.h>
>>> ...
>>>
>>> class trilinos {
>>> ...
>>> private:
>>>    Epetra_MpiComm*       m_commForTrilinos;
>>>    Epetra_Map*           m_mapForTrilinos;
>>>    Epetra_CrsMatrix*     m_matrixForTrilinos;
>>>    Epetra_LinearProblem* m_problemForTrilinos;
>>>    AztecOO*              m_solverForTrilinos;
>>>    Epetra_Vector*        m_rhsForTrilinos;
>>>    Epetra_Vector*        m_dofsForTrilinos;
>>>    ML*                                  m_mlHandle;
>>>    ML_Aggregate*                        m_mlAggObject;
>>>    ML_Epetra::MultiLevelOperator*       m_mlOperator;
>>>    Teuchos::ParameterList*              m_mlList;
>>>    ML_Epetra::MultiLevelPreconditioner* m_mlPreconditioner; // line 66
>>>    int                                  m_nLevels;
>>> ...
>>> }
>>>
>>> // END FILE trilinos.hpp
>>>
>>> --> Compilation problem 1: duplicated defines
>>>
>>> In file included from <installation>/include/Teuchos_ConfigDefs.hpp:77,
>>>      from 
>>> <installation>/include/Teuchos_ParameterListExceptions.hpp:33,
>>>      from <installation>/include/Teuchos_ParameterList.hpp:37,
>>>      from trilinos.hpp:17,
>>>      from NML_ITLLinearSolver.C:13:
>>> <installation>/include/Teuchos_config.h:14:1: warning: "F77_FUNC" 
>>> redefined
>>> In file included from <installation>/include/az_aztec.h:61,
>>>      from <installation>/include/AztecOO.h:44,
>>>      from trilinos.hpp:14,
>>>      from NML_ITLLinearSolver.C:13:
>>> <installation>/include/az_f77func.h:99:1: warning: this is the 
>>> location of
>>> the previous definition
>>>
>>> In file included from <installation>/include/Teuchos_ConfigDefs.hpp:77,
>>>      from 
>>> <installation>/include/Teuchos_ParameterListExceptions.hpp:33,
>>>      from <installation>/include/Teuchos_ParameterList.hpp:37,
>>>      from trilinos.hpp:17,
>>>      from NML_ITLLinearSolver.C:13:
>>> <installation>/include/Teuchos_config.h:19:1: warning: "F77_FUNC_" 
>>> redefined
>>> In file included from <installation>/include/az_aztec.h:61,
>>>      from <installation>/include/AztecOO.h:44,
>>>      from trilinos.hpp:14,
>>>      from NML_ITLLinearSolver.C:13:
>>> <installation>/include/az_f77func.h:103:1: warning: this is the 
>>> location
>>> of the previous definition
>>>
>>> --> How I "solved" compilation problem 1: put ifndef-endif pair around
>>> both defines in Teuchos_config.h
>>>
>>> --> Compilation problem 2:
>>>
>>> trilinos.hpp:66: error: ISO C++ forbids declaration of
>>> 'MultiLevelPreconditioner' with no type
>>> trilinos.hpp:66: error: invalid use of '::'
>>> trilinos.hpp:66: error: expected ';' before '*' token
>>>
>>> --> How I "solved" compilation problem 2: included ml_config.h in
>>> <installation>/include/ml_MultiLevelPreconditioner.h, so that "#if
>>> defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS)" would work 
>>> properly.
>>> However, such correction caused extra redefinition problems like in
>>> problem 1, "solved" again with ifndef-endif pairs.
>>>
>>> --> Once the compilation problems were solved, linking phase worked 
>>> with
>>> libraries "-laztecoo -lml -lifpack -lepetra -lteuchos -lepetraext". And
>>> the executable worked properly as well.
>>>
>>> /////////////////    Question     ////////////////////
>>>
>>> --> Any ideas if this is a problem of the library or a problem of my
>>> specific installation?
>>>
>>> My script for configuration reads like this:
>>>
>>> export CC=/usr/bin/mpicc
>>> export CXX=/usr/bin/mpiCC
>>> ./configure --prefix=$HOME/Desktop/trilinos-8.0.3/installation
>>> --enable-mpi --enable-epetra -enable-teuchos --enable-aztecoo 
>>> --enable-ml
>>> --enable-didasko
>>>
>>> Thanks in advance,
>>>
>>> Ernesto.
>>>
>>>
>>>
>>> _______________________________________________
>>> Trilinos-Users mailing list
>>> Trilinos-Users at software.sandia.gov
>>> http://software.sandia.gov/mailman/listinfo/trilinos-users
>>
>>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>


-- 
Jonathan J. Hu, mailto:jhu at sandia.gov
Postal address: Sandia National Laboratories
                Mailstop 9159
                PO Box 969, Livermore, CA 94551-0969
Tel / Fax (925) 294-2931 



More information about the Trilinos-Users mailing list