Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://pkg.loongnix.cn/loongnix/上下载的最新的glibc2.28制作交叉编译工具链失败 #32

Open
yunhai2009 opened this issue Aug 31, 2024 · 1 comment

Comments

@yunhai2009
Copy link

glibc2.28源码路径https://pkg.loongnix.cn/loongnix/,最新版
使用GCC12.4 和glibc2.28制作交叉编译工具链时,编译glibc2.28失败

输出如下:
loongarch64-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/lib64/ld.so.1 -B/home/ubuntu/Desktop/loongarch/build/build-libc/csu/ -Wl,--version-script=/home/ubuntu/Desktop/loongarch/build/build-libc/librt.map -Wl,-soname=librt.so.1 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,--enable-new-dtags,-z,nodelete -L/home/ubuntu/Desktop/loongarch/build/build-libc -L/home/ubuntu/Desktop/loongarch/build/build-libc/math -L/home/ubuntu/Desktop/loongarch/build/build-libc/elf -L/home/ubuntu/Desktop/loongarch/build/build-libc/dlfcn -L/home/ubuntu/Desktop/loongarch/build/build-libc/nss -L/home/ubuntu/Desktop/loongarch/build/build-libc/nis -L/home/ubuntu/Desktop/loongarch/build/build-libc/rt -L/home/ubuntu/Desktop/loongarch/build/build-libc/resolv -L/home/ubuntu/Desktop/loongarch/build/build-libc/mathvec -L/home/ubuntu/Desktop/loongarch/build/build-libc/support -L/home/ubuntu/Desktop/loongarch/build/build-libc/crypt -L/home/ubuntu/Desktop/loongarch/build/build-libc/nptl -Wl,-rpath-link=/home/ubuntu/Desktop/loongarch/build/build-libc:/home/ubuntu/Desktop/loongarch/build/build-libc/math:/home/ubuntu/Desktop/loongarch/build/build-libc/elf:/home/ubuntu/Desktop/loongarch/build/build-libc/dlfcn:/home/ubuntu/Desktop/loongarch/build/build-libc/nss:/home/ubuntu/Desktop/loongarch/build/build-libc/nis:/home/ubuntu/Desktop/loongarch/build/build-libc/rt:/home/ubuntu/Desktop/loongarch/build/build-libc/resolv:/home/ubuntu/Desktop/loongarch/build/build-libc/mathvec:/home/ubuntu/Desktop/loongarch/build/build-libc/support:/home/ubuntu/Desktop/loongarch/build/build-libc/crypt:/home/ubuntu/Desktop/loongarch/build/build-libc/nptl -o /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt.so -T /home/ubuntu/Desktop/loongarch/build/build-libc/shlib.lds /home/ubuntu/Desktop/loongarch/build/build-libc/csu/abi-note.o -Wl,--whole-archive /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a -Wl,--no-whole-archive /home/ubuntu/Desktop/loongarch/build/build-libc/nptl/libpthread.so -Wl,--start-group /home/ubuntu/Desktop/loongarch/build/build-libc/libc.so /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a -Wl,--as-needed /home/ubuntu/Desktop/loongarch/build/build-libc/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
Dump relocate record:
stack top relocation name symbol
at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x375):
...
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x37b):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x381):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x387):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x38d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x393):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x399):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x39f):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3a5):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3ab):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3b1):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3b7):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3bd):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3c3):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3cb):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3d6):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3e0):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3e9):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3f2):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3fb):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x403):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x40d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x416):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x41e):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x429):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x42d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x1c):
0x0000000000000000 R_LARCH_32_PCREL `L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x20):
0x0000000000000000 R_LARCH_ADD32 L0' 0x0000000000000000 R_LARCH_SUB32 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x26):
0x0000000000000000 R_LARCH_ADD8 L0' 0x0000000000000000 R_LARCH_SUB8 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x34):
0x0000000000000000 R_LARCH_32_PCREL `L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x38):
0x0000000000000000 R_LARCH_ADD32 L0' 0x0000000000000000 R_LARCH_SUB32 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x3e):
0x0000000000000000 R_LARCH_ADD8 L0' 0x0000000000000000 R_LARCH_SUB8 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x46):
0x0000000000000000 R_LARCH_ADD6 L0' 0x0000000000000000 R_LARCH_SUB6 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x0):
0x0000000000000000 R_LARCH_PCREL20_S2 __dso_handle' 0x0000000000000000 R_LARCH_RELAX '

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x4):
0x0000000000000000 R_LARCH_NONE <nameless>' 0x0000000000000000 R_LARCH_RELAX '

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x8):
0x0000000000000000 R_LARCH_B26 __register_atfork@@GLIBC_2.27' 0x0000000000000000 R_LARCH_SOP_PUSH_ABSOLUTE ' + 131072(0x20000)
0x0000000000020000 R_LARCH_SOP_ADD `'

-- Record dump end --

/home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS): in function `__pthread_atfork':
/home/ubuntu/Desktop/loongarch/src/glibc-2.28/nptl/../sysdeps/loongarch/pthread_atfork.c:51:(.text+0x8): Internal stack state is incorrect.
Want to push to full stack or pop from empty stack?
collect2: error: ld returned 1 exit status
make[2]: *** [../Makerules:606:/home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt.so] 错误 1
make[2]: 离开目录“/home/ubuntu/Desktop/loongarch/src/glibc-2.28/rt”
make[1]: *** [Makefile:486:rt/others] 错误 2
make[1]: 离开目录“/home/ubuntu/Desktop/loongarch/src/glibc-2.28”
make: *** [Makefile:9:all] 错误 2
ubuntu@ubuntu-OptiPlex-5060:~/Desktop/loongarch/build/build-libc$ BUILD_CC='x86_64-build_pc-linux-gnu-gcc' CC='loongarch64-linux-gnu-gcc -O2 -U_FORTIFY_SOURCE -march=loongarch64 ' CFLAGS='' AR='loongarch64-linux-gnu-ar' RANLIB='loongarch64-linux-gnu-ranlib' && /home/ubuntu/Desktop/loongarch/src/glibc-2.28/configure --prefix=/usr --build=x86_64-build_pc-linux-gnu --host=loongarch64-linux-gnu --cache-file=/home/ubuntu/Desktop/loongarch/build/build-libc/config.cache --without-cvs --disable-profile --without-gd --with-headers=/home/ubuntu/Desktop/loongarch/loongarch64-linux-gnu/loongarch64-linux-gnu/sysroot/usr/include --disable-debug --disable-sanity-checks --enable-kernel=4.19.190 --with-__thread --with-tls --enable-shared --enable-add-ons=no --disable-werror && make -j8 && make install_root=/home/ubuntu/Desktop/loongarch/loongarch64-linux-gnu/loongarch64-linux-gnu/sysroot/ MAKEINFO=: install

@yunhai2009
Copy link
Author

另外发现一个问题,如果使用binutils-2.42 gcc12.4 glibc2.28生成的交叉编译工具链,生成的elf的标志(flags)为0x43,而龙芯官方公布的工具链编译生成的elf标志为0x3。请问是不是说binutils在新旧世界并不兼容?binutils-2.42只能生成新世界的elf,而龙芯公布的binutils-2.31.1只能生成旧世界的elf。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant