[petsc-dev] So CFLAGS no longer works!!!! Major crisis

Barry Smith bsmith at petsc.dev
Wed Apr 26 17:29:09 CDT 2023


  Looks like something like 

ifeq ($(origin CFLAGS),environment)

might work to bring back the old behavior.



> On Apr 26, 2023, at 6:16 PM, Satish Balay <balay at mcs.anl.gov> wrote:
> 
> Not sure how can add deprecation message here - so adding this message to 'changes' doc
> 
> https://gitlab.com/petsc/petsc/-/merge_requests/6382
> 
> Satish
> 
> On Wed, 26 Apr 2023, Satish Balay via petsc-dev wrote:
> 
>> On Wed, 26 Apr 2023, Barry Smith wrote:
>> 
>>> 
>>> 
>>>  Urg, so user makefiles that worked for 25+ years suddenly don't work and that is ok? No deprecation message as Jed would have liked?
>> 
>> I think I raised this issue when 'CFLAGS = ' stuff was removed from all makefiles.
>> 
>> You can view this change as a necessary fix for above cleanup change..
>> 
>> Don't know if there is gnumake syntax where the reset in PETSC_ARCH/lib/conf/petscvaribales can selectively reset only on env variable - but not prior make variable
>> 
>> Right now the fix is to move the 'CFLAGS' line after the the 'include' line
>> 
>> Satish
>> 
>>> 
>>>  So it is from 
>>>    # Avoid picking CFLAGS etc from env - but support 'make CFLAGS=-Werror' etc..
>>>    self.addMakeMacro('CFLAGS','')
>>>    self.addMakeMacro('CPPFLAGS','')
>>>    self.addMakeMacro('CXXFLAGS','')
>>>    self.addMakeMacro('CXXPPFLAGS','')
>>>    self.addMakeMacro('FFLAGS','')
>>>    self.addMakeMacro('FPPFLAGS','')
>>>    self.addMakeMacro('CUDAFLAGS','')
>>>    self.addMakeMacro('CUDAPPFLAGS','')
>>>    self.addMakeMacro('HIPFLAGS','')
>>>    self.addMakeMacro('HIPPPFLAGS','')
>>>    self.addMakeMacro('SYCLFLAGS','')
>>>    self.addMakeMacro('SYCLPPFLAGS','')
>>>    self.addMakeMacro('LDFLAGS','')
>>> 
>>> What was "from env" suppose to mean? You mean environmental variables? 
>>> 
>>> Is there some other way of not automatically using the environmental variables that doesn't break 25 years of user makefile? Since these things all require GNUmake is there some GNUmake-ish way to hand this without breaking current makefiles?
>>> 
>>> 
>>> 
>>> 
>>>> On Apr 26, 2023, at 5:34 PM, Satish Balay <balay at mcs.anl.gov> wrote:
>>>> 
>>>> Well we wanted to always have  CFLAGS initialized by configure [to ignore stuff from env].
>>>> 
>>>> So now - if we are setting in makefile - it has to be set after this default is set - i.e after the line:
>>>> 
>>>> include ${PETSC_DIR}/lib/petsc/conf/variables
>>>> 
>>>> Or do:
>>>> 
>>>> make CFLAGS=garbase ex1
>>>> 
>>>> There might be a different bug lurking here..
>>>> 
>>>> -PETSC_CCOMPILE_SINGLE   = ${CC} -o $*.o -c ${CC_FLAGS} ${FLAGS} ${CPPFLAGS}
>>>> +PETSC_CCOMPILE_SINGLE   = ${CC} -o $*.o -c ${CC_FLAGS} ${CFLAGS} ${CPPFLAGS}
>>>> 
>>>> Satish
>>>> 
>>>> On Wed, 26 Apr 2023, Barry Smith wrote:
>>>> 
>>>>> 
>>>>> $ make ex1
>>>>> mpicc -Wl,-bind_at_load -Wl,-multiply_defined,suppress -Wl,-multiply_defined -Wl,suppress -Wl,-commons,use_dylibs -Wl,-search_paths_first -Wl,-no_compact_unwind  -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fvisibility=hidden -g3 -O0  -I/Users/barrysmith/Src/petsc/include -I/Users/barrysmith/Src/petsc/arch-release/include -I/opt/X11/include      ex1.c  -Wl,-rpath,/Users/barrysmith/Src/petsc/arch-release/lib -L/Users/barrysmith/Src/petsc/arch-release/lib -Wl,-rpath,/opt/X11/lib -L/opt/X11/lib -Wl,-rpath,/Users/barrysmith/soft/mpich-clang-gfortran-opt/lib -L/Users/barrysmith/soft/mpich-clang-gfortran-opt/lib -Wl,-rpath,/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc/aarch64-apple-darwin22/12 -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc/aarch64-apple-darwin22/12 -Wl,-rpath,/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc -Wl,-rpath,/opt/homebrew/Cellar/gcc/12.2
>> .0/lib/g
>> cc/current -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current -lpetsc -llapack -lblas -lX11 -lmpifort -lmpi -lpmpi -lgfortran -lemutls_w -lquadmath -lstdc++ -lquadmath -o ex1
>>>>> ~/Src/petsc/src/snes/tutorials (release *=) arch-release
>>>>> $ more makefile
>>>>> -include ../../../petscdir.mk
>>>>> 
>>>>> MANSEC           = SNES
>>>>> EXAMPLESMATLAB   = ex5m.m ex29view.m
>>>>> DIRS             = ex10d network
>>>>> CLEANFILES       = ex5f90t
>>>>> CFLAGS = garbage
>>>>> 
>>>>> 
>>>>> The new stuff in variables PETSC_COMPILE_SINGLE    = ${PCC} -o $*.o -c ${PCC_FLAGS} ${${CLANGUAGE}FLAGS} ${CCPPFLAGS}  with the recursive use of $ doesn't work? This is on my Mac but Get also has the problem on Polaris
>>> 
>> 
> 



More information about the petsc-dev mailing list