Skip to content

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

Closed

Description

@biabbas

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.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 28, 2024
  2. workingjubilee commented on Jun 28, 2024

    @workingjubilee
    Member

    @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:

    } else {
    Err(io::Error::last_os_error())
    }
    }
    }
    pub fn output(&mut self) -> io::Result<(ExitStatus, Vec<u8>, Vec<u8>)> {
    let (proc, pipes) = self.spawn(Stdio::MakePipe, false)?;
    crate::sys_common::process::wait_with_output(proc, pipes)
    }
    pub fn exec(&mut self, default: Stdio) -> io::Error {
    let ret = Command::spawn(self, default, false);

  3. workingjubilee commented on Jun 28, 2024

    @workingjubilee
    Member

    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.

  4. added
    O-vxworksTarget: when they made us, they called us Curiosity, and Spirit, and told us to tell you hello
    C-bugCategory: This is a bug.
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 29, 2024
  5. workingjubilee commented on Jun 29, 2024

    @workingjubilee
    Member

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

  6. added a commit that references this issue on Jul 4, 2024
  7. biabbas commented on Jul 4, 2024

    @biabbas
    ContributorAuthor

    Why are there unsafe errors for unsafe blocks? If I add the whole fn as unsafe and remove unsafe blocks, I'm able to compile for vxworks.

  8. added a commit that references this issue on Jul 4, 2024
  9. workingjubilee commented on Jul 5, 2024

    @workingjubilee
    Member

    The standard library denies all warnings in its build. One of the warnings the Rust compiler issues is "you added an unsafe {} block but you didn't need it".

  10. biabbas commented on Jul 8, 2024

    @biabbas
    ContributorAuthor

    The standard library denies all warnings in its build. One of the warnings the Rust compiler issues is "you added an unsafe {} block but you didn't need it"

    But for vxworks somehow these are not disabled. Is this because we only build the libraries for vxworks.

  11. workingjubilee commented on Jul 12, 2024

    @workingjubilee
    Member

    Somehow it thinks libc::pwrite is not an unsafe extern "C" function...?

  12. biabbas commented on Jul 16, 2024

    @biabbas
    ContributorAuthor

    Pushed commits to build nightly for vxworks. Current stable source 1.79.0 can be built after applying this patch.
    1.79_stable.patch

  13. added a commit that references this issue on Jul 24, 2024
  14. added a commit that references this issue on Jul 24, 2024
  15. added a commit that references this issue on Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-vxworksTarget: when they made us, they called us Curiosity, and Spirit, and told us to tell you helloT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions