[Bug 2052483] [NEW] _FORTIFY_SOURCE is still at 2 when dpkg-buildflags has it at 3

Charles F. Stephens 2052483 at bugs.launchpad.net
Tue Feb 6 01:15:25 UTC 2024


Public bug reported:

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.

** Affects: dh-golang (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dh-golang in Ubuntu.
https://bugs.launchpad.net/bugs/2052483

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

Status in dh-golang package in Ubuntu:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dh-golang/+bug/2052483/+subscriptions




More information about the foundations-bugs mailing list