_FORTIFY_SOURCE is still at 2 when dpkg-buildflags has it at 3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dh-golang (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
dh-golang exports CGO_CPPFLAGS starting in version 1.42 (#951262):
CGO_CPPFLAGS=
However with the release of dpkg 1.22.2ubuntu1, the dpkg-buildflags value defaults to 3. This causes cgo programs to fail with a warning that _FORTIFY_SOURCE is redefined. Example from golang-
# runtime/cgo
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
The workaround is to explicitly export CGO_FLAGS in the rules file omitting _FORTIFY_SOURCE.
Suggested fix is to reconcile the two flag settings from dpkg-buildflags, or have dh-golang use dpkg-buildflags CGO vars as canon.