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

3.6 交叉编译器之GCC:编译得到的loongarch64-unknown-linux-gnu-gcc运行出错 #42

Open
wenheping opened this issue Nov 30, 2022 · 9 comments

Comments

@wenheping
Copy link

Anybodysuggestion?

lauser:/opt/mylaos/downloads$ loongarch64-unknown-linux-gnu-gcc wen1.c
/opt/mylaos/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/13.0.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: cannot find Scrt1.o: No such file or directory
/opt/mylaos/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/13.0.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/opt/mylaos/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/13.0.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: cannot find -lc: No such file or directory
/opt/mylaos/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/13.0.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

@sunhaiyong1978
Copy link
Owner

前面的步骤都做了吗?

@wenheping
Copy link
Author

wenheping commented Nov 30, 2022 via email

@wenheping
Copy link
Author

今天把系统换成fedora34,问题依然。

@sunhaiyong1978
Copy link
Owner

目标系统的glibc编译了吗?

@wenheping
Copy link
Author

还没有,我现在做的是3.6,第一遍gcc,目标系统glibc是3.8.

@sunhaiyong1978
Copy link
Owner

你这些报错找不到的东西可都是glibc的……,第一编的gcc就是为了编译glibc。

@wenheping
Copy link
Author

制作目标系统glibc在configure阶段出错:
lauser:/opt/mylaos/build/glibc-2.36/build-64$ BUILD_CC="gcc" CC="${CROSS_TARGET}-gcc ${BUILD64} -mlarge-func-call" CXX="${CROSS_TARGET}-gcc ${BUILD64} -mlarge-func-call" AR="${CROSS_TARGET}-ar" RANLIB="${CROSS_TARGET}-ranlib" ../configure --prefix=/usr --host=${CROSS_TARGET} --build=${CROSS_HOST} --libdir=/usr/lib64 --libexecdir=/usr/lib64/glibc --with-binutils=${SYSDIR}/cross-tools/bin --with-headers=${SYSDIR}/sysroot/usr/include --enable-stack-protector=strong --enable-add-ons --disable-werror libc_cv_slibdir=/usr/lib64 --enable-kernel=4.15
configure: loading site script /usr/share/config.site
checking build system type... x86_64-cross-linux-gnu
checking host system type... loongarch64-unknown-linux-gnu
checking for loongarch64-unknown-linux-gnu-gcc... loongarch64-unknown-linux-gnu-gcc -mabi=lp64d -mlarge-func-call
checking for suffix of object files... configure: error: in /opt/mylaos/build/glibc-2.36/build-64': configure: error: cannot compute suffix of object files: cannot compile See config.log' for more details

查config.log,里面有这个提示:
loongarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option '-mlarge-func-call'

@sunhaiyong1978
Copy link
Owner

-mlarge-func-call 参数去掉,已经不用了

@wenheping
Copy link
Author

去掉-mlarge-func-call 是解决问题的关键,现在问题解决。

另外,这里BUILD_CC和CC的区别是什么?

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

2 participants