foss-for-synopsys-dwc-arc-processors / binutils-gdb

A mirror of the upstream binutils-gdb repository for ARC specific work
GNU General Public License v2.0
13 stars 10 forks source link

[GDB] error: ‘is_trivially_default_constructible’ is not a member of ‘std’ #53

Closed falaleevms closed 3 years ago

falaleevms commented 3 years ago

Building gdb failed with following error when take all components from arc-2021.03 branches:

$ x86_64-build_pc-linux-gnu-g++ -x c++ -std=gnu++11 -c trad-frame.i
/SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu3/workspace/arcoss_verification/arc_gnu_toolchain_verification/build_toolchain/crosstool-ng/.build/arc-multilib-elf/src/gdb/gdb/trad-frame.c: In function ‘trad_frame_saved_reg* trad_frame_alloc_saved_regs(gdbarch*)’:
/SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu3/workspace/arcoss_verification/arc_gnu_toolchain_verification/build_toolchain/crosstool-ng/.build/arc-multilib-elf/src/gdb/gdb/trad-frame.c:63:18: error: ‘is_trivially_default_constructible’ is not a member of ‘std’
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
                  ^
/SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu3/workspace/arcoss_verification/arc_gnu_toolchain_verification/build_toolchain/crosstool-ng/.build/arc-multilib-elf/src/gdb/gdb/trad-frame.c:63:78: error: expected primary-expression before ‘>’ token
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
                                                                              ^
/SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu3/workspace/arcoss_verification/arc_gnu_toolchain_verification/build_toolchain/crosstool-ng/.build/arc-multilib-elf/src/gdb/gdb/trad-frame.c:63:86: error: expected primary-expression before ‘,’ token
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);

Attaching trad-frame.i.txt

shahab-vahedi commented 3 years ago

I could not reproduce the problem on my side. @falaleevms Could you share the build-all.sh flags and the versions/tags of the projects involved?

falaleevms commented 3 years ago

@shahab-vahedi,

./build-all.sh --no-pdf --no-system-expat --strip --no-auto-pull --no-auto-checkout --no-native-gdb --no-optsize-newlib --no-optsize-libstdc++ --external-download --uclibc-build-in-src-tree --jobs 1 --elf32 --no-uclibc --install-dir /slowfs/ru20arcgnu1/gnu_verification/builds/200_04.02.2021_scripts/arc-default-elf32 --config-extra --with-python=no --release-name 'nightly build 192'

toolchain: arc-dev (a9fac874613093995476e8356871a184f891af61) newlib: arc-2021.03 (01da4b3544d8b63c68992862678dd6bf805a2290) binutils: arc-2021.03 (a23bf9b30b816c30877d832e9e10bb9ce608cd56) gdb: arc-2021.03 (a23bf9b30b816c30877d832e9e10bb9ce608cd56) gcc: arc-2021.03 (ea1e893c35c106954539081d0d1d8a1055f9d73b)

abrodkin commented 3 years ago

FWIW gets reproduced on CentOS 7.x with just GDB sources:

git checkout arc-2021.03
mkdir build
cd build
../configure --target=arc-elf32 --with-cpu=arc700 --enable-fast-install=N/A --with-endian=little --disable-werror --enable-languages=c,c++ --disable-shared --disable-tls --disable-threads --with-gnu-as --with-gnu-ld --with-python=no --disable-ld --disable-gas --disable-binutils --enable-targets=arc-linux-uclibc
make

...

make[2]: Entering directory `/SCRATCH/abrodkin/Projects/sources/git/binutils-gdb/build/gdb'
  CXX    ada-exp.o
  CXX    c-exp.o
  CXX    trad-frame.o
In file included from ../../gdb/../gdbsupport/gdb_string_view.h:49:0,
                 from ../../gdb/../gdbsupport/common-utils.h:46,
                 from ../../gdb/../gdbsupport/common-defs.h:125,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/trad-frame.c:20:
../../gdb/trad-frame.c: In function ‘trad_frame_saved_reg* trad_frame_alloc_saved_regs(gdbarch*)’:
../../gdb/trad-frame.c:63:22: error: ‘is_trivially_default_constructible’ is not a member of ‘std’
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
                      ^
../../gdb/../gdbsupport/gdb_assert.h:27:48: note: in definition of macro ‘gdb_static_assert’
 #define gdb_static_assert(expr) static_assert (expr, "")
                                                ^
../../gdb/trad-frame.c:63:82: error: expected primary-expression before ‘>’ token
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
                                                                                  ^
../../gdb/../gdbsupport/gdb_assert.h:27:48: note: in definition of macro ‘gdb_static_assert’
 #define gdb_static_assert(expr) static_assert (expr, "")
                                                ^
../../gdb/../gdbsupport/gdb_assert.h:27:52: error: expected primary-expression before ‘,’ token
 #define gdb_static_assert(expr) static_assert (expr, "")
                                                    ^
../../gdb/trad-frame.c:63:3: note: in expansion of macro ‘gdb_static_assert’
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
   ^
make[2]: *** [trad-frame.o] Error 1

Host gcc is 4.8.5:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
abrodkin commented 3 years ago

And here we are: with GCC 5.0+ it builds, as C++11 is not fully supported by GCC versions below 5.0. See similar discussion here: https://github.com/ceres-solver/ceres-solver/issues/472. There they point to https://en.cppreference.com/w/cpp/types/is_default_constructible where it's possible to build a test snippet with different versions of GCC, and as expected, it builds only with GCC 5.0+.

I'd think that problem got introduced by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=098caef485a4ece6096e6cdbb4cd9726e4a13386, which is apparently in the upstream master branch and not in gdb-10-branch.

So we may either move to gdb-10-branch as a base for a time being, or declare CentOS/RHEL 7.x not supported by ARC GNU prebuilt toolchains.

shahab-vahedi commented 3 years ago

@abrodkin Thanks for your analysis on this. I am in favor of the latter option. We should be thinking of going forward (when v10.2 is out), not the other way.

cupertinomiranda commented 3 years ago

I don't fully understand this issue and I assume this is really an issue with GDB. So Shahab is the authority. However, with the CentOS being deprecated by RedHat (now owned by IBM), number one can soon be an option. Rule of thumb should be to follow whatever happens upstream.

shahab-vahedi commented 3 years ago

To be clear, our arc-2021.03-gdb branch is based on gdb-10.1-release (a fork of gdb-10-branch).

shahab-vahedi commented 3 years ago

It seems the wrong branch (arc-2021-03) was being used instead of the correct one (arc-2021.03-gdb). This problem is not reproducible anymore.

This might become an issue for the next release too.