Cross Compiling GCC - 'glibc' on windows for linux platform












0















I am trying to cross compile the gcc for linux - i686-elf platform from windows PC. As per the toolchain steps, I have successfully compiled:




  1. binutils using /binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

  2. basic gcc using gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers

  3. linux headers using make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/

  4. NOW, I am trying to compile the 'glibc' core c library using CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=$HOME/opt/cross/include


BUT I am getting the follwing errors :(



/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__close_nocancel_nostatus':
/home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/not-cancel.h:57: undefined reference to `__GI___close_nocancel'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `invalid_name':
/home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/posix/opendir.c:43: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fxstatat64':
/home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:55: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:37: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__closedir':
/home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:52: undefined reference to `__GI___close_nocancel'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:36: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__readdir':
/home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:41: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:76: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:71: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__rewinddir':
/home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/rewinddir.c:31: undefined reference to `__lseek'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__getdents':
/home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:96: undefined reference to `__lseek64'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:99: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:54: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fdopendir':
/home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:32: undefined reference to `__GI___fxstat64'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:41: undefined reference to `__GI___fcntl64_nocancel'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:36: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:46: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_scratch_buffer_set_array_size':
/home/MyPcUserName/src/glibc-2.29/malloc/scratch_buffer_set_array_size.c:41: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mmap':
/home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:39: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:42: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `munmap':
/home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mprotect':
/home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `uname':
/home/MyPcUserName/src/glibc-2.29/posix/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_sigaction':
/home/MyPcUserName/src/glibc-2.29/signal/../sysdeps/unix/sysv/linux/sigaction.c:58: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__sigaction':
/home/MyPcUserName/src/glibc-2.29/signal/../nptl/sigaction.c:26: undefined reference to `rtld_errno'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `setitimer':
/home/MyPcUserName/src/glibc-2.29/time/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
/home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/ld.so.new: hidden symbol `__lseek64' isn't defined
/home/MyPcUserName/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/MyPcUserName/src/build-glibc/elf/ld.so] Error 1
make[2]: Leaving directory '/home/MyPcUserName/src/glibc-2.29/elf'
make[1]: *** [Makefile:258: elf/subdir_lib] Error 2
make[1]: Leaving directory '/home/MyPcUserName/src/glibc-2.29'
make: *** [Makefile:9: all] Error 2


Does anybody has any idea.. How to deal with this issue ??










share|improve this question





























    0















    I am trying to cross compile the gcc for linux - i686-elf platform from windows PC. As per the toolchain steps, I have successfully compiled:




    1. binutils using /binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

    2. basic gcc using gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers

    3. linux headers using make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/

    4. NOW, I am trying to compile the 'glibc' core c library using CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=$HOME/opt/cross/include


    BUT I am getting the follwing errors :(



    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__close_nocancel_nostatus':
    /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/not-cancel.h:57: undefined reference to `__GI___close_nocancel'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `invalid_name':
    /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/posix/opendir.c:43: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fxstatat64':
    /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:55: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:37: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__closedir':
    /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:52: undefined reference to `__GI___close_nocancel'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:36: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__readdir':
    /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:41: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:76: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:71: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__rewinddir':
    /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/rewinddir.c:31: undefined reference to `__lseek'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__getdents':
    /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:96: undefined reference to `__lseek64'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:99: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:54: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fdopendir':
    /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:32: undefined reference to `__GI___fxstat64'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:41: undefined reference to `__GI___fcntl64_nocancel'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:36: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:46: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_scratch_buffer_set_array_size':
    /home/MyPcUserName/src/glibc-2.29/malloc/scratch_buffer_set_array_size.c:41: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mmap':
    /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:39: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:42: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `munmap':
    /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mprotect':
    /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `uname':
    /home/MyPcUserName/src/glibc-2.29/posix/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_sigaction':
    /home/MyPcUserName/src/glibc-2.29/signal/../sysdeps/unix/sysv/linux/sigaction.c:58: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__sigaction':
    /home/MyPcUserName/src/glibc-2.29/signal/../nptl/sigaction.c:26: undefined reference to `rtld_errno'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `setitimer':
    /home/MyPcUserName/src/glibc-2.29/time/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
    /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/ld.so.new: hidden symbol `__lseek64' isn't defined
    /home/MyPcUserName/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/MyPcUserName/src/build-glibc/elf/ld.so] Error 1
    make[2]: Leaving directory '/home/MyPcUserName/src/glibc-2.29/elf'
    make[1]: *** [Makefile:258: elf/subdir_lib] Error 2
    make[1]: Leaving directory '/home/MyPcUserName/src/glibc-2.29'
    make: *** [Makefile:9: all] Error 2


    Does anybody has any idea.. How to deal with this issue ??










    share|improve this question



























      0












      0








      0








      I am trying to cross compile the gcc for linux - i686-elf platform from windows PC. As per the toolchain steps, I have successfully compiled:




      1. binutils using /binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

      2. basic gcc using gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers

      3. linux headers using make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/

      4. NOW, I am trying to compile the 'glibc' core c library using CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=$HOME/opt/cross/include


      BUT I am getting the follwing errors :(



      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__close_nocancel_nostatus':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/not-cancel.h:57: undefined reference to `__GI___close_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `invalid_name':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/posix/opendir.c:43: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fxstatat64':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:55: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:37: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__closedir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:52: undefined reference to `__GI___close_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:36: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__readdir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:41: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:76: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:71: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__rewinddir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/rewinddir.c:31: undefined reference to `__lseek'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__getdents':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:96: undefined reference to `__lseek64'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:99: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:54: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fdopendir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:32: undefined reference to `__GI___fxstat64'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:41: undefined reference to `__GI___fcntl64_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:36: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:46: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_scratch_buffer_set_array_size':
      /home/MyPcUserName/src/glibc-2.29/malloc/scratch_buffer_set_array_size.c:41: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mmap':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:39: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:42: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `munmap':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mprotect':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `uname':
      /home/MyPcUserName/src/glibc-2.29/posix/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_sigaction':
      /home/MyPcUserName/src/glibc-2.29/signal/../sysdeps/unix/sysv/linux/sigaction.c:58: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__sigaction':
      /home/MyPcUserName/src/glibc-2.29/signal/../nptl/sigaction.c:26: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `setitimer':
      /home/MyPcUserName/src/glibc-2.29/time/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/ld.so.new: hidden symbol `__lseek64' isn't defined
      /home/MyPcUserName/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/MyPcUserName/src/build-glibc/elf/ld.so] Error 1
      make[2]: Leaving directory '/home/MyPcUserName/src/glibc-2.29/elf'
      make[1]: *** [Makefile:258: elf/subdir_lib] Error 2
      make[1]: Leaving directory '/home/MyPcUserName/src/glibc-2.29'
      make: *** [Makefile:9: all] Error 2


      Does anybody has any idea.. How to deal with this issue ??










      share|improve this question
















      I am trying to cross compile the gcc for linux - i686-elf platform from windows PC. As per the toolchain steps, I have successfully compiled:




      1. binutils using /binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

      2. basic gcc using gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers

      3. linux headers using make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/

      4. NOW, I am trying to compile the 'glibc' core c library using CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=$HOME/opt/cross/include


      BUT I am getting the follwing errors :(



      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__close_nocancel_nostatus':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/not-cancel.h:57: undefined reference to `__GI___close_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `invalid_name':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/posix/opendir.c:43: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fxstatat64':
      /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:55: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/elf/../sysdeps/unix/sysv/linux/fxstatat64.c:37: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__closedir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:52: undefined reference to `__GI___close_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/closedir.c:36: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__readdir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:41: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:76: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/readdir.c:71: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__rewinddir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/rewinddir.c:31: undefined reference to `__lseek'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__getdents':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:96: undefined reference to `__lseek64'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:99: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/unix/sysv/linux/getdents.c:54: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__fdopendir':
      /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:32: undefined reference to `__GI___fxstat64'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:41: undefined reference to `__GI___fcntl64_nocancel'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:36: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/dirent/../sysdeps/posix/fdopendir.c:46: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_scratch_buffer_set_array_size':
      /home/MyPcUserName/src/glibc-2.29/malloc/scratch_buffer_set_array_size.c:41: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mmap':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:39: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/sysv/linux/mmap.c:42: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `munmap':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__mprotect':
      /home/MyPcUserName/src/glibc-2.29/misc/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `uname':
      /home/MyPcUserName/src/glibc-2.29/posix/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__libc_sigaction':
      /home/MyPcUserName/src/glibc-2.29/signal/../sysdeps/unix/sysv/linux/sigaction.c:58: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `__sigaction':
      /home/MyPcUserName/src/glibc-2.29/signal/../nptl/sigaction.c:26: undefined reference to `rtld_errno'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/librtld.os: in function `setitimer':
      /home/MyPcUserName/src/glibc-2.29/time/../sysdeps/unix/syscall-template.S:78: undefined reference to `__syscall_error'
      /home/MyPcUserName/opt/cross/lib/gcc/i686-elf/7.4.0/../../../../i686-elf/bin/ld: /home/MyPcUserName/src/build-glibc/elf/ld.so.new: hidden symbol `__lseek64' isn't defined
      /home/MyPcUserName/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/MyPcUserName/src/build-glibc/elf/ld.so] Error 1
      make[2]: Leaving directory '/home/MyPcUserName/src/glibc-2.29/elf'
      make[1]: *** [Makefile:258: elf/subdir_lib] Error 2
      make[1]: Leaving directory '/home/MyPcUserName/src/glibc-2.29'
      make: *** [Makefile:9: all] Error 2


      Does anybody has any idea.. How to deal with this issue ??







      linux gcc glibc cross-compilation elf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 25 at 12:01







      alpha

















      asked Feb 25 at 11:26









      alphaalpha

      12




      12






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502847%2fcross-compiling-gcc-glibc-on-windows-for-linux-platform%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502847%2fcross-compiling-gcc-glibc-on-windows-for-linux-platform%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?