[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compiler flag issues

From: Werner LEMBERG
Subject: compiler flag issues
Date: Thu, 28 Nov 2019 09:13:20 +0100 (CET)

Most developers expect that you can easily adjust C++ compiler flags
in a GNU package using CXXFLAGS.  With LilyPond, however, this is
quite problematic.  Reason is that it internally uses the following
variables to compute the final list of compiler flags (see files
`c++-vars.make` and `aclocal.m4`):

  OPTIMIZE = <see configure flags --optimize et al.>
  SANITIZE = <see configure flag --enable-ubsan>

             $OPTIMIZE \

  EXTRA_CXXFLAGS = -W -Wall -Wconversion

                   $(CONFIG_CPPFLAGS) \
                   $(DEFINES) \

                 $(ALL_CXXPPFLAGS) \
                 $($(PACKAGE)_CXXFLAGS) \
                 $(CONFIG_CXXFLAGS) \
                 $(MODULE_CXXFLAGS) \

As an example, the quite frequent idiom to disable optimization with

  ./configure CXXFLAGS="-O0"

fails because $OPTIMIZE overrides this.  Similarly, it is not possible
to disable a warning like

  ./configure CXXFLAGS="-Wno-sign-conversion

since it gets overridden by the `-Wall -W -Wconversion` options in
$EXTRA_CXXFLAGS.  Instead, you have to say

  make EXTRA_CXXFLAGS="-W -Wall -Wconversion -Wno-sign-conversion"

(completely bypassing the configuring step) to disable sign conversion

This is very, very non-standard and completely undocumented.

Any idea how this could be improved?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]