[asterisk-bugs] [JIRA] (ASTERISK-29583) [patch] BuildSystem: User CFLAGS should always have the last say.
Joshua C. Colp (JIRA)
noreply at issues.asterisk.org
Mon Aug 16 11:12:34 CDT 2021
[ https://issues.asterisk.org/jira/browse/ASTERISK-29583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on ASTERISK-29583 started by Alexander Traud.
> [patch] BuildSystem: User CFLAGS should always have the last say.
> -----------------------------------------------------------------
>
> Key: ASTERISK-29583
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-29583
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Core/BuildSystem
> Affects Versions: 16.20.0, 18.6.0
> Reporter: Alexander Traud
> Assignee: Alexander Traud
> Severity: Major
> Labels: patch
> Attachments: user_cflags_last.patch
>
>
> The manual for {{automake}}, which creates the script {{./configure}}, [states|https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html]: ‘Users should always have the last say.’ However, while investigating a workaround for ASTERISK-29576, I found this issue:{code}CFLAGS='-Wno-error=format-nonliteral' ./configure --enable-dev-mode=noisy{code}
> has to prevent the failure of the build because the only remaining warning, which the developer mode turned into an error, gets disabled. Normally. Alternatively
> {code}ASTCFLAGS='-Wno-error=format-nonliteral' make{code}
> has to do the trick as well.
> However, the current build system puts the user-supplied {{CFLAGS}} not at the end but the very front. Actually, the ones from the script {{./configure}} are copied over into the variable {{CONFIG_CFLAGS}}, which gets the first part of the {{_ASTCFLAGS}} (note the underscore). Much later, {{-Wformat=2}} is appended to {{_ASTCFLAGS}}, which is a [shorthand|https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html] for several warnings including {{-Wformat-nonliteral}}. Therefore, my supplied {{CFLAGS}} get overwritten. Therefore, the error is not turned into a warning. Therefore, the build still fails.
> The attached patch fixes this and puts the {{CFLAGS}} from the script {{./configure}} second last. The {{ASTCFLAGS}} from {{make}} last. Furthermore, it reverts Commit [f1bc280|https://github.com/asterisk/asterisk/commit/f1bc2809b1c3f08c569f4be3af916fb64541ad0d], which fixed Mantis 16685 (now ASTERISK-15501) because the attached patch is considered the correct way of fixing it.
> If you read this here and it broke your script, please, double-check whether you assumed an incorrect behavior. If your script assumed it, double-check if there is no correct way of doing it. If there is no such way, create a new issue and ask the ‘Bug Marshals’ to link this one here (caused-by). I am just an external contributor. That way, I am notified about the introduced issue and might be able to help.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list