← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Add build file.

 

On Mon, March 31, 2008 Kristian Oelgaard wrote:
> Quoting Anders Logg <logg@xxxxxxxxx>:
>
>> On Mon, Mar 31, 2008 at 02:18:58PM +0100, Garth N. Wells wrote:
>> >
>> >
>> > Anders Logg wrote:
>> > > On Mon, Mar 31, 2008 at 02:26:51PM +0200, DOLFIN wrote:
>> > >> One or more new changesets pushed to the primary dolfin repository.
>> > >> A short summary of the last three changesets is included below.
>> > >>
>> > >> changeset:   3832:f2ce62a937ac545255038c9fe6f74ecf639046d7
>> > >> tag:         tip
>> > >> user:        "Ola Skavhaug <skavhaug@xxxxxxxxx>"
>> > >> date:        Mon Mar 31 14:28:34 2008 +0200
>> > >> files:       demo/mesh/meshfunction/cpp/SConstruct
>> > >> description:
>> > >> Add build file.
>> > >
>> > > Should we add this to all cpp demos?
>> > >
>> >
>> > Yes.
>> >
>> > Garth
>>
>> ok, take a look at the SConstruct file for the Poisson demo
>> so it looks ok before we start copying it to everywhere.
>
> I get the following error:
>
> mpicxx -o main.o -c -Wall -pipe -ansi -g -Werror -O2 -fno-strict-aliasing
> -pthread -DDEBUG -DNDEBUG -DHAS_MPI=1 -DMPICH_IGNORE_CXX_SEEK
> -DPACKAGE_VERSION="0.7.2" -DHAS_PETSC=1 -DHAS_SLEPC=1 -DHAS_UMFPACK=1
> -DHAS_GTS=1 -I/home/oelgaard/fenics/dolfin/local/include
> -I/usr/lib/python2.5/site-packages/numpy/core/include
> -I/home/oelgaard/slepc-2.3.3 -I/home/oelgaard/slepc-2.3.3/include
> -I/usr/include/suitesparse -I/usr/include/python2.5
> -I/home/oelgaard/petsc-2.3.3-p7/bmake/linux-gnu-cxx-debug
> -I/home/oelgaard/petsc-2.3.3-p7/include
> -I/home/oelgaard/petsc-2.3.3-p7/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include
> -I/home/oelgaard/local/include -I/usr/include/libxml2
> -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include main.cpp
> sh: mpicxx: command not found
> scons: *** [main.o] Error 127
> scons: building terminated because of errors.
>
> because I use a local installation of PETSc (that downloads mpich).
> should the PETSc path be added to PATH in dolfin.conf? since DOLFIN picks
> up the
> compiler from PETSc?
>
> Currently my SConstruct looks like this:
>
> import commands
> import os
>
> # Use system PATH since I don't have mpicxx in default path
> env = Environment(ENV = {'PATH' : os.environ['PATH']})
>
> # Get compiler from pkg-config
> compiler = commands.getoutput('pkg-config --variable=compiler dolfin')
>
> # Update CXX compiler
> env.Replace(CXX = compiler)
>
> # Get DOLFIN cflags and libs
> env.ParseConfig('pkg-config --cflags --libs dolfin')
>
> # Build program
> env.Program('demo', 'main.cpp')
>
> which is not too elegant but it works.

Perhaps we should use os.environ when creating the SCons Environment, that is

env = Environment(ENV=os.environ, CXX=compiler)

This should preserve peoples environment variables. A standard SConstruct
for the demos then becomes:

import os, commands

# Get compiler from pkg-config
compiler = commands.getoutput('pkg-config --variable=compiler dolfin')

# Create a SCons Environment based on the main os environment:
env = Environment(ENV=os.environ, CXX=compiler)

# Get compiler flags from pkg-config
env.ParseConfig('pkg-config --cflags --libs dolfin')

# Program name
env.Program('demo', 'main.cpp')

Does this work for you Kristian?

Johannes




Follow ups

References