lundi 31 juillet 2017

GNU GCC bug when using both sysroot and c++11?

I'm encountering a very strange issue. I've used Yocto Project to generate me an ARM toolchain/RFS. This in itself may not important since I've since replicated the same issue with a pre-made ARM toolchain (still using the Yocto-generated RFS).

Consider the simple file foo.cpp:

#include <memory>
int main() { return 0; }

I am able to compile it with either --sysroot=... or -std=c++11 flags, but never both.

For example, the following compiles fine:

aarch64-linux-gnu-g++ --sysroot=/opt/sysroots/my_sysroot foo.cpp

This also compiles fine:

aarch64-linux-gnu-g++ -std=c++11 foo.cpp

However, this does not work:

aarch64-linux-gnu-g++ --sysroot=/opt/sysroots/my_sysroot -std=c++11 foo.cpp

The compiler error I get is:

In file included from foo.cpp:2:0:
/opt/marvell/5.2.1/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_x86_64_20151110/aarch64-linux-gnu/include/c++/5.2.1/memory: In function 'void* std::align(std::size_t, std::size_t, void*&, std::size_t&)':
/opt/marvell/5.2.1/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_x86_64_20151110/aarch64-linux-gnu/include/c++/5.2.1/memory:117:58: error: cast from 'void*' to 'uintptr_t {aka unsigned int}' loses precision [-fpermissive]
   const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);

Compiler information:

Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-g++
COLLECT_LTO_WRAPPER=/opt/marvell/5.2.1/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_x86_64_20151110/bin/../libexec/gcc/aarch64-linux-gnu/5.2.1/lto-wrapper
Target: aarch64-linux-gnu
Configured with: /home/gccbuilder-x86/release/mgcc5.0/src/gcc-src/configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu --target=aarch64-linux-gnu --prefix=/home/gccbuilder-x86/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_x86_64 --enable-libssp --enable-shared --enable-threads --enable-lto --enable-libgomp --enable-gnu-indirect-function --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-pkgversion='Marvell GCC release 20151110-a53c013d' --with-bugurl=mailto:mrvlgccbug@gmail.com --with-sysroot=/home/gccbuilder-x86/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_x86_64/aarch64-linux-gnu/libc --with-build-sysroot=/home/gccbuilder-x86/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_x86_64/aarch64-linux-gnu/libc --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-build-time-tools=/home/gccbuilder-x86/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_x86_64/aarch64-linux-gnu/bin --enable-poison-system-directories --enable-symvers=gnu --enable-__cxa_atexit --enable-multiarch --enable-linker-build-id --disable-nls --disable-libstdcxx-pch --disable-libcc1 --with-specs='%{funwind-tables|fno-unwind-tables|ffreestanding|nostdlib:;:-funwind-tables}' --disable-multilib
Thread model: posix
gcc version 5.2.1 20151103 (Marvell GCC release 20151110-a53c013d) 

Any insights on how to go about debugging this? I want to determine which party is responsible (GCC, Yocto, Marvell, etc) before attempting to file a bug report.

Aucun commentaire:

Enregistrer un commentaire