This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Cross compiling GCC for i686-elf linux system - error in glibc
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Wed, 27 Feb 2019 10:26:30 -0300
- Subject: Re: Cross compiling GCC for i686-elf linux system - error in glibc
- References: <CANAF1JLSJDyL1ShqpEcus-mDZeOt4Jo=cYn-17pzwpjCvu1pFQ@mail.gmail.com>
The glibc provides a handy script to create cross-compiling toolchain
to build and test glibc itself: scripts/build-many-glibcs.py. You might
try using the script, however your build system is not common used so
you might face some issues.
On 26/02/2019 10:33, Harshal Singhal wrote:
> Hello All,
>
> I am trying to cross compile the GCC-7.4.0 on windows 64bit-PC (using
> cygwin 32-bit) for target system linux - i686-elf platform. Following
> parameters I have used:
> - PREFIX="$HOME/opt/cross"
> - TARGET=i686-elf
> - PATH="$PREFIX/bin:$PATH"
>
> As per the toolchain steps, I have successfully compiled:
> 1. binutils (ver - 2.32) using
> -- `/binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX"
> --with-sysroot --disable-nls --disable-werror`
>
> 2. 1st step gcc using
> -- `/gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls
> --enable-languages=c,c++ --without-headers`
>
> 3. linux headers (ver - 4.9.160) for using
> -- `make headers_install ARCH=i386 CROSS_COMPILE=i686-elf-
> INSTALL_HDR_PATH=$PREFIX/include`
>
> 4. NOW, I am trying to compile the glibc (ver - 2.29) using
> -- `CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET
> --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=$PREFIX/include
> --disable-werror'
>
> BUT I am getting the follwing errors ---------------------------------------
> -
>
> /home/MyPC/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/not-cancel.h:57:
> undefined reference to `__GI___close_nocancel'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `invalid_name':
> /home/MyPC/src/glibc-2.29/elf/../sysdeps/posix/opendir.c:43: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__fxstatat64':
>
> /home/MyPC/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:55:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:37:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__closedir':
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:52:
> undefined reference to `__GI___close_nocancel'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:36: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__readdir':
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:41:
> undefined reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:76: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:71: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__rewinddir':
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/rewinddir.c:31:
> undefined reference to `__lseek'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__getdents':
>
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:96:
> undefined reference to `__lseek64'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:99:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:54:
> undefined reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__fdopendir':
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:32:
> undefined reference to `__GI___fxstat64'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:41: undefined
> reference to `__GI___fcntl64_nocancel'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:36: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:46: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function
> `__libc_scratch_buffer_set_array_size':
> /home/MyPC/src/glibc-2.29/malloc/scratch_buffer_set_array_size.c:41:
> undefined reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__mmap':
> /home/MyPC/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:39:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:42:
> undefined reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `munmap':
> /home/MyPC/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__mprotect':
> /home/MyPC/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `uname':
> /home/MyPC/src/glibc-2.29/posix/../sysdeps/unix/syscall-template.S:78:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__libc_sigaction':
>
> /home/MyPC/src/glibc-2.29/signal/../sysdeps/unix/sysv/linux/sigaction.c:58:
> undefined reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `__sigaction':
> /home/MyPC/src/glibc-2.29/signal/../nptl/sigaction.c:26: undefined
> reference to `rtld_errno'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/librtld.os: in function `setitimer':
> /home/MyPC/src/glibc-2.29/time/../sysdeps/unix/syscall-template.S:78:
> undefined reference to `__syscall_error'
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> /home/MyPC/src/build-glibc/elf/ld.so.new: hidden symbol `__lseek64' isn't
> defined
>
> /home/MyPC/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld:
> final link failed: bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:496: /home/MyPC/src/build-glibc/elf/ld.so] Error
> 1
> make[2]: Leaving directory '/home/MyPC/src/glibc-2.29/elf'
> make[1]: *** [Makefile:258: elf/subdir_lib] Error 2
> make[1]: Leaving directory '/home/MyPC/src/glibc-2.29'
> make: *** [Makefile:9: all] Error 2
>
> It says, 'hidden symbol `__lseek64' isn't defined'. I tried a lot to look
> for this issue and tried to compile the glibc again (as suggested in one
> query). But, still I am facing this error.
> Any response will be highly appreciated.
>
>