[vlc-devel] [PATCH] contrib: Keep debug and optimization flags separate

Marvin Scholz epirat07 at gmail.com
Wed Jun 12 22:27:25 CEST 2019


On 12 Jun 2019, at 22:02, Rémi Denis-Courmont wrote:

> 	Hello,
>
> As far as I know, -g is not an optimization flag. It does not affect code
> generation.
>

Hi,

indeed it does not affect code generation but it affects how symbols end up
in the binary, which interferes at least with mesons underscore prefix check
(as the binary will have a string of the symbol without underscore and one
with underscore, when compiled with -g).

I can limit it to -g but it seemed better to do it for the optimization
flags too, as meson might overwrite them anyway depending on buildtype.

> And it's a preexisting condition, but we should build -Og, not -O0 - never.

Good point, I can submit a patch for that.

>
> Le mercredi 12 juin 2019, 22:28:41 EEST Marvin Scholz a écrit :
>> Passing the debug symbol flag to meson can cause issues when meson
>> uses these for tests: https://github.com/mesonbuild/meson/issues/5482
>>
>> The meson buildtype is already set to debug or release, so passing
>> the arguments is redundant.
>> ---
>>  contrib/src/main.mak | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
>> index 3f40b3b485..99b408065e 100644
>> --- a/contrib/src/main.mak
>> +++ b/contrib/src/main.mak
>> @@ -183,21 +183,21 @@ cppcheck = $(shell $(CC) $(CFLAGS) -E -dM - <
>> /dev/null | grep -E $(1))
>>
>>  EXTRA_CFLAGS += -I$(PREFIX)/include
>>  CPPFLAGS := $(CPPFLAGS) $(EXTRA_CFLAGS)
>> -CFLAGS := $(CFLAGS) $(EXTRA_CFLAGS) -g
>> -CXXFLAGS := $(CXXFLAGS) $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS) -g
>> +CFLAGS := $(CFLAGS) $(EXTRA_CFLAGS)
>> +CXXFLAGS := $(CXXFLAGS) $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS)
>>  LDFLAGS := $(LDFLAGS) -L$(PREFIX)/lib $(EXTRA_LDFLAGS)
>>
>> +OPTIMFLAGS := -g
>> +
>>  ifdef ENABLE_PDB
>>  CFLAGS := $(CFLAGS) -gcodeview
>>  CXXFLAGS := $(CXXFLAGS) -gcodeview
>>  endif
>>
>>  ifndef WITH_OPTIMIZATION
>> -CFLAGS := $(CFLAGS) -O0
>> -CXXFLAGS := $(CXXFLAGS) -O0
>> +OPTIMFLAGS += -O0
>>  else
>> -CFLAGS := $(CFLAGS) -O2
>> -CXXFLAGS := $(CXXFLAGS) -O2
>> +OPTIMFLAGS += -O2
>>  endif
>>
>>  # Do not export those! Use HOSTVARS.
>> @@ -320,13 +320,13 @@ HOSTTOOLS := \
>>  	PATH="$(PREFIX)/bin:$(PATH)"
>>  HOSTVARS := \
>>  	CPPFLAGS="$(CPPFLAGS)" \
>> -	CFLAGS="$(CFLAGS)" \
>> -	CXXFLAGS="$(CXXFLAGS)" \
>> +	CFLAGS="$(CFLAGS) $(OPTIMFLAGS)" \
>> +	CXXFLAGS="$(CXXFLAGS) $(OPTIMFLAGS)" \
>>  	LDFLAGS="$(LDFLAGS)"
>>  HOSTVARS_PIC := $(HOSTTOOLS) \
>>  	CPPFLAGS="$(CPPFLAGS) $(PIC)" \
>> -	CFLAGS="$(CFLAGS) $(PIC)" \
>> -	CXXFLAGS="$(CXXFLAGS) $(PIC)" \
>> +	CFLAGS="$(CFLAGS) $(OPTIMFLAGS) $(PIC)" \
>> +	CXXFLAGS="$(CXXFLAGS) $(OPTIMFLAGS) $(PIC)" \
>>  	LDFLAGS="$(LDFLAGS)"
>>
>>  # For cross-compilation with meson, do not set compiler and flags
>
>
> -- 
> Rémi Denis-Courmont
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list