Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Sep 2023 07:53:34 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 274039] devel/gcc-arm-embedded: fix build with libc++ 17
Message-ID:  <bug-274039-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274039

            Bug ID: 274039
           Summary: devel/gcc-arm-embedded: fix build with libc++ 17
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: lev@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(lev@FreeBSD.org)
          Assignee: lev@FreeBSD.org

When building relatively recent gcc ports (with C++ in them) against libc++=
 17,
you get errors similar to:

In file included from
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208:
In file included from
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239:
In file included from /usr/include/c++/v1/vector:321:
In file included from /usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /usr/include/c++/v1/locale:202:
/usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute only app=
lies
to structs, variables, functions, and namespaces
  546 |     _LIBCPP_INLINE_VISIBILITY
      |     ^
/usr/include/c++/v1/__config:813:37: note: expanded from macro
'_LIBCPP_INLINE_VISIBILITY'
  813 | #  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
      |                                     ^
/usr/include/c++/v1/__config:792:26: note: expanded from macro
'_LIBCPP_HIDE_FROM_ABI'
  792 |=20=20=20=20=20=20=20=20=20=20
__attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
      |                          ^
In file included from
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208:
In file included from
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239:
In file included from /usr/include/c++/v1/vector:321:
In file included from /usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /usr/include/c++/v1/locale:202:
/usr/include/c++/v1/__locale:547:37: error: expected ';' at end of declarat=
ion
list
  547 |     char_type toupper(char_type __c) const
      |                                     ^
/usr/include/c++/v1/__locale:553:48: error: too many arguments provided to
function-like macro invocation
  553 |     const char_type* toupper(char_type* __low, const char_type* __h=
igh)
const
      |                                                ^
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/../include/safe-ctype.h:1=
46:9:
note: macro 'toupper' defined here
  146 | #define toupper(c) do_not_use_toupper_with_safe_ctype
      |         ^

This is because gcc/system.h includes safe-ctype.h which redefines ctype ma=
cros
such as toupper, tolower, etc to "poison" them.

However, it should only include the safe-ctype.h header *after* any C++
headers, such as <list>, <map>, <string>, etc, otherwise these might
transitively include internal ctype headers (such as with libc++ 17), causi=
ng
the above conflicts.

Here is a patch that moves the safe-ctype.h inclusion to later in gcc/syste=
m.h,
which solves this issue, and makes it possible to build against libc++ 17.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-274039-7788>