[petsc-dev] CFLAGS / LDFLAGS and cxx error

Barry Smith bsmith at mcs.anl.gov
Wed Jul 28 13:30:52 CDT 2010

On Jul 28, 2010, at 1:12 PM, Wesley Smith wrote:

> On Wed, Jul 28, 2010 at 11:10 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>  You are passing the CFLAGS="-arch i386"  to C but not g++ hence g++ is using the 64 bit. You need to set CXXFLAGS also to use 32 bit.
> yes, but why would it not be able to find any CXX compiler when
> setting those flags?

    If you look at the configure.log in detail you can see why. The g++ test works,. but then it does a test to see if the g++ and gcc compilers can be used together this fails because they are built with different arches.


sh: g++ -c -o conftest.o     conftest.cc 
Executing: g++ -c -o conftest.o     conftest.cc 

Executing: g++  -o conftest -arch i386   conftest.o 
Possible ERROR while running linker: ld: warning: in conftest.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found

More information about the petsc-dev mailing list