Fail to build from source gcc with armv8 support

Bug #1717502 reported by TiN
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Fix Released
Undecided
Unassigned

Bug Description

Hi, I was building last release and I got the following error trying to build from source. The parameters used are the followings:

# ../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man --enable-languages=c,c\+\+,lto --enable-multilib --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --build=x86_64-linux-gnu --target=arm-none-eabi --with-system-zlib --with-gnu-as --with-gnu-ld --with-pkgversion=15:6.3.1\+svn251940-1 --without-included-gettext --prefix=/usr/lib --infodir=/usr/share/doc/gcc-arm-none-eabi/info --htmldir=/usr/share/doc/gcc-arm-none-eabi/html --pdfdir=/usr/share/doc/gcc-arm-none-eabi/pdf --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --disable-libstdc\+\+-v3 --host=x86_64-linux-gnu --with-headers=no --without-newlib --with-multilib-list=rmprofile "CFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." "CPPFLAGS=-Wdate-time" "CXXFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." "FCFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." "FFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." "GCJFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." LDFLAGS=-Wl,-z,relro "OBJCFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." "OBJCXXFLAGS=-g -O2 -fdebug-prefix-map=$PWD/gcc-arm-none-eabi-6.3.1+svn251940=." INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 AR_FOR_TARGET=arm-none-eabi-ar AS_FOR_TARGET=arm-none-eabi-as LD_FOR_TARGET=arm-none-eabi-ld NM_FOR_TARGET=arm-none-eabi-nm OBJDUMP_FOR_TARGET=arm-none-eabi-objdump RANLIB_FOR_TARGET=arm-none-eabi-ranlib READELF_FOR_TARGET=arm-none-eabi-readelf STRIP_FOR_TARGET=arm-none-eabi-strip

I think the most relevant parameter is `--without-newlib`, but I'm not completely sure because I didn't try building without this parameter. I looked at the recipe `build-toolchain.sh` and as far I can see the only parameter different is this. The error that I get:

/<<BUILDDIR>>/gcc-arm-none-eabi-6.3.1+svn251940/build/./gcc/xgcc -B/<<BUILDDIR>>/gcc-arm-none-eabi-6.3.1+svn251940/build/./gcc/ -B/usr/lib/arm-none-eabi/bin/ -B/usr/lib/arm-none-eabi/lib/ -isystem /usr/lib/arm-none-eabi/include -isystem /usr/lib/arm-none-eabi/sys-include -g -O2 -mthumb -march=armv8-m.base -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fno-inline -I. -I. -I../../../.././gcc -I../../../../../src/libgcc -I../../../../../src/libgcc/. -I../../../../../src/libgcc/../gcc -I../../../../../src/libgcc/../include -o _thumb1_case_sqi.o -MT _thumb1_case_sqi.o -MD -MP -MF _thumb1_case_sqi.dep -DL_thumb1_case_sqi -xassembler-with-cpp -c ../../../../../src/libgcc/config/arm/lib1funcs.S -include _thumb1_case_sqi.vis
In file included from /<<BUILDDIR>>/gcc-arm-none-eabi-6.3.1+svn251940/build/gcc/include/arm_cmse.h:38:0,
                 from ../../../../../src/libgcc/config/arm/cmse.c:27:
/<<BUILDDIR>>/gcc-arm-none-eabi-6.3.1+svn251940/build/gcc/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
../../../../../src/libgcc/config/arm/t-arm:14: recipe for target 'cmse.o' failed
make[6]: *** [cmse.o] Error 1

Applying the patch attached, it builds ok. So my best guess is that something is missing when you added support for armv8 and it is mandatory to build with newlib.

Revision history for this message
TiN (agustinhenze) wrote :
description: updated
Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

>Applying the patch attached, it builds ok. So my best guess is that something is missing when you added support for armv8 and it is mandatory to build with newlib.

I shouldn't be. Thanks for your fix. I think a more appropriate fix is to remove standard headers' dependency from arm_cmse.h which will enable gcc and its runtime to build --with-headers=no and --without-newlib.

Revision history for this message
TiN (agustinhenze) wrote :

Hi, yes I think you are right the proper fix is avoiding the standard headers there. I gave a try but of course it didn't work so easily :).

../../../../../src/libgcc/config/arm/cmse.c:39:7: error: 'UINTPTR_MAX' undeclared (first use in this function)
   if (UINTPTR_MAX - (uintptr_t) p < size)
       ^~~~~~~~~~~

As I can't test it, I'm not going to write the patch. If someone can, I'll really appreciate it

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Removing dependency on std headers involves replacing all the std macros with GCC internal predefines eg. __UINTPTR_MAX__ (https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html).

Changed in gcc-arm-embedded:
milestone: none → 7-2018-q2-update
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.