Re: [EXTERNAL] Re: Compiling GCC 11 for Windows targeting ARM on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You need to install arm-none-eabi-gcc on Linux, because otherwise you
won't be able to build libgcc for arm-none-eabi (note that "arm-none-
eabi-gcc.exe", which is just compiled, can't run on Linux).  You may use
"make all-gcc" and "make install-gcc" to skip libgcc, but a GCC build
without libgcc is almost completely useless (such a build is only useful
if you'll build libgcc manually later, or you are debugging GCC itself).

--
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University


Thank you, Xi, for pointing out the need for the native cross toolchain as well as clarifying the linker flags. I installed the native Linux toolchain for bare-metal ARM, removed my config file edits, and tried again to build for a Windows host targeting ARM.

I am seeing a new error, but it seems to occur further in the build process, so I feel like I'm a step closer. More context around the error is pasted below.

checking whether the arm-none-eabi-gcc     linker (/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [Makefile:13331: configure-target-libstdc++-v3] Error 1

I tried explicitly adding "--disable-shared" to the "configure" script parameters, so I'm confused about why I'm seeing "... supports shared libraries... yes".

Looking at the configure script inside gcc/libstdc++-v3, it seems to test whether "gcc_no_link" is set to "yes" to trigger the error. I looked at how that variable is set, and found this:



cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <stdio.h>
int
main ()
{
printf ("hello world\n");
  ;
  return 0;
}
_ACEOF
# FIXME: Cleanup?
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then :
  gcc_no_link=no
else
  gcc_no_link=yes
fi
if test x$gcc_no_link = xyes; then
  # Setting cross_compile will disable run tests; it will
  # also disable AC_CHECK_FILE but that's generally
  # correct if we can't link.
  cross_compiling=yes
  EXEEXT=
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF



To my untrained eye, it looks like this is trying to link a simple "hello world" executable (ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5') and if that fails, it sets this "gcc_no_link" flag to turn off further attempts to link executables?

I'm really not sure what the bigger picture is here on this build error, but I am guessing that bare metal ARM doesn't support shared libraries and somehow I have convinced the GCC build to try working with shared libraries anyway?



Here is the tail of the build output:

make[2]: Leaving directory '/home/tsobczynski/Compiler/build/arm-none-eabi/libgcc'
Checking multilib configuration for libstdc++-v3...
Configuring in arm-none-eabi/libstdc++-v3
configure: loading cache ./config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-none-eabi
checking target system type... arm-none-eabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-none-eabi-strip... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-none-eabi-gcc... arm-none-eabi-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-none-eabi-gcc     accepts -g... yes
checking for arm-none-eabi-gcc     option to accept ISO C89... none needed
checking whether arm-none-eabi-gcc     understands -c and -o together... yes
checking whether we are using the GNU C++ compiler... yes
checking whether  arm-none-eabi-c++     accepts -g... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... unknown
checking for _LARGE_FILES value needed for large files... unknown
checking how to run the C preprocessor... arm-none-eabi-gcc     -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether ln -s works... yes
checking for arm-none-eabi-as... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/as
checking for arm-none-eabi-ar... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ar
checking for arm-none-eabi-ranlib... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ranlib
checking whether to enable maintainer-specific portions of Makefiles... no
configure: CPU config directory is cpu/arm
configure: OS config directory is os/generic
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by arm-none-eabi-gcc    ... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld
checking if the linker (/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/nm
checking the name lister (/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld option to reload object files... -r
checking for arm-none-eabi-objdump... /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/objdump
checking how to recognize dependent libraries... unknown
checking for arm-none-eabi-ar... (cached) /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ar
checking for arm-none-eabi-strip... (cached) /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/strip
checking for arm-none-eabi-ranlib... (cached) /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ranlib
checking command to parse /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/nm output from arm-none-eabi-gcc     object... failed
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if arm-none-eabi-gcc     supports -fno-rtti -fno-exceptions... no
checking for arm-none-eabi-gcc     option to produce PIC... -fPIC -DPIC
checking if arm-none-eabi-gcc     PIC flag -fPIC -DPIC works... yes
checking if arm-none-eabi-gcc     static flag -static works... no
checking if arm-none-eabi-gcc     supports -c -o file.o... yes
checking if arm-none-eabi-gcc     supports -c -o file.o... (cached) yes
checking whether the arm-none-eabi-gcc     linker (/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [Makefile:13331: configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory '/home/tsobczynski/Compiler/build'


Thanks,
Tom





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux