Skip to content
Advertisement

glibc Cross Compile Configure Error

I would like to cross compile glibc. But, I ‘m getting an error.

  • glibc version is 2.24.
  • I tried compiling host and target i686-elf.
  • My $MACHTYPE environment label is x86_64-pc-linux-gnu.
  • Target directory includes binutils-2.27 and gcc-6.2.0.
  • My PATH environment is:

    /home/ercan/cross/tools/tools_binaries/i686/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Console output have been listing to below:

ercan@SAMSUNG ~/cross/tools/tools_sources/build-glibc $ ../glibc-2.24/configure --prefix="/home/ercan/cross/tools/tools_binaries/i686/i686-elf" --build=$MACHTYPE --host=i686-elf --target=i686-elf --with-headers="/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include" libc_cv_forced_unwind=yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... i686-pc-elf
checking for i686-elf-gcc... i686-elf-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-elf-gcc accepts -g... yes
checking for gcc... gcc
checking for i686-elf-readelf... i686-elf-readelf
checking for i686-elf-g++... i686-elf-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i686-elf-g++ accepts -g... yes
checking whether i686-elf-g++ can link programs... no
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nacl nios2 powerpc s390 sh sparc tile x86_64 
configure: running configure fragment for add-on libidn
configure: error: 
*** The GNU C library is currently unavailable for this platform.
*** If you are interested in seeing glibc on this platform visit
*** the "How to submit a new port" in the wiki:
***   https://sourceware.org/glibc/wiki/#Development
*** and join the community!

It is not configured and config.log that is in build-glibc which content has been listing below:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by GNU C Library configure (see version.h), which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ../glibc-2.24/configure --prefix=/home/ercan/cross/tools/tools_binaries/i686/i686-elf --build=x86_64-pc-linux-gnu --host=i686-elf --target=i686-elf --with-headers=/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include libc_cv_forced_unwind=yes

## --------- ##
## Platform. ##
## --------- ##

hostname = SAMSUNG
uname -m = x86_64
uname -r = 4.4.0-21-generic
uname -s = Linux
uname -v = #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /home/ercan/cross/tools/tools_binaries/i686/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2189: checking build system type
configure:2203: result: x86_64-pc-linux-gnu
configure:2223: checking host system type
configure:2236: result: i686-pc-elf
configure:2265: checking for i686-elf-gcc
configure:2281: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-gcc
configure:2292: result: i686-elf-gcc
configure:2561: checking for C compiler version
configure:2570: i686-elf-gcc --version >&5
i686-elf-gcc (GCC) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2581: $? = 0
configure:2570: i686-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=i686-elf-gcc
COLLECT_LTO_WRAPPER=/home/ercan/cross/tools/tools_binaries/i686/libexec/gcc/i686-elf/6.2.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc-6.2.0/configure --target=i686-elf --prefix=/home/ercan/cross/tools/tools_binaries/i686 --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 6.2.0 (GCC) 
configure:2581: $? = 0
configure:2570: i686-elf-gcc -V >&5
i686-elf-gcc: error: unrecognized command line option '-V'
i686-elf-gcc: fatal error: no input files
compilation terminated.
configure:2581: $? = 1
configure:2570: i686-elf-gcc -qversion >&5
i686-elf-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
i686-elf-gcc: fatal error: no input files
compilation terminated.
configure:2581: $? = 1
configure:2586: checking for suffix of object files
configure:2608: i686-elf-gcc -c   conftest.c >&5
configure:2612: $? = 0
configure:2633: result: o
configure:2637: checking whether we are using the GNU C compiler
configure:2656: i686-elf-gcc -c   conftest.c >&5
configure:2656: $? = 0
configure:2665: result: yes
configure:2674: checking whether i686-elf-gcc accepts -g
configure:2694: i686-elf-gcc -c -g  conftest.c >&5
configure:2694: $? = 0
configure:2735: result: yes
configure:2764: checking for gcc
configure:2780: found /usr/bin/gcc
configure:2791: result: gcc
configure:2815: checking for i686-elf-readelf
configure:2831: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-readelf
configure:2842: result: i686-elf-readelf
configure:2920: checking for i686-elf-g++
configure:2936: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-g++
configure:2947: result: i686-elf-g++
configure:3018: checking for C++ compiler version
configure:3027: i686-elf-g++ --version >&5
i686-elf-g++ (GCC) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3038: $? = 0
configure:3027: i686-elf-g++ -v >&5
Using built-in specs.
COLLECT_GCC=i686-elf-g++
COLLECT_LTO_WRAPPER=/home/ercan/cross/tools/tools_binaries/i686/libexec/gcc/i686-elf/6.2.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc-6.2.0/configure --target=i686-elf --prefix=/home/ercan/cross/tools/tools_binaries/i686 --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 6.2.0 (GCC) 
configure:3038: $? = 0
configure:3027: i686-elf-g++ -V >&5
i686-elf-g++: error: unrecognized command line option '-V'
i686-elf-g++: fatal error: no input files
compilation terminated.
configure:3038: $? = 1
configure:3027: i686-elf-g++ -qversion >&5
i686-elf-g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
i686-elf-g++: fatal error: no input files
compilation terminated.
configure:3038: $? = 1
configure:3042: checking whether we are using the GNU C++ compiler
configure:3061: i686-elf-g++ -c   conftest.cpp >&5
configure:3061: $? = 0
configure:3070: result: yes
configure:3079: checking whether i686-elf-g++ accepts -g
configure:3099: i686-elf-g++ -c -g  conftest.cpp >&5
configure:3099: $? = 0
configure:3140: result: yes
configure:3165: checking whether i686-elf-g++ can link programs
configure:3188: i686-elf-g++ -o conftest -g -O2   conftest.cpp  >&5
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crtbegin.o: No such file or directory
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lstdc++
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lm
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lg
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crtend.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3188: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| #define PACKAGE_URL "http://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3211: i686-elf-g++ -o conftest -g -O2   -static conftest.cpp  >&5
conftest.cpp:12:20: fatal error: iostream: No such file or directory
 #include <iostream>
                    ^
compilation terminated.
configure:3211: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| #define PACKAGE_URL "http://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h.  */
| 
| #include <iostream>
| 
| int
| main()
| {
|   std::cout << "Hello, world!";
|   return 0;
| }
| 
configure:3226: result: no
configure:3709: checking for sysdeps preconfigure fragments
configure:3716: result: 
configure:3787: running configure fragment for add-on libidn
configure:3868: error: 
*** The GNU C library is currently unavailable for this platform.
*** If you are interested in seeing glibc on this platform visit
*** the "How to submit a new port" in the wiki:
***   https://sourceware.org/glibc/wiki/#Development
*** and join the community!

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-pc-linux-gnu
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=i686-elf
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=i686-elf
ac_cv_host=i686-pc-elf
ac_cv_objext=o
ac_cv_prog_BUILD_CC=gcc
ac_cv_prog_CC=i686-elf-gcc
ac_cv_prog_CXX=i686-elf-g++
ac_cv_prog_READELF=i686-elf-readelf
ac_cv_prog_cc_g=yes
ac_cv_prog_cxx_g=yes
libc_cv_cxx_link_ok=no
libc_cv_forced_unwind=yes
libc_cv_nss_crypt=no

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
AS=''
ASFLAGS_config=''
AUTOCONF=''
AWK=''
BASH_SHELL=''
BISON=''
BUILD_CC='gcc'
CC='i686-elf-gcc'
CFLAGS='-g -O2'
CPP='i686-elf-gcc -E'
CPPFLAGS=''
CPPUNDEFS=''
CXX=''
CXXFLAGS='-g -O2'
CXX_SYSINCLUDES=''
DEFINES=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
INSTALL_DATA=''
INSTALL_INFO=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LD=''
LDFLAGS=''
LIBGD=''
LIBOBJS=''
LIBS=''
LN_S=''
LTLIBOBJS=''
MAKE=''
MAKEINFO=''
MSGFMT=''
NM=''
OBJCOPY=''
OBJDUMP=''
OBJEXT='o'
PACKAGE_BUGREPORT='http://sourceware.org/bugzilla/'
PACKAGE_NAME='GNU C Library'
PACKAGE_STRING='GNU C Library (see version.h)'
PACKAGE_TARNAME='glibc'
PACKAGE_URL='http://www.gnu.org/software/glibc/'
PACKAGE_VERSION='(see version.h)'
PATH_SEPARATOR=':'
PERL=''
PKGVERSION='(GNU libc) '
PKGVERSION_TEXI='(GNU libc) '
READELF='i686-elf-readelf'
RELEASE=''
REPORT_BUGS_TEXI='@uref{http://www.gnu.org/software/libc/bugs.html}'
REPORT_BUGS_TO='<http://www.gnu.org/software/libc/bugs.html>'
SED=''
SHELL='/bin/bash'
SYSINCLUDES=''
VERSION=''
ac_ct_CC=''
ac_ct_CXX=''
add_on_subdirs=' libidn'
add_ons='libidn'
all_warnings=''
base_machine='i386'
bindir='${exec_prefix}/bin'
bindnow='no'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-pc-linux-gnu'
build_cpu='x86_64'
build_nscd='default'
build_os='linux-gnu'
build_pt_chown='no'
build_vendor='pc'
cross_compiling='yes'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
enable_lock_elision='no'
enable_timezone_tools='yes'
enable_werror='yes'
exec_prefix='NONE'
fno_unit_at_a_time=''
force_install='yes'
hardcoded_path_in_tests='no'
have_libaudit=''
have_libcap=''
have_selinux=''
host='i686-pc-elf'
host_alias='i686-elf'
host_cpu='i686'
host_os='elf'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
ldd_rewrite_script=''
libc_cv_cc_loop_to_function=''
libc_cv_cc_nofma=''
libc_cv_cc_submachine=''
libc_cv_cc_with_libunwind=''
libc_cv_complocaledir=''
libc_cv_cxx_thread_local=''
libc_cv_fpie=''
libc_cv_gcc_unwind_find_fde=''
libc_cv_has_glob_dat=''
libc_cv_hashstyle=''
libc_cv_localstatedir=''
libc_cv_mtls_dialect_gnu2=''
libc_cv_nss_crypt='no'
libc_cv_output_format=''
libc_cv_pic_default=''
libc_cv_pie_default=''
libc_cv_protected_data=''
libc_cv_rootsbindir=''
libc_cv_rtlddir=''
libc_cv_slibdir=''
libc_cv_sysconfdir=''
libc_cv_z_combreloc=''
libc_cv_z_execstack=''
libc_extra_cflags=''
libc_extra_cppflags=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
link_obsolete_rpc='no'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mach_interface_list=''
mandir='${datarootdir}/man'
multi_arch='default'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/home/ercan/cross/tools/tools_binaries/i686/i686-elf'
profile='no'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
shared='yes'
sharedstatedir='${prefix}/com'
stack_protector=''
static=''
static_nss='no'
subdirs='  '
submachine=''
sysconfdir='${prefix}/etc'
sysdeps_add_ons=''
sysheaders='/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include'
sysnames=''
target_alias='i686-elf'
use_default_link='default'
use_ldconfig=''
use_nscd='yes'
with_fp='yes'

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "GNU C Library"
#define PACKAGE_TARNAME "glibc"
#define PACKAGE_VERSION "(see version.h)"
#define PACKAGE_STRING "GNU C Library (see version.h)"
#define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
#define PACKAGE_URL "http://www.gnu.org/software/glibc/"
#define PKGVERSION "(GNU libc) "
#define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
#define HAVE_LIBIDN 1

configure: exit 1

How I cross compile glibc for i686-elf? Thanks for replies.

Advertisement

Answer

You are trying to build glibc for a bare metal target. This won’t work as far as I know.
Use newlib if the target is in fact bare metal.

For linux targets, use --host=i686-pc-linux-gnu instead, and pass CC=i686-elf-gcc to configure if necessary.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement