rust1.41.0编译自研软件报错

服务器软件 服务器软件 2009 人阅读 | 5 人回复 | 2021-05-03

###环境###
$ cat /etc/os-version
[Version]
SystemName=UnionTech OS Server
SystemName[zh_CN]=统信服务器操作系统
ProductType=Server
ProductType[zh_CN]=服务器
EditionName=Enterprise
EditionName[zh_CN]=企业版
MajorVersion=20
MinorVersion=1030
OsBuild=12011.102

$ uname -a
Linux deepin-PC 4.19.90-bd-deepin-hw #132 SMP Fri Jan 15 09:00:34 UTC 2021 sw_64 GNU/Linux

$ cargo version
cargo 1.41.0

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/sw_64-sunway-linux-gnu/8.3.0/lto-wrapper
Target: sw_64-sunway-linux-gnu
Configured with: /home/raidforusers/xwb/swgcc830-wxiat/gcc-8.3.0/configure --build=sw_64-sunway-linux-gnu --host=sw_64-sunway-linux-gnu --target=sw_64-sunway-linux-gnu --prefix=/usr --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr --enable-shared --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --disable-multilib --enable-c99 --enable-long-long --enable-threads=posix --enable-__cxa_atexit --disable-bootstrap --disable-nls --disable-libgcj --without-isl --without-cloog --enable-multiarch --enable-browser-plugin --enable-gnu-indirect-function --enable-initfini-array --enable-linker-build-id --enable-linker-no-relax --with-cpu=sw6b : (reconfigured) /home/raidforusers/xwb/swgcc830-wxiat/gcc-8.3.0/configure --build=sw_64-sunway-linux-gnu --host=sw_64-sunway-linux-gnu --target=sw_64-sunway-linux-gnu --prefix=/usr --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr --enable-shared --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --disable-multilib --enable-c99 --enable-long-long --enable-threads=posix --enable-__cxa_atexit --disable-bootstrap --disable-nls --disable-libgcj --without-isl --without-cloog --enable-multiarch --enable-browser-plugin --enable-gnu-indirect-function --enable-initfini-array --enable-linker-build-id --enable-linker-no-relax --with-cpu=sw6b
Thread model: posix


###复现步骤###
####复现包rust-demo-pkg.tar.gz解压 ####
$ ls
config.offline
forerunner-frame.tar.gz
local_registry.tar.gz

####解压 ####
$ tar xf forerunner-frame.tar.gz     #forerunner框架
$ tar xf local_registry.tar.gz


####修改复制config.offline ####
$ vim config.offline
[source.offline]
local-registry = "/home/szly/local_registry"   #修改引号中的内容,替换实际的local_registry路径

[source.crates-io]
replace-with = "offline"

$ mkdir ~/.cargo
$ cp config.offline ~/.cargo/config

####编译复现环境####
$ cd $pwd/forerunner  # $pwd修改为实际的解压路径
$ cargo build

错误日志见附件!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

回答|共 5 个

TecSupport

发表于 2021-5-6 10:29:57 | 显示全部楼层

本帖最后由 TecSupport 于 2021-5-7 13:33 编辑

从错误日志中来看,应该是libc版本问题:
  1. Some errors have detailed explanations: E0277, E0369, E0412, E0425, E0573.
  2. For more information about an error, try `rustc --explain E0277`.
  3. error: could not compile `libc`.
  4. warning: build failed, waiting for other jobs to finish...
  5. error: build failed
复制代码



用户态程序寻求的是libc-0.2.71版本,但目前提供的rust1.41.0对应的librust-libc-dev是0.2.48版本。
研究院正在评估此版本移植的可行性和工作量
回复

使用道具 举报

TecSupport

发表于 2021-5-7 13:33:37 | 显示全部楼层

本帖最后由 TecSupport 于 2021-5-7 17:42 编辑

今天稍后会更新提供

--------------------------

已提供,见附件

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

tx-lm

发表于 2021-5-11 09:09:04 | 显示全部楼层

