x86 Linux系统下构建交叉编译工具(3)

接前一篇文章:x86 Linux系统下构建交叉编译工具(2)

本文参考以下文章:

建立交叉编译器 for arm (binutils-2.17 gcc-3.4.6 glibc-2.3.6)

特此致谢!

上一回构建了binutils的交叉环境,本回进行引导编译器交的构建。

二、编译构建

2. 引导编译器构建

(1)build-tools目录下创建build-binutils文件夹

进入到cross-compiler/build-tools目录。如下所示:

~$ cd cross-compiler/build-tools/
~/cross-compiler/build-tool$ ls
binutils-2.41  binutils-2.41.tar.xz  build-binuitls  gcc-13.2.0.tar.xz  glibc-2.38.tar.xz

(2)解压glibc源码压缩包

通过tar命令解压glibc源码压缩包。实际命令及结果如下所示(截取部分):

$ tar xvf glibc-2.38.tar.xz 
……
glibc-2.38/wcsmbs/wcstoull_l.c
glibc-2.38/wcsmbs/wcswidth.c
glibc-2.38/wcsmbs/wcsxfrm.c
glibc-2.38/wcsmbs/wcsxfrm_l.c
glibc-2.38/wcsmbs/wctob.c
glibc-2.38/wcsmbs/wcwidth.c
glibc-2.38/wcsmbs/wcwidth.h
glibc-2.38/wcsmbs/wmemchr.c
glibc-2.38/wcsmbs/wmemcmp.c
glibc-2.38/wcsmbs/wmemcpy.c
glibc-2.38/wcsmbs/wmemmove.c
glibc-2.38/wcsmbs/wmempcpy.c
glibc-2.38/wcsmbs/wmemset.c
glibc-2.38/wctype/
glibc-2.38/wctype/Makefile
glibc-2.38/wctype/Versions
glibc-2.38/wctype/bits/
glibc-2.38/wctype/bits/wctype-wchar.h
glibc-2.38/wctype/bug-wctypeh.c
glibc-2.38/wctype/iswctype.c
glibc-2.38/wctype/iswctype_l.c
glibc-2.38/wctype/test_wcfuncs.c
glibc-2.38/wctype/test_wctype.c
glibc-2.38/wctype/towctrans.c
glibc-2.38/wctype/towctrans_l.c
glibc-2.38/wctype/wcfuncs.c
glibc-2.38/wctype/wcfuncs_l.c
glibc-2.38/wctype/wchar-lookup.h
glibc-2.38/wctype/wctrans.c
glibc-2.38/wctype/wctrans_l.c
glibc-2.38/wctype/wctype.c
glibc-2.38/wctype/wctype.h
glibc-2.38/wctype/wctype_l.c
$ 

解压后glibc-2.38目录内容如下:

$ ls glibc-2.38
abi-tags        crypt           iconv              Makeconfig     o-iterator.mk   socket
aclocal.m4      csu             iconvdata          Makefile       po              soft-fp
argp            ctype           include            Makefile.help  posix           stdio-common
assert          debug           inet               Makefile.in    pwd             stdlib
benchtests      dirent          INSTALL            Makerules      README          string
bits            dlfcn           intl               malloc         resolv          sunrpc
catgets         elf             io                 manual         resource        support
ChangeLog.old   extra-lib.mk    libc-abis          math           rt              sysdeps
config.h.in     gen-locales.mk  libio              mathvec        Rules           sysvipc
config.make.in  gmon            libof-iterator.mk  misc           scripts         termios
configure       gnulib          LICENSES           NEWS           SECURITY.md     test-skeleton.c
configure.ac    grp             locale             nis            setjmp          time
conform         gshadow         localedata         nptl           shadow          timezone
CONTRIBUTED-BY  hesiod          login              nptl_db        SHARED-FILES    version.h
COPYING         htl             mach               nscd           shlib-versions  wcsmbs
COPYING.LIB     hurd            MAINTAINERS        nss            signal          wctype

(3)下载glibc-linuxthreads源码压缩包

到以下页面下载gibc-linuxthreads源码压缩包:http://ftp.vim.org/ftp/gnu/glibc/

x86 Linux系统下构建交叉编译工具(3)_第1张图片

 选择glibc-linuxthreads-2.5.tar.bz2,下载并将其放入到~/cross_compiler/build-tools目录。

(4)解压glibc-linuxthreads源码压缩包

进入~/cross-compiler/build-tools目录,通过tar命令解压glibc-linuxthreads源码压缩包。实际命令及结果如下所示:

$ tar xvf glibc-linuxthreads-2.5.tar.bz2 --directory=glibc-2.38
linuxthreads/
linuxthreads/ChangeLog
linuxthreads/Banner
linuxthreads/FAQ.html
linuxthreads/Changes
linuxthreads/Makeconfig
linuxthreads/LICENSE
linuxthreads/Examples/
linuxthreads/Examples/Makefile
linuxthreads/Examples/ex1.c
linuxthreads/Examples/ex10.c
linuxthreads/Examples/ex11.c
linuxthreads/Examples/ex12.c
linuxthreads/Examples/ex13.c
linuxthreads/Examples/ex14.c
linuxthreads/Examples/ex15.c
linuxthreads/Examples/ex16.c
linuxthreads/Examples/ex17.c
linuxthreads/Examples/ex18.c
linuxthreads/Examples/ex2.c
linuxthreads/Examples/ex3.c
linuxthreads/Examples/ex4.c
linuxthreads/Examples/ex5.c
linuxthreads/Examples/ex6.c
linuxthreads/Examples/ex7.c
linuxthreads/Examples/ex8.c
linuxthreads/Examples/ex9.c
linuxthreads/Examples/tststatic.c
linuxthreads/Makefile
linuxthreads/README
linuxthreads/README.Xfree3.2
linuxthreads/Versions
linuxthreads/alloca_cutoff.c
linuxthreads/attr.c
linuxthreads/barrier.c
linuxthreads/bug-sleep.c
linuxthreads/cancel.c
linuxthreads/condvar.c
linuxthreads/configure
linuxthreads/configure.in
linuxthreads/descr.h
linuxthreads/ecmutex.c
linuxthreads/errno.c
linuxthreads/events.c
linuxthreads/forward.c
linuxthreads/internals.h
linuxthreads/join.c
linuxthreads/joinrace.c
linuxthreads/libc-cancellation.c
linuxthreads/libc-tls-loc.c
linuxthreads/libc-tsd.c
linuxthreads/libc_pthread_init.c
linuxthreads/linuxthreads.texi
linuxthreads/lockfile.c
linuxthreads/manager.c
linuxthreads/mutex.c
linuxthreads/old_pthread_atfork.c
linuxthreads/oldsemaphore.c
linuxthreads/pt-allocrtsig.c
linuxthreads/pt-machine.c
linuxthreads/pt-system.c
linuxthreads/ptcleanup.c
linuxthreads/ptclock_gettime.c
linuxthreads/ptclock_settime.c
linuxthreads/ptfork.c
linuxthreads/pthandles.c
linuxthreads/pthread.c
linuxthreads/pthread_atfork.c
linuxthreads/pthread_setegid.c
linuxthreads/pthread_seteuid.c
linuxthreads/pthread_setgid.c
linuxthreads/pthread_setregid.c
linuxthreads/pthread_setresgid.c
linuxthreads/pthread_setresuid.c
linuxthreads/pthread_setreuid.c
linuxthreads/pthread_setuid.c
linuxthreads/queue.h
linuxthreads/restart.h
linuxthreads/rwlock.c
linuxthreads/semaphore.c
linuxthreads/semaphore.h
linuxthreads/shlib-versions
linuxthreads/sighandler.c
linuxthreads/signals.c
linuxthreads/specific.c
linuxthreads/spinlock.c
linuxthreads/spinlock.h
linuxthreads/tst-_res1.c
linuxthreads/tst-_res1mod1.c
linuxthreads/tst-_res1mod2.c
linuxthreads/tst-align.c
linuxthreads/tst-attr1.c
linuxthreads/tst-cancel-static.c
linuxthreads/tst-cancel-wrappers.sh
linuxthreads/tst-cancel.c
linuxthreads/tst-cancel1.c
linuxthreads/tst-cancel2.c
linuxthreads/tst-cancel3.c
linuxthreads/tst-cancel4.c
linuxthreads/tst-cancel5.c
linuxthreads/tst-cancel6.c
linuxthreads/tst-cancel7.c
linuxthreads/tst-cancel8.c
linuxthreads/tst-clock1.c
linuxthreads/tst-context.c
linuxthreads/tst-popen.c
linuxthreads/tst-popen2.c
linuxthreads/tst-sighandler1.c
linuxthreads/tst-sighandler2.c
linuxthreads/tst-signal.c
linuxthreads/tst-signal.sh
linuxthreads/tst-stack1.c
linuxthreads/tst-stackguard1-static.c
linuxthreads/tst-stackguard1.c
linuxthreads/tst-static-locale.c
linuxthreads/tst-tls1.c
linuxthreads/tst-tls1.h
linuxthreads/tst-tls1mod.c
linuxthreads/tst-tls1moda.c
linuxthreads/tst-tls1modb.c
linuxthreads/tst-tls1modc.c
linuxthreads/tst-tls1modd.c
linuxthreads/tst-tls1mode.c
linuxthreads/tst-tls1modf.c
linuxthreads/tst-tls2.sh
linuxthreads/tst-tsd1.c
linuxthreads/tststack.c
linuxthreads/unload.c
linuxthreads/man/
linuxthreads/man/Makefile
linuxthreads/man/pthread_atfork.man
linuxthreads/man/pthread_attr_init.man
linuxthreads/man/pthread_cancel.man
linuxthreads/man/pthread_cleanup_push.man
linuxthreads/man/pthread_cond_init.man
linuxthreads/man/pthread_condattr_init.man
linuxthreads/man/pthread_create.man
linuxthreads/man/pthread_detach.man
linuxthreads/man/pthread_equal.man
linuxthreads/man/pthread_exit.man
linuxthreads/man/pthread_join.man
linuxthreads/man/pthread_key_create.man
linuxthreads/man/pthread_kill_other_threads_np.man
linuxthreads/man/pthread_mutex_init.man
linuxthreads/man/pthread_mutexattr_init.man
linuxthreads/man/pthread_mutexattr_setkind_np.man
linuxthreads/man/pthread_once.man
linuxthreads/man/pthread_self.man
linuxthreads/man/pthread_setschedparam.man
linuxthreads/man/pthread_sigmask.man
linuxthreads/man/sem_init.man
linuxthreads/man/troffprepro
linuxthreads/sysdeps/
linuxthreads/sysdeps/alpha/
linuxthreads/sysdeps/alpha/elf/
linuxthreads/sysdeps/alpha/elf/pt-initfini.c
linuxthreads/sysdeps/alpha/pspinlock.c
linuxthreads/sysdeps/alpha/pt-machine.h
linuxthreads/sysdeps/alpha/tls.h
linuxthreads/sysdeps/cris/
linuxthreads/sysdeps/cris/pspinlock.c
linuxthreads/sysdeps/cris/pt-machine.h
linuxthreads/sysdeps/i386/
linuxthreads/sysdeps/i386/i486/
linuxthreads/sysdeps/i386/i486/pt-machine.h
linuxthreads/sysdeps/i386/i586/
linuxthreads/sysdeps/i386/i586/Versions
linuxthreads/sysdeps/i386/i586/pt-machine.h
linuxthreads/sysdeps/i386/Makefile
linuxthreads/sysdeps/i386/pspinlock.c
linuxthreads/sysdeps/i386/pt-machine.h
linuxthreads/sysdeps/i386/tcb-offsets.sym
linuxthreads/sysdeps/i386/tls.h
linuxthreads/sysdeps/i386/useldt.h
linuxthreads/sysdeps/i386/i686/
linuxthreads/sysdeps/i386/i686/Versions
linuxthreads/sysdeps/i386/i686/pt-machine.h
linuxthreads/sysdeps/ia64/
linuxthreads/sysdeps/ia64/Makefile
linuxthreads/sysdeps/ia64/Versions
linuxthreads/sysdeps/ia64/pspinlock.c
linuxthreads/sysdeps/ia64/pt-machine.h
linuxthreads/sysdeps/ia64/tcb-offsets.sym
linuxthreads/sysdeps/ia64/tls.h
linuxthreads/sysdeps/m68k/
linuxthreads/sysdeps/m68k/pspinlock.c
linuxthreads/sysdeps/m68k/pt-machine.h
linuxthreads/sysdeps/mips/
linuxthreads/sysdeps/mips/pspinlock.c
linuxthreads/sysdeps/mips/pt-machine.h
linuxthreads/sysdeps/mips/tls.h
linuxthreads/sysdeps/powerpc/
linuxthreads/sysdeps/powerpc/powerpc32/
linuxthreads/sysdeps/powerpc/powerpc32/pspinlock.c
linuxthreads/sysdeps/powerpc/powerpc32/pt-machine.h
linuxthreads/sysdeps/powerpc/Makefile
linuxthreads/sysdeps/powerpc/tcb-offsets.sym
linuxthreads/sysdeps/powerpc/tls.h
linuxthreads/sysdeps/powerpc/powerpc64/
linuxthreads/sysdeps/powerpc/powerpc64/pspinlock.c
linuxthreads/sysdeps/powerpc/powerpc64/pt-machine.h
linuxthreads/sysdeps/pthread/
linuxthreads/sysdeps/pthread/bits/
linuxthreads/sysdeps/pthread/bits/initspin.h
linuxthreads/sysdeps/pthread/bits/libc-lock.h
linuxthreads/sysdeps/pthread/bits/libc-tsd.h
linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
linuxthreads/sysdeps/pthread/bits/typesizes.h
linuxthreads/sysdeps/pthread/Makefile
linuxthreads/sysdeps/pthread/Subdirs
linuxthreads/sysdeps/pthread/errno-loc.c
linuxthreads/sysdeps/pthread/flockfile.c
linuxthreads/sysdeps/pthread/ftrylockfile.c
linuxthreads/sysdeps/pthread/funlockfile.c
linuxthreads/sysdeps/pthread/gai_misc.h
linuxthreads/sysdeps/pthread/getcpuclockid.c
linuxthreads/sysdeps/pthread/herrno-loc.c
linuxthreads/sysdeps/pthread/list.h
linuxthreads/sysdeps/pthread/malloc-machine.h
linuxthreads/sysdeps/pthread/posix-timer.h
linuxthreads/sysdeps/pthread/pt-initfini.c
linuxthreads/sysdeps/pthread/pthread-functions.h
linuxthreads/sysdeps/pthread/pthread.h
linuxthreads/sysdeps/pthread/ptlongjmp.c
linuxthreads/sysdeps/pthread/res-state.c
linuxthreads/sysdeps/pthread/semaphore.h
linuxthreads/sysdeps/pthread/sigaction.c
linuxthreads/sysdeps/pthread/tcb-offsets.h
linuxthreads/sysdeps/pthread/timer_create.c
linuxthreads/sysdeps/pthread/timer_delete.c
linuxthreads/sysdeps/pthread/timer_getoverr.c
linuxthreads/sysdeps/pthread/timer_gettime.c
linuxthreads/sysdeps/pthread/timer_routines.c
linuxthreads/sysdeps/pthread/timer_settime.c
linuxthreads/sysdeps/pthread/tst-timer.c
linuxthreads/sysdeps/s390/
linuxthreads/sysdeps/s390/s390-32/
linuxthreads/sysdeps/s390/s390-32/pt-machine.h
linuxthreads/sysdeps/s390/Makefile
linuxthreads/sysdeps/s390/pspinlock.c
linuxthreads/sysdeps/s390/tcb-offsets.sym
linuxthreads/sysdeps/s390/tls.h
linuxthreads/sysdeps/s390/s390-64/
linuxthreads/sysdeps/s390/s390-64/pt-machine.h
linuxthreads/sysdeps/sh/
linuxthreads/sysdeps/sh/Makefile
linuxthreads/sysdeps/sh/pspinlock.c
linuxthreads/sysdeps/sh/pt-machine.h
linuxthreads/sysdeps/sh/tcb-offsets.sym
linuxthreads/sysdeps/sh/tls.h
linuxthreads/sysdeps/sparc/
linuxthreads/sysdeps/sparc/sparc32/
linuxthreads/sysdeps/sparc/sparc32/sparcv9/
linuxthreads/sysdeps/sparc/sparc32/sparcv9/Versions
linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c
linuxthreads/sysdeps/sparc/sparc32/pspinlock.c
linuxthreads/sysdeps/sparc/sparc32/pt-machine.h
linuxthreads/sysdeps/sparc/Makefile
linuxthreads/sysdeps/sparc/tcb-offsets.sym
linuxthreads/sysdeps/sparc/tls.h
linuxthreads/sysdeps/sparc/sparc64/
linuxthreads/sysdeps/sparc/sparc64/Versions
linuxthreads/sysdeps/sparc/sparc64/pspinlock.c
linuxthreads/sysdeps/sparc/sparc64/pt-machine.h
linuxthreads/sysdeps/unix/
linuxthreads/sysdeps/unix/sysv/
linuxthreads/sysdeps/unix/sysv/linux/
linuxthreads/sysdeps/unix/sysv/linux/Makefile
linuxthreads/sysdeps/unix/sysv/linux/Implies
linuxthreads/sysdeps/unix/sysv/linux/alpha/
linuxthreads/sysdeps/unix/sysv/linux/alpha/bits/
linuxthreads/sysdeps/unix/sysv/linux/alpha/bits/local_lim.h
linuxthreads/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
linuxthreads/sysdeps/unix/sysv/linux/alpha/Makefile
linuxthreads/sysdeps/unix/sysv/linux/alpha/Versions
linuxthreads/sysdeps/unix/sysv/linux/alpha/aio_cancel.c
linuxthreads/sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S
linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/Versions
linuxthreads/sysdeps/unix/sysv/linux/allocalim.h
linuxthreads/sysdeps/unix/sysv/linux/allocrtsig.c
linuxthreads/sysdeps/unix/sysv/linux/execve.c
linuxthreads/sysdeps/unix/sysv/linux/fork.c
linuxthreads/sysdeps/unix/sysv/linux/fork.h
linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c
linuxthreads/sysdeps/unix/sysv/linux/mq_notify.c
linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c
linuxthreads/sysdeps/unix/sysv/linux/raise.c
linuxthreads/sysdeps/unix/sysv/linux/register-atfork.c
linuxthreads/sysdeps/unix/sysv/linux/sigwait.c
linuxthreads/sysdeps/unix/sysv/linux/smp.h
linuxthreads/sysdeps/unix/sysv/linux/unregister-atfork.c
linuxthreads/sysdeps/unix/sysv/linux/bits/
linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h
linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
linuxthreads/sysdeps/unix/sysv/linux/i386/
linuxthreads/sysdeps/unix/sysv/linux/i386/dl-sysdep.h
linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/ia64/
linuxthreads/sysdeps/unix/sysv/linux/ia64/bits/
linuxthreads/sysdeps/unix/sysv/linux/ia64/bits/local_lim.h
linuxthreads/sysdeps/unix/sysv/linux/ia64/Makefile
linuxthreads/sysdeps/unix/sysv/linux/ia64/Versions
linuxthreads/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
linuxthreads/sysdeps/unix/sysv/linux/ia64/fork.h
linuxthreads/sysdeps/unix/sysv/linux/ia64/pt-initfini.c
linuxthreads/sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c
linuxthreads/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/m68k/
linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/mips/
linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/
linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile
linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/powerpc/
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/powerpc/Makefile
linuxthreads/sysdeps/unix/sysv/linux/powerpc/Versions
linuxthreads/sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/s390/
linuxthreads/sysdeps/unix/sysv/linux/s390/bits/
linuxthreads/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/sh/
linuxthreads/sysdeps/unix/sysv/linux/sh/pt-initfini.c
linuxthreads/sysdeps/unix/sysv/linux/sh/smp.h
linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/sparc/
linuxthreads/sysdeps/unix/sysv/linux/sparc/bits/
linuxthreads/sysdeps/unix/sysv/linux/sparc/bits/local_lim.h
linuxthreads/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
linuxthreads/sysdeps/unix/sysv/linux/sparc/Versions
linuxthreads/sysdeps/unix/sysv/linux/sparc/aio_cancel.c
linuxthreads/sysdeps/unix/sysv/linux/sparc/fork.h
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
linuxthreads/sysdeps/unix/sysv/linux/x86_64/
linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile
linuxthreads/sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c
linuxthreads/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S
linuxthreads/sysdeps/x86_64/
linuxthreads/sysdeps/x86_64/Makefile
linuxthreads/sysdeps/x86_64/Versions
linuxthreads/sysdeps/x86_64/pspinlock.c
linuxthreads/sysdeps/x86_64/pt-machine.h
linuxthreads/sysdeps/x86_64/tcb-offsets.sym
linuxthreads/sysdeps/x86_64/tls.h
linuxthreads_db/
linuxthreads_db/ChangeLog
linuxthreads_db/Banner
linuxthreads_db/Makefile
linuxthreads_db/Versions
linuxthreads_db/proc_service.h
linuxthreads_db/shlib-versions
linuxthreads_db/td_init.c
linuxthreads_db/td_log.c
linuxthreads_db/td_symbol_list.c
linuxthreads_db/td_ta_clear_event.c
linuxthreads_db/td_ta_delete.c
linuxthreads_db/td_ta_enable_stats.c
linuxthreads_db/td_ta_event_addr.c
linuxthreads_db/td_ta_event_getmsg.c
linuxthreads_db/td_ta_get_nthreads.c
linuxthreads_db/td_ta_get_ph.c
linuxthreads_db/td_ta_get_stats.c
linuxthreads_db/td_ta_map_id2thr.c
linuxthreads_db/td_ta_map_lwp2thr.c
linuxthreads_db/td_ta_new.c
linuxthreads_db/td_ta_reset_stats.c
linuxthreads_db/td_ta_set_event.c
linuxthreads_db/td_ta_setconcurrency.c
linuxthreads_db/td_ta_thr_iter.c
linuxthreads_db/td_ta_tsd_iter.c
linuxthreads_db/td_thr_clear_event.c
linuxthreads_db/td_thr_dbresume.c
linuxthreads_db/td_thr_dbsuspend.c
linuxthreads_db/td_thr_event_enable.c
linuxthreads_db/td_thr_event_getmsg.c
linuxthreads_db/td_thr_get_info.c
linuxthreads_db/td_thr_getfpregs.c
linuxthreads_db/td_thr_getgregs.c
linuxthreads_db/td_thr_getxregs.c
linuxthreads_db/td_thr_getxregsize.c
linuxthreads_db/td_thr_set_event.c
linuxthreads_db/td_thr_setfpregs.c
linuxthreads_db/td_thr_setgregs.c
linuxthreads_db/td_thr_setprio.c
linuxthreads_db/td_thr_setsigpending.c
linuxthreads_db/td_thr_setxregs.c
linuxthreads_db/td_thr_sigsetmask.c
linuxthreads_db/td_thr_tls_get_addr.c
linuxthreads_db/td_thr_tlsbase.c
linuxthreads_db/td_thr_tsd.c
linuxthreads_db/td_thr_validate.c
linuxthreads_db/thread_db.h
linuxthreads_db/thread_dbP.h
$ 

再次查看glibc-2.38目录内容:

$ ls glibc-2.38
abi-tags    ChangeLog.old   COPYING      dlfcn           gshadow    inet               LICENSES         MAINTAINERS    manual   nptl_db        README       setjmp          stdio-common  termios
aclocal.m4  config.h.in     COPYING.LIB  elf             hesiod     INSTALL            linuxthreads     Makeconfig     math     nscd           resolv       shadow          stdlib        test-skeleton.c
argp        config.make.in  crypt        extra-lib.mk    htl        intl               linuxthreads_db  Makefile       mathvec  nss            resource     SHARED-FILES    string        time
assert      configure       csu          gen-locales.mk  hurd       io                 locale           Makefile.help  misc     o-iterator.mk  rt           shlib-versions  sunrpc        timezone
benchtests  configure.ac    ctype        gmon            iconv      libc-abis          localedata       Makefile.in    NEWS     po             Rules        signal          support       version.h
bits        conform         debug        gnulib          iconvdata  libio              login            Makerules      nis      posix          scripts      socket          sysdeps       wcsmbs
catgets     CONTRIBUTED-BY  dirent       grp             include    libof-iterator.mk  mach             malloc         nptl     pwd            SECURITY.md  soft-fp         sysvipc       wctype

可以看到,多了linuxthreads和linuxthreads_db两个目录。内容分别如下:

$ ls glibc-2.38/linuxthreads/
alloca_cutoff.c  configure.in  joinrace.c           man                   pthandles.c          pthread_setuid.c  shlib-versions  tst-cancel2.c           tst-clock1.c       tst-signal.sh             tst-tls1mod.c
attr.c           descr.h       libc-cancellation.c  manager.c             pthread_atfork.c     pt-machine.c      sighandler.c    tst-cancel3.c           tst-context.c      tst-stack1.c              tst-tls1modc.c
Banner           ecmutex.c     libc_pthread_init.c  mutex.c               pthread.c            pt-system.c       signals.c       tst-cancel4.c           tst-popen2.c       tststack.c                tst-tls1modd.c
barrier.c        errno.c       libc-tls-loc.c       old_pthread_atfork.c  pthread_setegid.c    queue.h           specific.c      tst-cancel5.c           tst-popen.c        tst-stackguard1.c         tst-tls1mode.c
bug-sleep.c      events.c      libc-tsd.c           oldsemaphore.c        pthread_seteuid.c    README            spinlock.c      tst-cancel6.c           tst-_res1.c        tst-stackguard1-static.c  tst-tls1modf.c
cancel.c         Examples      LICENSE              pt-allocrtsig.c       pthread_setgid.c     README.Xfree3.2   spinlock.h      tst-cancel7.c           tst-_res1mod1.c    tst-static-locale.c       tst-tls2.sh
ChangeLog        FAQ.html      linuxthreads.texi    ptcleanup.c           pthread_setregid.c   restart.h         sysdeps         tst-cancel8.c           tst-_res1mod2.c    tst-tls1.c                tst-tsd1.c
Changes          forward.c     lockfile.c           ptclock_gettime.c     pthread_setresgid.c  rwlock.c          tst-align.c     tst-cancel.c            tst-sighandler1.c  tst-tls1.h                unload.c
condvar.c        internals.h   Makeconfig           ptclock_settime.c     pthread_setresuid.c  semaphore.c       tst-attr1.c     tst-cancel-static.c     tst-sighandler2.c  tst-tls1moda.c            Versions
configure        join.c        Makefile             ptfork.c              pthread_setreuid.c   semaphore.h       tst-cancel1.c   tst-cancel-wrappers.sh  tst-signal.c       tst-tls1modb.c
$ ls glibc-2.38/linuxthreads_db
Banner          td_init.c            td_ta_enable_stats.c  td_ta_get_stats.c    td_ta_setconcurrency.c  td_thr_dbresume.c      td_thr_getgregs.c     td_thr_setfpregs.c      td_thr_sigsetmask.c    thread_db.h
ChangeLog       td_log.c             td_ta_event_addr.c    td_ta_map_id2thr.c   td_ta_set_event.c       td_thr_dbsuspend.c     td_thr_get_info.c     td_thr_setgregs.c       td_thr_tlsbase.c       thread_dbP.h
Makefile        td_symbol_list.c     td_ta_event_getmsg.c  td_ta_map_lwp2thr.c  td_ta_thr_iter.c        td_thr_event_enable.c  td_thr_getxregs.c     td_thr_setprio.c        td_thr_tls_get_addr.c  Versions
proc_service.h  td_ta_clear_event.c  td_ta_get_nthreads.c  td_ta_new.c          td_ta_tsd_iter.c        td_thr_event_getmsg.c  td_thr_getxregsize.c  td_thr_setsigpending.c  td_thr_tsd.c
shlib-versions  td_ta_delete.c       td_ta_get_ph.c        td_ta_reset_stats.c  td_thr_clear_event.c    td_thr_getfpregs.c     td_thr_set_event.c    td_thr_setxregs.c       td_thr_validate.c

(5)创建并进入build-glibc-headers文件夹

在cross-compiler/build-tools目录下创建build-glibc-headers目录,并进入。如下所示:

~/cross-compiler/build-tools$ mkdir build-glibc-headers
~/cross-compiler/build-tools$ cd build-glibc-headers/
~/cross-compiler/build-tools/build-glibc-headers$ 

(6)配置

执行configure进行glibc的配置。实际命令及结果如下:

$ ../glibc-2.38/configure --host=arm-linux --prefix="/usr" --enable-add-ons=linuxthreads --with-headers=/usr/local/arm/arm-linux/include/
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking for arm-linux-gcc... no
checking for gcc... gcc
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for gcc... gcc
checking for arm-linux-g++... no
checking for arm-linux-c++... no
checking for arm-linux-gpp... no
checking for arm-linux-aCC... no
checking for arm-linux-CC... no
checking for arm-linux-cxx... no
checking for arm-linux-cc++... no
checking for arm-linux-cl.exe... no
checking for arm-linux-FCC... no
checking for arm-linux-KCC... no
checking for arm-linux-RCC... no
checking for arm-linux-xlC_r... no
checking for arm-linux-xlC... no
checking for arm-linux-clang++... no
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking whether g++ can link programs... yes
checking for sysdeps preconfigure fragments... aarch64 alpha arc arm configure: WARNING: arm/preconfigure: Did not find ARM architecture type; using default
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
csky hppa i386 loongarch m68k microblaze checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/grep -E
mips nios2 or1k powerpc riscv s390 sh checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/grep -E
sparc x86_64 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for ld... ld
checking version of ld... 2.38, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 4.3, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.21, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 6.8, ok
checking for sed... sed
checking version of sed... 4.8, ok
checking for gawk... gawk
checking version of gawk... 5.1.1, ok
checking for bison... bison
checking version of bison... 3.8.2, ok
checking if gcc is sufficient to build libc... yes
checking for python3... python3
checking version of python3... 3.11.2, ok
checking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking whether the linker supports textrels along with ifunc... yes
checking for GNU attribute retain support... yes
checking if compiler warns about alias for function with incompatible types... yes
checking sysdep dirs... sysdeps/unix/sysv/linux/arm/le sysdeps/unix/sysv/linux/arm sysdeps/arm/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/le sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic
checking LD_LIBRARY_PATH variable... ok
checking for bash... /usr/bin/bash
checking for perl... /usr/bin/perl
checking for install-info... /usr/bin/install-info
checking for .set assembler directive... yes
checking linker support for protected data symbol... yes
checking linker support for INSERT in linker script... yes
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking for libunwind-support in compiler... no
checking whether --noexecstack is desirable for .S files... yes
checking for linker that supports -z execstack... yes
checking for linker that supports -z start-stop-gc... yes
checking for linker that supports --depaudit... yes
checking for linker that supports -z pack-relative-relocs... yes
checking for linker that supports --no-dynamic-linker... yes
checking for -static-pie... yes
checking for -fpie... yes
checking for GLOB_DAT reloc... yes
checking for -mtls-dialect=gnu2... yes
checking if -Wno-ignored-attributes is required for aliases... 
checking whether cc puts quotes around section names... no
checking for __builtin_memset... yes
checking for redirection of built-in functions... yes
checking for compiler option to disable generation of FMA instructions... -ffp-contract=off
checking for compiler option that -fsignaling-nans... -fsignaling-nans
checking if gcc accepts -fno-tree-loop-distribute-patterns with __attribute__ ((__optimize__))... yes
checking for libgd... no
checking for is_selinux_enabled in -lselinux... no
checking for maximum supported _FORTIFY_SOURCE level... 3
checking whether the assembler requires one version per symbol... no
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... yes
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... missing or too old!
configure: error: GNU libc requires kernel header files from
Linux 3.2.0 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 3.2.0 or later.  This check uses , so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.

(7)编译

执行make命令进行glibc的编译。实际命令及结果如下:

~/cross-compiler/build-tools/build-glibc-headers$ make cross-compiling=yes install_root=/usr/local/arm/arm-linux/ prefix="" build_directory=../build-glibc-headers install-headers
make: *** 没有规则可制作目标“install-headers”。 停止。

将目录切换到glibc-2.38下,再次运行以上命令:

~/cross-compiler/build-tools/build-glibc-headers$ cd ../glibc-2.38/
~/cross-compiler/build-tools/glibc-2.38$ make cross-compiling=yes install_root=/usr/local/arm/arm-linux/ prefix="" build_directory=../build-glibc-headers install-headers
Makeconfig:43: *** objdir must be defined by the build-directory Makefile。 停止。

存在一定问题,也许是版本问题,也许是其它问题。需要后续深入解决。

你可能感兴趣的:(交叉编译工具,Linux,linux,交叉编译工具)