130 Star 0 Fork 59

src-openEuler / rust

 / 详情

openEuler 23.09 Kuasar 项目调用 Rust 执行编译目标为 aarch64-unknown-linux-musl 时报错

已验收
缺陷
创建于  
2023-08-28 19:29

openEuler 23.09 Kuasar 项目调用 Rust 执行编译目标为 aarch64-unknown-linux-musl 时报错)

一、缺陷信息

缺陷归属组件:

rust-std-static-1.71.1-1.oe2309.aarch64

缺陷归属的版本:

openEuler 23.09

缺陷简述:

  1. openEuler 23.09下面采用Rust语言编写的项目Kuasar在进行静态编译(编译目标是:--target=aarch64-unknown-linux-musl)遇到了如下错误:
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
  1. kuasar项目在2023-08-23之前能够正常编译构建,但是现在kuasar项目没有任何改动,出现了上述的编译错误。

【环境信息】
软件信息
OS:openEuler 23.09

【问题复现步骤】

  1. 执行osc co openEuler:23.09 kuasar命令将kuasar obs项目拉取到本地
  2. 执行osc up -S拉取最新的代码
  3. 执行osc osc build --root=/home/obstmp-kuasar-23.09 standard_$(uname -m)编译构建
  4. 编译过程中就出现上面的错误信息

【实际结果】
编译过程遇到错误终端,返回下面的错误信息

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项目静态编译最后链接阶段失败了。

评论 (2)

flyflyflypeng 创建了缺陷

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

openeuler-ci-bot 添加了
 
sig/sig-Rust
标签
caodongxia 负责人设置为caodongxia

目前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关闭

caodongxia 任务状态待办的 修改为已完成
flyflyflypeng 任务状态已完成 修改为已验收

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
5329419 openeuler ci bot 1632792936 5595793 flyflyflypeng 1632451132
1
https://gitee.com/src-openeuler/rust.git
git@gitee.com:src-openeuler/rust.git
src-openeuler
rust
rust

搜索帮助