提供的swlibc后,cargo build没有报libc方面的问题,但是现在报open-sys方面的报错:
  1. error: failed to run custom build command for `openssl-sys v0.9.54`
  2.                              
  3. Caused by:                                                                                                                                       
  4.   process didn't exit successfully: `/home/deepin/forerunner/target/debug/build/openssl-sys-cc300231c975b3d9/build-script-main` (exit
  5. code: 101)                                                                                                                                       
  6. --- stdout                                                   
  7. cargo:rustc-cfg=const_fn                                                                                                                        
  8. cargo:rerun-if-env-changed=SW_64_SUNWAY_LINUX_GNU_OPENSSL_LIB_DIR                                                                                
  9. SW_64_SUNWAY_LINUX_GNU_OPENSSL_LIB_DIR unset                                                                                                     
  10. cargo:rerun-if-env-changed=OPENSSL_LIB_DIR                                                                                                      
  11. OPENSSL_LIB_DIR unset                                                                                                                           
  12. cargo:rerun-if-env-changed=SW_64_SUNWAY_LINUX_GNU_OPENSSL_INCLUDE_DIR                                                                           
  13. SW_64_SUNWAY_LINUX_GNU_OPENSSL_INCLUDE_DIR unset                                                                                                
  14. cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  15. OPENSSL_INCLUDE_DIR unset                       
  16. cargo:rerun-if-env-changed=SW_64_SUNWAY_LINUX_GNU_OPENSSL_DIR                                                                                    
  17. SW_64_SUNWAY_LINUX_GNU_OPENSSL_DIR unset                                                                                                         
  18. cargo:rerun-if-env-changed=OPENSSL_DIR                                                                                                           
  19. OPENSSL_DIR unset                                                                                                                                
  20. run pkg_config fail: "`"pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit code: 1\n--- stderr\nPackage openssl wa
  21. s not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc\'\nto the PKG_CONFIG_PATH environment vari
  22. able\nPackage \'openssl\', required by \'virtual:world\', not found\n"                                                                           
  23.                                                                                                                                                 
  24. --- stderr                                                                                                                                       
  25. thread 'main' panicked at '                                                                                                                     
  26.                                                                                                                                                 
  27. Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  28. proceed without this knowledge. If OpenSSL is installed and this crate had
  29. trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the                                                                  
  30. compilation process.   
  31. Make sure you also have the development packages of openssl installed.   
  32. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  33. If you're in a situation where you think the directory *should* be found
  34. automatically, please open a bug at https://github.com/sfackler/rust-openssl
  35. and include information about your system as well as this message.

  36. $HOST = sw_64-sunway-linux-gnu
  37. $TARGET = sw_64-sunway-linux-gnu
  38. openssl-sys = 0.9.54

  39. ', /home/deepin/.cargo/registry/src/-4f805a1dcb8b3bb8/openssl-sys-0.9.54/build/find_normal.rs:150:5
  40. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
复制代码
回复

使用道具 举报

TecSupport

发表于 2021-5-12 10:05:34 | 显示全部楼层

本帖最后由 TecSupport 于 2021-5-12 10:07 编辑
tx-lm 发表于 2021-5-11 09:09
提供的swlibc后,cargo build没有报libc方面的问题,但是现在报open-sys方面的报错:
...

软件openssl-sys没有找系统的openssl所致,openssl-sys0.9.54只是一个封装接口,软件自带的openssl版本是0.10.28,可以设置环境变量让软件使用系统的openssl版本1.1.1c:

比如,openssl安装在/usr目录下,就设置:SW_64_SUNWAY_LINUX_GNU_OPENSSL_DIR=/usr
回复

使用道具 举报

meteozwh

发表于 2021-5-18 18:15:15 | 显示全部楼层

本帖最后由 meteozwh 于 2021-5-18 18:18 编辑

