[petsc-dev] CFLAGS / LDFLAGS and cxx error

Barry Smith bsmith at mcs.anl.gov
Wed Jul 28 13:53:40 CDT 2010


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

> that's interesting.  I had just assumed at CFLAGS would be
> concatenated onto CXXFLAGS.  

  Nope, they are completely distinct to handle the rare cases where the c++ compiler doesn't like all the valid flags that the C compiler accepts. Is there a way we could have made this fact obvious to users?


   Barry


> I see that this isn't the case.  I'll try
> again.
> 
> wes
> 
> On Wed, Jul 28, 2010 at 11:30 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>> 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.
>> 
>>   Barry
>> 
>> sh: g++ -c -o conftest.o     conftest.cc
>> Executing: g++ -c -o conftest.o     conftest.cc
>> 
>> Executing: g++  -o conftest -arch i386   conftest.o
>> sh:
>> 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