← Back to team overview

dolfin team mailing list archive

Re: Case sensitivity

 

I'm not convinced that the order of the directories plays a role. mpicxx is really an alias in the following way:

mpicxx --showme
g++ -D_REENTRANT -I/usr//include -Wl,-u,_munmap -Wl,-multiply_defined,suppress -L/usr//lib -lmpi_cxx -lmpi -lopen-rte -lopen-pal -lutil

So /usr/include really becomes before anything else, and that is where mpi.h is located. This is actually pretty weird, because the order is suppose to matter, from what I can gather (http://www.network-theory.co.uk/docs/gccintro/gccintro_21.html).

mpicxx -showme -Idolfin/main test.c
g++ -D_REENTRANT -I/usr//include -Idolfin/main test.c -Wl,-u,_munmap -Wl,-multiply_defined,suppress -L/usr//lib -lmpi_cxx -lmpi -lopen-rte -lopen-pal -lutil

The test above shows that /usr/include is used before dolfin/main, so I do not understand why it doesn't work. It is possible to change the order of system directories and local directories for gcc, maybe Apple has done just that (I am using the g++/mpicxx from Apple XCode).

Something should be done, or else Mac users using dolfin with petsc will not be able to build the demos.

ilmar

Åsmund Ødegård wrote:
On Fri, Mar 14, 2008 at 11:04 PM, Anders Logg <logg@xxxxxxxxx> wrote:
On Fri, Mar 14, 2008 at 07:04:40PM +0100, Ilmar Wilbers wrote:
 > I spent hours today debugging a problem I kept getting when compiling
 > dolfin with petsc (and openmpi) on my Macbook (really, the demos):
 > /usr/local/include/petscmath.h:16: error: 'MPI_Datatype' does not name a
 > type
 > /usr/local/include/petscmath.h:17: error: 'MPI_Datatype' does not name a
 > type
 > /usr/local/include/petscmath.h:294: error: 'MPI_Comm' has not been declared
 > /usr/local/include/petscmath.h:295: error: 'MPI_Comm' has not been declared
 > /usr/local/include/petscmath.h:296: error: 'MPI_Comm' has not been declared
 > /usr/local/include/petsc.h:451: error: 'MPI_Comm' does not name a type
 > /usr/local/include/petsc.h:469: error: expected primary-expression
 > before '(' token
 > [...]
 > /usr/local/include/petscksp.h:528: error: initializer expression list
 > treated as compound expression
 > scons: *** [demo/fem/assembly/cpp/main.o] Error 1
 > scons: building terminated because of errors.
 >
 > I dug deep down in petsc internals, its includes, dependencies etc. At
 > last I found the error, but it had nothing to do with petsc or MPI.
 > Someone had checked in the file MPI.h in dolfin/main. OSX is, just as
 > Windows, case-insensitive (except Åsmunds machine, as he made it
 > case-sensitive). Because petsc.h includes mpi.h, and the flag
 > -I/dolfin/main is present as well as -I/usr/include, petsc tried to
 > include the file dolfin/main/MPI.h, which certainly does not have all
 > the declarations as /usr/include/mpi.h
 >
 > This problem will affect all Mac and Window users. I don't know where
 > the file MPI.h is included, but simply renaming it worked for me. Can
 > the right person (Garth, I saw your name in the file?) rename the file
 > and all places it is used?
 >
 > I guess the conclusion is that we should avoid all file names that,
 > regardless of case, might be used elsewhere.

 I'm not so sure. It would be very difficult if we had to look at all
 other systems when choosing our file names. We have several files that
 are likely to appear elsewhere: init,h, constants.h, basic.h, File.h
 etc. The important thing should be that we define everything under
 our own namespace dolfin:: and install everything under $prefix/dolfin.

 Why does the build system pick up MPI.h from DOLFIN? MPI.h should only
 be available as <dolfin/main/MPI.h> and this is unlikely to appear in
 PETSc.


He is building dolfin demos, remember. And have enabled petsc. In some
petsc file there is a #include "mpi.h" (not very strange) - but
dolfin/main/MPI.h is selected as -I.../dolfin/include comes first on
the mpicxx line.

See?


Åsmund
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References