目前,用swlibc之后,nix这个包编译报错
  1.    Compiling nix v0.16.1
  2.    Compiling prost-build v0.6.1
  3.    Compiling parking_lot v0.9.0
  4.    Compiling crossbeam-epoch v0.8.0
  5.    Compiling serde_json v1.0.59
  6.    Compiling url v1.7.2
  7.    Compiling chrono v0.4.9
  8.    Compiling url v2.1.0
  9.    Compiling uuid v0.7.4
  10.    Compiling tokio-io v0.2.0-alpha.6
  11.    Compiling bindgen v0.42.3
  12.    Compiling actix-router v0.1.5
  13.    Compiling toml v0.5.5
  14.    Compiling const-random-macro v0.1.6
  15. error: failed to run custom build command for `prost-build v0.6.1`

  16. Caused by:
  17.   process didn't exit successfully: `/home/szly/forerunner/target/release/build/prost-build-8709f6da53069505/build-script-build` (exit code: 101)
  18. --- stderr
  19. thread 'main' panicked at 'Failed to find the protoc binary. The PROTOC environment variable is not set, there is no bundled protoc for this platform, and protoc is not in the PATH', src/libcore/option.rs:1188:5
  20. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

  21. warning: build failed, waiting for other jobs to finish...
  22. error[E0432]: unresolved import `self::consts`
  23.   --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/ioctl/linux.rs:50:15
  24.    |
  25. 50 | pub use self::consts::*;
  26.    |               ^^^^^^ could not find `consts` in `self`

  27. error[E0425]: cannot find value `SIZEBITS` in this scope
  28.   --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/ioctl/linux.rs:59:50
  29.    |
  30. 59 | pub const DIRSHIFT: ioctl_num_type = SIZESHIFT + SIZEBITS as ioctl_num_type;
  31.    |                                                  ^^^^^^^^ not found in this scope

  32. error[E0425]: cannot find value `SIZEBITS` in this scope
  33.   --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/ioctl/linux.rs:66:44
  34.    |
  35. b const SIZEMASK: ioctl_num_type = (1 << SIZEBITS) - 1;
  36.    |                                            ^^^^^^^^ not found in this scope

  37. error[E0425]: cannot find value `DIRBITS` in this scope
  38.   --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/ioctl/linux.rs:68:43
  39.    |
  40. 13 | pub const NRBITS: ioctl_num_type = 8;
  41.    | ------------------------------------- similarly named constant `NRBITS` defined here
  42. ...
  43. 68 | pub const DIRMASK: ioctl_num_type = (1 << DIRBITS) - 1;
  44.    |                                           ^^^^^^^ help: a constant with a similar name exists: `NRBITS`

  45. error[E0081]: discriminant value `16` already exists
  46.    --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/macros.rs:164:26
  47.     |
  48. 164 |                   $entry = libc::$entry,
  49.     |                            ^^^^
  50.     |                            |
  51.     |                            first use of `16`
  52.     |                            enum already has `16`
  53.     |
  54.    ::: /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/signal.rs:20:1
  55.     |
  56. 20  | / libc_enum!{
  57. 21  | |     // Currently there is only one definition of c_int in libc, as well as only one
  58. 22  | |     // type for signal constants.
  59. 23  | |     // We would prefer to use the libc::c_int alias in the repr attribute. Unfortunately
  60. ...   |
  61. 65  | |     }
  62. 66  | | }
  63.     | |_- in this macro invocation

  64. error[E0081]: discriminant value `2` already exists
  65.    --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/macros.rs:164:26
  66.     |
  67. 164 |                   $entry = libc::$entry,
  68.     |                            ^^^^
  69.     |                            |
  70.     |                            first use of `2`
  71.     |                            enum already has `2`
  72.     |
  73. /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/termios.rs:537:1
  74.     |
  75. 537 | / libc_enum! {
  76. 538 | |     /// Indices into the `termios.c_cc` array for special characters.
  77. 539 | |     #[repr(usize)]
  78. 540 | |     pub enum SpecialCharacterIndices {
  79. ...   |
  80. 579 | |     }
  81. 580 | | }
  82.     | |_- in this macro invocation

  83. error[E0081]: discriminant value `15` already exists
  84.    --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/macros.rs:164:26
  85.     |
  86. 164 |                   $entry = libc::$entry,
  87.     |                            ^^^^
  88.     |                            |
  89.     |                            first use of `15`
  90.     |                            enum already has `15`
  91.     |
  92.    ::: /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/termios.rs:537:1
  93.     |
  94. 537 | / libc_enum! {
  95. 58 | |     /// Indices into the `termios.c_cc` array for special characters.
  96. 539 | |     #[repr(usize)]
  97. 540 | |     pub enum SpecialCharacterIndices {
  98. ...   |
  99. 579 | |     }
  100. 580 | | }
  101.     | |_- in this macro invocation

  102. error[E0081]: discriminant value `1` already exists
  103.    --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/macros.rs:164:26
  104.     |
  105. 164 |                   $entry = libc::$entry,
  106.     |                            ^^^^
  107.     |                            |
  108.     |                            first use of `1`
  109.     |                            enum already has `1`
  110.     |
  111.    ::: /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/termios.rs:537:1
  112.     |
  113. 537 | / libc_enum! {
  114. 538 | |     /// Indices into the `termios.c_cc` array for special characters.
  115. 539 | |     #[repr(usize)]
  116. 540 | |     pub enum SpecialCharacterIndices {
  117. ...   |
  118. 579 | |     }
  119. 580 | | }
  120.     | |_- in this macro invocation

  121. error[E0081]: discriminant value `4` already exists
  122.    --> /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/macros.rs:164:26
  123.     |
  124. 164 |                   $entry = libc::$entry,
  125.     |                            ^^^^
  126.     |                            |
  127.     |                            first use of `4`
  128.     |                            enum already has `4`
  129.     |
  130.    ::: /home/szly/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/nix-0.16.1/src/sys/termios.rs:537:1
  131.     |
  132. 537 | / libc_enum! {
  133. 538 | |     /// Indices into the `termios.c_cc` array for special characters.
  134. 539 | |     #[repr(usize)]
  135. 540 | |     pub enum SpecialCharacterIndices {
  136. ...   |
  137. 579 | |     }
  138. 580 | | }
  139.     | |_- in this macro invocation

  140. error: aborting due to 9 previous errors

  141. Some errors have detailed explanations: E0081, E0425, E0432.
  142. For more information about an error, try `rustc --explain E0081`.
  143. error: could not compile `nix`.
  144. warning: build failed, waiting for other jobs to finish...
  145. error: build failed
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则