[petsc-dev] CFLAGS / LDFLAGS and cxx error

Satish Balay balay at mcs.anl.gov
Wed Jul 28 16:27:38 CDT 2010


If the compilers default to 64bit - and you need 32bit build - I
recommend doing:

./configure --with-cc='gcc -m32' --with-cxx='g++ -m32'
--with-fc='gfortran -m32' [and other desired options]

In your case you want -with-fc=0 - which is fine. [and '-arch i386'
instead of -m32 - which is also fine]

Satish

On Wed, 28 Jul 2010, Wesley Smith wrote:

> I was trying to set the -arch flag for compilation and linking, but it
> seems to interfere somehow with the cxx compiler.  Even providing one
> explicitly doesn't seem to work.  Is there a way to force compilation
> as i386 instead of x86_64?
> 
> bleeps:petsc-dev wesleysmith$ ./configure --with-cc=gcc
> --with-clanguage=cxx --download-boost --with-fc=0 --download-parmetis
> --with-shared --with-dynamic --download-mpich --with-sieve
> --CFLAGS="-arch i386" --LDFLAGS="-arch i386"
> ===============================================================================
>              Configuring PETSc to compile on your system
> ===============================================================================
> TESTING: check from
> config.libraries(config/BuildSystem/config/libraries.py:133)
> 
>            *******************************************************************************
>          UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log
> for details):
> -------------------------------------------------------------------------------
> Could not find a CXX compiler. Please set with the option --with-cxx
> or -CXX and load the config.compilers module.
> *******************************************************************************
> 
> bleeps:petsc-dev wesleysmith$ ./configure --with-cc=gcc
> --with-clanguage=cxx --download-boost --with-fc=0 --download-parmetis
> --with-shared --with-dynamic --download-mpich --with-sieve
> --CFLAGS="-arch i386" --LDFLAGS="-arch i386" --with-cxx=g++
> ===============================================================================
>              Configuring PETSc to compile on your system
> ===============================================================================
> TESTING: checkCxxCompiler from
> config.setCompilers(config/BuildSystem/config/setCompilers.py:638)
> 
> *******************************************************************************
>          UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log
> for details):
> -------------------------------------------------------------------------------
> C++ compiler you provided with -with-cxx=g++ does not work
> *******************************************************************************
> 
> bleeps:petsc-dev wesleysmith$ ./configure --with-cc=gcc
> --with-clanguage=cxx --download-boost --with-fc=0 --download-parmetis
> --with-shared --with-dynamic --download-mpich --with-sieve
> --CFLAGS="-arch i386" --LDFLAGS="-arch i386" --with-cxx=gcc
> ===============================================================================
>              Configuring PETSc to compile on your system
> ===============================================================================
> TESTING: checkCxxCompiler from
> config.setCompilers(config/BuildSystem/config/setCompilers.py:638)
> 
> *******************************************************************************
>          UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log
> for details):
> -------------------------------------------------------------------------------
> Cannot use C compiler gcc as the C++ compiler passed in with --with-cxx
> *******************************************************************************
> 




More information about the petsc-dev mailing list