openEuler 23.09 Kuasar 项目调用 Rust 执行编译目标为 aarch64-unknown-linux-musl 时报错)
一、缺陷信息
缺陷归属组件:
rust-std-static-1.71.1-1.oe2309.aarch64
缺陷归属的版本:
openEuler 23.09
缺陷简述:
bash-5.2# cargo build --target=aarch64-unknown-linux-musl --release
Compiling vmm-common v0.1.0 (/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/common)
Compiling vmm-task v0.1.0 (/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/task)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/usr/lib/rustlib/aarch64-unknown-linux-gnu/bin:/usr/lib/rustlib/aarch64-unknown-linux-gnu/bin/self-contained:/root/.cargo/bin:/root/.cargo/bin:/root/.cargo/bin:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/.fzf/bin:/usr/lib/golang:/root/go/bin:/root/bin:/usr/lib/golang:/root/go/bin" VSLANG="1033" "cc" "/usr/lib/rustlib/aarch6
4-unknown-linux-musl/lib/self-contained/crt1.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt
begin.o" "/tmp/rustcYD9Lks/symbols.o"
......
libcfg_if-bac17d2f9d215c51.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-0bef094f71fa95fe.rlib" "-lc" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-503524184
17a195b.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-dc3b5b81de625ffe.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-83eb02c8c05b0d7c
.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-06fb3afc834e8de9.rlib" "-Wl,-Bdynamic" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/
usr/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/t
ask/target/aarch64-unknown-linux-musl/release/deps/vmm_task-a19bbb31ca38fd9a" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "/usr/lib/rustlib/aa
rch64-unknown-linux-musl/lib/self-contained/crtend.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_GetDataRelBase':
(.text._Unwind_GetDataRelBase+0x44): undefined reference to `__fprintf_chk'
/usr/bin/ld: (.text._Unwind_GetDataRelBase+0x68): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_GetTextRelBase':
(.text._Unwind_GetTextRelBase+0x44): undefined reference to `__fprintf_chk'
/usr/bin/ld: (.text._Unwind_GetTextRelBase+0x68): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_Backtrace':
(.text._Unwind_Backtrace+0xf4): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o):(.text._Unwind_Backtrace+0x188): more undefined references to `__
fprintf_chk' follow
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-lib
kindname)
error: could not compile `vmm-task` (bin "vmm-task") due to previous error
【环境信息】
软件信息
OS:openEuler 23.09
【问题复现步骤】
osc co openEuler:23.09 kuasar
命令将kuasar obs项目拉取到本地osc up -S
拉取最新的代码osc osc build --root=/home/obstmp-kuasar-23.09 standard_$(uname -m)
编译构建【实际结果】
编译过程遇到错误终端,返回下面的错误信息
bash-5.2# cargo build --target=aarch64-unknown-linux-musl --release
Compiling vmm-common v0.1.0 (/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/common)
Compiling vmm-task v0.1.0 (/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/task)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/usr/lib/rustlib/aarch64-unknown-linux-gnu/bin:/usr/lib/rustlib/aarch64-unknown-linux-gnu/bin/self-contained:/root/.cargo/bin:/root/.cargo/bin:/root/.cargo/bin:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/.fzf/bin:/usr/lib/golang:/root/go/bin:/root/bin:/usr/lib/golang:/root/go/bin" VSLANG="1033" "cc" "/usr/lib/rustlib/aarch6
4-unknown-linux-musl/lib/self-contained/crt1.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt
begin.o" "/tmp/rustcYD9Lks/symbols.o"
......
libcfg_if-bac17d2f9d215c51.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-0bef094f71fa95fe.rlib" "-lc" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-503524184
17a195b.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-dc3b5b81de625ffe.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-83eb02c8c05b0d7c
.rlib" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-06fb3afc834e8de9.rlib" "-Wl,-Bdynamic" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/
usr/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/home/abuild/rpmbuild/BUILD/kuasar-0.0.1/kuasar-openeuler/vmm/t
ask/target/aarch64-unknown-linux-musl/release/deps/vmm_task-a19bbb31ca38fd9a" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "/usr/lib/rustlib/aa
rch64-unknown-linux-musl/lib/self-contained/crtend.o" "/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_GetDataRelBase':
(.text._Unwind_GetDataRelBase+0x44): undefined reference to `__fprintf_chk'
/usr/bin/ld: (.text._Unwind_GetDataRelBase+0x68): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_GetTextRelBase':
(.text._Unwind_GetTextRelBase+0x44): undefined reference to `__fprintf_chk'
/usr/bin/ld: (.text._Unwind_GetTextRelBase+0x68): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function `_Unwind_Backtrace':
(.text._Unwind_Backtrace+0xf4): undefined reference to `__fprintf_chk'
/usr/bin/ld: /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o):(.text._Unwind_Backtrace+0x188): more undefined references to `__
fprintf_chk' follow
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-lib
kindname)
error: could not compile `vmm-task` (bin "vmm-task") due to previous error
【其他相关附件信息】
kuasar项目在openEuler:Mainline项目下能够正常编译通过,但是相同的kuasar项目源码在openEuler:23.09 项目下就编译构建失败。
openEuler:Mainline编译环境中查询到的rust版本信息:
bash-5.2# rpm -qa |grep rust
rust-std-static-1.71.1-1.oe2309.aarch64
p11-kit-trust-0.25.0-1.oe2309.aarch64
rust-1.71.1-1.oe2309.aarch64
python3-rust2rpm-23-1.oe2309.aarch64
rust-packaging-23-1.oe2309.aarch6
openEuler:23.09编译环境中查询到的rust版本信息:
rust-std-static-1.71.1-1.oe2309.aarch64
p11-kit-trust-0.25.0-1.oe2309.aarch64
rust-1.71.1-1.oe2309.aarch64
python3-rust2rpm-23-1.oe2309.aarch64
rust-packaging-23-1.oe2309.aarch64
两者的版本号信息都相同,但是通过上面错误信息/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a(UnwindLevel1-gcc-ext.o): in function
_Unwind_GetDataRelBase'进行正向分析,发现
/usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a静态库文件存在差异,通过
nm`命令分析结果如下:
openEuler:Mainline编译环境中查看libunwind.a
文件的外部符号分析
bash-5.2# nm -u /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a
...
UnwindLevel1-gcc-ext.o:
U abort
U fflush
U fprintf //差异点
U logAPIs
U logUnwinding
U __stack_chk_fail
U __stack_chk_guard
U stderr
U __unw_add_dynamic_fde
U __unw_getcontext
U __unw_get_proc_info
U __unw_get_proc_name
U __unw_get_reg
U _Unwind_GetIP
U _Unwind_RaiseException
U _Unwind_Resume
U __unw_init_local
U __unw_is_signal_frame
U __unw_remove_dynamic_fde
U __unw_set_reg
U __unw_step
openEuler:23.09编译环境中查看libunwind.a
文件的外部符号分析
bash-5.2# nm -u /usr/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libunwind.a
...
UnwindLevel1-gcc-ext.o:
U abort
U fflush
U __fprintf_chk // 差异点
U logAPIs
U logUnwinding
U __stack_chk_fail
U __stack_chk_guard
U stderr
U __unw_add_dynamic_fde
U __unw_getcontext
U __unw_get_proc_info
U __unw_get_proc_name
U __unw_get_reg
U _Unwind_GetIP
U _Unwind_RaiseException
U _Unwind_Resume
U __unw_init_local
U __unw_is_signal_frame
U __unw_remove_dynamic_fde
U __unw_set_reg
U __unw_step
对比分析上面libunwind.a库文件中符号结果,openEuler 23.09项目中libunwind.a
文件中fprintf
符号变更为了__fprintf_chk
,导致了最终的kuasar项目静态编译最后链接阶段失败了。
Hi flyflyflypeng, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-Rust, and any of the maintainers: @山找海味 , @jingxiaolu , @mdche , @Admin , @pwang7 , @ZhiGang , @blackanger , @wk333
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
目前23.09的kuasar已构建成功:https://build.openeuler.openatom.cn/package/show/openEuler:23.09/kuasar
为openEuler-rpm-config中把“__global_compiler_flags”作用到了所有的软件包引起,当前该pr已回退
回退pr: https://gitee.com/src-openeuler/openEuler-rpm-config/pulls/146/files
回退后kuasar构建成功
所以此问题非rust软件包问题,Issue关闭
登录 后才可以发表评论