rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
94.72k stars 12.21k forks source link

Vxworks build error for current master branch. Need to update some source. #127084

Open biabbas opened 4 days ago

biabbas commented 4 days ago

Hi all, For target x86_64-wrs-vxworks, I'm not able to build rustc due to the following errors.

error[E0432]: unresolved imports `libc::fdopendir`, `libc::openat`, `libc::unlinkat`
    --> library/std/src/sys/pal/unix/fs.rs:2015:16
     |
2015 |     use libc::{fdopendir, openat, unlinkat};
     |                ^^^^^^^^^  ^^^^^^  ^^^^^^^^ no `unlinkat` in the root
     |                |          |
     |                |          no `openat` in the root
     |                no `fdopendir` in the root
     |
help: a similar name exists in the module
     |
2015 |     use libc::{opendir, openat, unlinkat};
     |                ~~~~~~~
help: a similar name exists in the module
     |
2015 |     use libc::{fdopendir, open, unlinkat};
     |                           ~~~~
help: a similar name exists in the module
     |
2015 |     use libc::{fdopendir, openat, nlink_t};
     |                                   ~~~~~~~

error[E0432]: unresolved import `crate::sys_common::thread`
 --> library/std/src/sys/pal/unix/process/process_vxworks.rs:7:5
  |
7 | use crate::sys_common::thread;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `thread` in `sys_common`
  |
help: consider importing one of these modules instead
  |
7 | use crate::os::unix::thread;
  |     ~~~~~~~~~~~~~~~~~~~~~~~
7 | use crate::sys::thread;
  |     ~~~~~~~~~~~~~~~~~~
7 | use crate::thread;
  |     ~~~~~~~~~~~~~

error[E0425]: cannot find value `SOMAXCONN` in crate `libc`
   --> library/std/src/os/unix/net/listener.rs:104:48
    |
104 |             const backlog: libc::c_int = libc::SOMAXCONN;
    |                                                ^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `dirfd` in crate `libc`
   --> library/std/src/sys/pal/unix/fs.rs:862:37
    |
862 |             let fd = unsafe { libc::dirfd(self.0) };
    |                                     ^^^^^ not found in `libc`

error[E0425]: cannot find value `UTIME_OMIT` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:1327:67
     |
1327 |             None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
     |                                                                   ^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `futimens` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:1398:36
     |
1398 |                 cvt(unsafe { libc::futimens(self.as_raw_fd(), times.as_ptr()) })?;
     |                                    ^^^^^^^^ help: a function with a similar name exists: `utimes`
     |
    ::: /folk/smoodala/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/vxworks/mod.rs:1249:5
     |
1249 |     pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
     |     ---------------------------------------------------------------------------- similarly named function `utimes` defined here

error[E0425]: cannot find value `S_ISVTX` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:1661:44
     |
1661 |         let sticky = mode as c_int & libc::S_ISVTX as c_int != 0;
     |                                            ^^^^^^^ help: a constant with a similar name exists: `S_ISTXT`
     |
    ::: /folk/smoodala/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/vxworks/mod.rs:755:1
     |
755  | pub const S_ISTXT: ::c_int = 0x0200;
     | -------------------------- similarly named constant `S_ISTXT` defined here

error[E0425]: cannot find function `lchown` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:1967:28
     |
1967 |         cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
     |                            ^^^^^^
     |
    ::: /folk/smoodala/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/vxworks/mod.rs:1207:5
     |
1207 |     pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
     |     -------------------------------------------------------------------- similarly named function `chown` defined here     |
help: a function with a similar name exists
     |
1967 |         cvt(unsafe { libc::chown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
     |                            ~~~~~
help: consider importing this function
     |
7    + use crate::os::unix::fs::lchown;
     |
help: if you import `lchown`, refer to it directly
     |
1967 -         cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
1967 +         cvt(unsafe { lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
     |

error[E0425]: cannot find value `AT_FDCWD` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:2065:43
     |
2065 |                 parent_fd.unwrap_or(libc::AT_FDCWD),
     |                                           ^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `O_NOFOLLOW` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:2067:58
     |
2067 |                 libc::O_CLOEXEC | libc::O_RDONLY | libc::O_NOFOLLOW | libc::O_DIRECTORY,
     |                                                          ^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `O_DIRECTORY` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:2067:77
     |
2067 |                 libc::O_CLOEXEC | libc::O_RDONLY | libc::O_NOFOLLOW | libc::O_DIRECTORY,
     |                                                                             ^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `AT_FDCWD` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:2156:48
     |
2156 |             unlinkat(parent_fd.unwrap_or(libc::AT_FDCWD), path.as_ptr(), libc::AT_REMOVEDIR)
     |                                                ^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `AT_REMOVEDIR` in crate `libc`
    --> library/std/src/sys/pal/unix/fs.rs:2156:80
     |
2156 |             unlinkat(parent_fd.unwrap_or(libc::AT_FDCWD), path.as_ptr(), libc::AT_REMOVEDIR)
     |                                                                                ^^^^^^^^^^^^ not found in `libc`

error: unused import: `Error`
 --> library/std/src/sys/pal/unix/process/process_vxworks.rs:2:23
  |
2 | use crate::io::{self, Error, ErrorKind};
  |                       ^^^^^
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: unnecessary `unsafe` block
   --> library/std/src/sys/pal/unix/fd.rs:137:9
    |
137 |         unsafe {
    |         ^^^^^^ unnecessary `unsafe` block
    |
    = note: `-D unused-unsafe` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_unsafe)]`

error: unnecessary `unsafe` block
   --> library/std/src/sys/pal/unix/fd.rs:330:9
    |
330 |         unsafe {
    |         ^^^^^^ unnecessary `unsafe` block

Some errors have detailed explanations: E0425, E0432.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `std` (lib) due to 16 previous errors
Building bootstrap
Build completed unsuccessfully in 0:44:04 

I'll be authoring some pr's to address some, but I have few doubts that I need help with. Thank you.

  1. Why is Error and unused import in process_vxworks.rs as it is referenced twice in the same file.
workingjubilee commented 4 days ago

@biabbas

Why is Error and unused import in process_vxworks.rs as it is referenced twice in the same file.

Because it is both times referenced by the qualified io::Error form:

https://github.com/rust-lang/rust/blob/99f77a2eda555b50b518f74823ab636a20efb87f/library/std/src/sys/pal/unix/process/process_vxworks.rs#L104-L116

workingjubilee commented 4 days ago

For the unused_imports linting, the qualified form isn't considered to be equal to the unqualified form, and the import makes the unqualified form available.

workingjubilee commented 3 days ago

it seems originally @BaoshanPang was the maintainer of these targets.