_FORTIFY_SOURCE is still at 2 when dpkg-buildflags has it at 3

Bug #2052483 reported by Charles F. Stephens
6
This bug affects 1 person
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="-Wdate-time -D_FORTIFY_SOURCE=2"

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-github-containers-storage build in noble:

# 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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.