Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29982

Redefinition of _FORTIFY_SOURCE causes build failure with misleading error message

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Fully Compatible
    • ALL

      Apparently gcc provided by certain Linux vendors automatically defines _FORTIFY_SOURCE internally. This leads to build failure when not using --disable-warnings-as-errors. The error message leads you to believe your compiler can't be used to build MongoDB:

      Checking for glibc with non-broken _FORTIFY_SOURCE...yes
      Checking if C compiler supports -fno-builtin-memcmp... no
      Checking for storage class thread_local no
      Checking for storage class __thread no
      Checking for storage class __declspec(thread) no
      Compiler must support a thread local storage class for trivially constructible types
      See /home/behackett/work/mongo/build/scons/config.log for details
      

      This is with gcc 6.3 on Gentoo Linux. I'm attaching the scons config.log for details.

      $ gcc --version
      gcc (Gentoo 6.3.0 p1.0) 6.3.0
      

      We should probably fix the redefinition problem, or at least provide a more accurate error message. Building with --disable-warnings-as-errors works around the problem, but scons spews warnings about _FORTIFY_SOURCE non-stop throughout the build.

      <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
      <built-in>: note: this is the location of the previous definition
      <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
      <built-in>: note: this is the location of the previous definition
      ....
      

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: