Subject: [FEniCS-users] How to enable a external package with Dolfin

From: Ryan Yan <[email-masked]>
Date: Fri, 2 Oct 2009 17:59:59 -0400

Hi All,
On my machine, Petsc is built with Hypre, and Dolfin is built with PETSc.

When I compile the demo program, I got following errors.

vyan2000@vyan2000-linux ~/local/dolfin/dolfin-0.9.3/demo/fem/simple/cpp $
scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
mpicxx -o demo
-Wl,-rpath,/home/vyan2000/local/PPETSc/petsc-test-3-p6/O-hypre-prometheus/lib
main.o -L/home/vyan2000/local/dolfin/dolfin-0.9.3/lib -L/usr/lib/atlas
-L/home/vyan2000/local/PPETSc/petsc-test-3-p6/O-hypre-prometheus/lib
-ldolfin -lboost_filesystem -lz -lumfpack -lpetscts -lpetscsnes -lpetscksp
-lpetscdm -lpetscmat -lpetscvec -lpetsc -lboost_program_options -llapack
-lblas -lcholmod -lamd -lcolamd -lxml2
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `HYPRE_IJVectorGetObject'
...
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `PCSASetVectors_Prometheus'
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `XCreatePixmap'
...
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `HYPRE_IJMatrixCreate'
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `XSetForeground'
/home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so: undefined
reference to `XUndefineCursor'
....

Obviously, this is due to the  configuration of "Dolfin" without Hypre.   I
checked the dolfin scons configure help, but there seems no interface for
one to add the path of hypre as  a "scons configure " option.

Does anyone have the experience to add those dependency correctly? Or is
there any way to edit the  "SConstruct" or "dolfin.conf" to do the job? I am
new to scons

Thank you very much,

Yan

---

From: "Garth N. Wells" <[email-masked]>
Date: Fri, 02 Oct 2009 23:02:30 +0100

> On my machine, Petsc is built with Hypre, and Dolfin is built with PETSc.

Did you build PETSc with shared libraries (--with-shared=1)?

Garth

> vyan2000@vyan2000-linux ~/local/dolfin/dolfin-0.9.3/demo/fem/simple/cpp 
> $ scons
> -ldolfin -lboost_filesystem -lz -lumfpack -lpetscts -lpetscsnes 
> -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc 
> -lboost_program_options -llapack -lblas -lcholmod -lamd -lcolamd -lxml2
> Obviously, this is due to the  configuration of "Dolfin" without 
> Hypre.   I checked the dolfin scons configure help, but there seems no 
> interface for one to add the path of hypre as  a "scons configure " option.
> 
> there any way to edit the  "SConstruct" or "dolfin.conf" to do the job? 
> I am new to scons
> 
> Thank you very much,
> 
> Yan 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> FEniCS-users mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/fenics-users

---

From: Ryan Yan <[email-masked]>
Date: Fri, 2 Oct 2009 18:15:18 -0400

Hi Garth,
I built PETSc with the option "--with-shared=0".

Thanks,

Yan

On Fri, Oct 2, 2009 at 6:02 PM, Garth N. Wells <[email-masked]> wrote:

>> Obviously, this is due to the  configuration of "Dolfin" without Hypre.
>> I checked the dolfin scons configure help, but there seems no interface for

---

From: "Garth N. Wells" <[email-masked]>
Date: Fri, 02 Oct 2009 23:18:37 +0100

> I built PETSc with the option "--with-shared=0".

Try using --with-shared=1.

Garth

> Thanks,
> 
> Yan
> 
> On Fri, Oct 2, 2009 at 6:02 PM, Garth N. Wells <[email-masked] 
> <mailto:[email-masked]>> wrote:
> 
> 
> 
>     Ryan Yan wrote:
> 
>         Hi All,
>         vyan2000@vyan2000-linux
>         ~/local/dolfin/dolfin-0.9.3/demo/fem/simple/cpp $ scons
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `HYPRE_IJVectorGetObject'
>         ...
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `PCSASetVectors_Prometheus'
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `XCreatePixmap'
>         ...
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `HYPRE_IJMatrixCreate'
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `XSetForeground'
>         /home/vyan2000/local/dolfin/dolfin-0.9.3/lib/libdolfin.so:
>         undefined reference to `XUndefineCursor'
>         ....
> 
> 
>         Hypre.   I checked the dolfin scons configure help, but there
>         seems no interface for one to add the path of hypre as  a "scons
>         configure " option.
> 
>         Does anyone have the experience to add those dependency
>         correctly? Or is there any way to edit the  "SConstruct" or
>         "dolfin.conf" to do the job? I am new to scons
> 
>         Thank you very much,
> 
>         Yan
> 
>         [email-masked] <mailto:[email-masked]>

---

From: Ryan Yan <[email-masked]>
Date: Fri, 2 Oct 2009 18:29:30 -0400

Hi Garth,
Thank you very much for the suggestion.

I am just wondering if I can explicitly add those dependency information
into the configure of FEniCS, without rebuild my PETSc. I do not know
whether there is going to be other consequences if I enable the shared
libraries in PETSc built.

Is there any alternative way to try? If using "make", then I know how to
solve the problem, but I am new to scons and don't know where to start.

Yan

On Fri, Oct 2, 2009 at 6:18 PM, Garth N. Wells <[email-masked]> wrote:

>> On Fri, Oct 2, 2009 at 6:02 PM, Garth N. Wells <[email-masked] <mailto:
>> [email-masked]>> wrote:
>>
>>
>>
>>    Ryan Yan wrote:
>>
>>        Hi All,

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 03 Oct 2009 09:25:34 +0100

Ryan Yan wrote:
> Is there any alternative way to try? 

You can try adding the PETSc external library flags ('scons configure 
-h' tells how to add option compiler and linker flags). It's tricky to 
get the libraries right. The simplest solution is to rebuild PETSc with 
shared libraries.

Garth

If using "make", then I know how to
> On Fri, Oct 2, 2009 at 6:18 PM, Garth N. Wells <[email-masked] 
>         <mailto:[email-masked]> <mailto:[email-masked]
>         <mailto:[email-masked]>>> wrote:
> 
> 
> 
>            Ryan Yan wrote:
> 
>                Hi All,
>                -lboost_program_options -llapack -lblas -lcholmod -lamd
>         -lcolamd
>                -lxml2
>         <mailto:[email-masked] <mailto:[email-masked]>>
>

---

From: Ryan Yan <[email-masked]>
Date: Sat, 3 Oct 2009 17:23:12 -0400

Hi Garth,

Thank you very much for further suggestions.

The following looks like the right things to try.

Yan.

customCxxFlags: Customize compilation of C++ code
     default:
     actual:

 customLinkFlags: Customize linking of C++ code
     default:
     actual:

On Sat, Oct 3, 2009 at 4:25 AM, Garth N. Wells <[email-masked]> wrote:

> You can try adding the PETSc external library flags ('scons configure -h'
> tells how to add option compiler and linker flags). It's tricky to get the
> libraries right. The simplest solution is to rebuild PETSc with shared
> libraries.
>
> Garth
>
>> On Fri, Oct 2, 2009 at 6:18 PM, Garth N. Wells <[email-masked] <mailto:
>> [email-masked]>> wrote:
>>
>>
>>
>>    Ryan Yan wrote:
>>
>>        Hi Garth,
>>               On my machine, Petsc is built with Hypre, and Dolfin is
>> built
>>               with PETSc.
>>
>>