http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50342

             Bug #: 50342
           Summary: gcc/configure fails on Mac OS X Lion/Xcode 4.1 if
                    building Ada
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: si...@pushface.org


Created attachment 25234
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25234
May help to demonstrate failure mode

When building with --enable-languages=c,ada you have to use an Ada-capable
compiler, so you can't use Apple's. I used GCC 4.6.0.

This fails in gcc/configure; eg, from config.log,

    configure:5860: checking size of long long
    configure:5865: gcc -o conftest -g -fkeep-inline-functions conftest.c  >&5
    Undefined symbols for architecture x86_64:
      "___builtin___stpncpy_chk", referenced from:
          ___inline_stpncpy_chk in ccgrb5E9.o
    ld: symbol(s) not found for architecture x86_64

because Apple's gcc (4.2.1) has the builtin and GCC 4.6.0 doesn't.

I found that if I remove the -fkeep-inline-functions the configure succeeds
(make check-ada, check-fortran, check-c++ were OK, I chopped check-c because it
was swapping unacceptably).

I expect that if I could figure a way of passing -D_FORTIFY_SOURCE=0 to the gcc
call at configure:5865 (presumably to other gcc calls as well; I know the
'checking size of' ones all fail but not so immediately fatally, you just get
size of long = 0).

<string.h> says

#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
/* Security checking functions.  */
#include <secure/_string.h>
#endif

<_types.h> says

#ifndef _FORTIFY_SOURCE
#  if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&
((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050)
#    define _FORTIFY_SOURCE 0
#  else
#    define _FORTIFY_SOURCE 2    /* on by default */
#  endif
#endif

The attached code fails as above if compiled with FSF GCC and
-fkeep-inline-functions unless you say -D_FORTIFY_SOURCE=0 .

Reply via email to