Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failures on docs.rs #146

Closed
ckaran opened this issue Jan 27, 2021 · 6 comments · Fixed by #221
Closed

build failures on docs.rs #146

ckaran opened this issue Jan 27, 2021 · 6 comments · Fixed by #221
Labels
bug Something is broken help wanted Extra attention is needed native-glium Relates to running egui_glium on native

Comments

@ckaran
Copy link

ckaran commented Jan 27, 2021

You're getting build failures on docs.rs for eframe (and maybe others?) Here is a link to the log file:

https://docs.rs/crate/eframe/0.8.0/builds/338677

I didn't see anything else that jumped out at me, but I'm not as familiar with the project as I wish I was.

@ckaran ckaran added the bug Something is broken label Jan 27, 2021
@emilk emilk added the native-glium Relates to running egui_glium on native label Jan 27, 2021
@emilk
Copy link
Owner

emilk commented Jan 27, 2021

Thanks for noticing! It seems egui_glium docs have been broken from the very start. Here is 0.1.0 from august 2020: https://docs.rs/crate/egui_glium/0.1.3/builds/279591

The build error is rather cryptic. I'll put it down as yet another reason to switch from glium (#93)

@follower
Copy link
Contributor

follower commented Feb 8, 2021

[ TL;DR: Try upgrading xcb version to 0.9.0. ]

Summary

I also encountered this issue with the eframe docs.

Underlying cause seems to be the v0.8.2 version of xcb doesn't write its build files into the required directory.

The v0.9.0 release appears to include a fix.

Background

From a brief investigation[1] I noticed:

xcb related aspects

docs.rs related aspects

  • The docs.rs help (linked in the orange build failure notice on the crate page) has a section "Write attempt on read-only directories" that mentions:

    Most of the sandbox is a read-only file system, including the source directory of your crate and its dependencies. If your build.rs generates files that are relevant for documentation, consider writing to the cargo output directory, passed in the environment variable OUT_DIR.

  • The same page also mentions in https://docs.rs/about/builds#detecting-docsrs:

    To recognize Docs.rs from build.rs files, you can test for the environment variable DOCS_RS, [...]
    This approach can be helpful if you need dependencies for building the library, but not for building the documentation.

Potential solutions

So, it seems two options for solving/working around could be:

  1. Bump version of xcb required to latest.
  2. Detect when building docs only and/or on DOC_RS and skip the build step/dependency (assuming it's not required for doc generation.)

[1] Key sections of the logs are:

  • https://docs.rs/crate/eframe/0.8.0/builds/338677:

    • Note: The underlying error appears to be this Python error OSError: [Errno 30] Read-only file system: '/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/src/ffi/selinux.rs' (which--somewhat confusingly--refers to a .rs file that is presumably the name of the .rs file being generated--not the file that is the origin of the error).

    • However, when that error is being handled by the Python exception handler another error (Error in sys.excepthook:) occurs due to KeyError: 'getpwuid(): uid not found: 1001'.

    • The line number given in the traceback as line 114, in writeout, with code snippet with open(path, 'w') as f: corresponds to changes made in the commit in v0.9.0 I mentioned above.

[INFO] [stderr] error: failed to run custom build command for `xcb v0.8.2`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/xcb-4495dea23494d888/build-script-build` (exit code: 101)
[INFO] [stderr]   --- stderr
[INFO] [stderr]   error occured in handler:  ('request: ', ('xcb', 'SELinux', 'GetClientContext'))
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 2448, in <module>
[INFO] [stderr]       module.generate()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/xcbgen/state.py", line 108, in generate
[INFO] [stderr]       self.close()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 296, in rs_close
[INFO] [stderr]       _f.writeout(os.path.join(module.rs_srcdir, "ffi", "%s.rs" % _module_name(_ns.ext_name)))
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 114, in writeout
[INFO] [stderr]       with open(path, 'w') as f:
[INFO] [stderr]   OSError: [Errno 30] Read-only file system: '/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/src/ffi/selinux.rs'
[INFO] [stderr]   Error in sys.excepthook:
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 119, in apport_excepthook
[INFO] [stderr]       pr.add_user_info()
[INFO] [stderr]     File "/usr/lib/python3/dist-packages/apport/report.py", line 424, in add_user_info
[INFO] [stderr]       user = pwd.getpwuid(os.getuid())[0]
[INFO] [stderr]   KeyError: 'getpwuid(): uid not found: 1001'
[INFO] [stderr] 
[INFO] [stderr]   Original exception was:
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 2448, in <module>
[INFO] [stderr]       module.generate()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/xcbgen/state.py", line 108, in generate
[INFO] [stderr]       self.close()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 296, in rs_close
[INFO] [stderr]       _f.writeout(os.path.join(module.rs_srcdir, "ffi", "%s.rs" % _module_name(_ns.ext_name)))
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 114, in writeout
[INFO] [stderr]       with open(path, 'w') as f:
[INFO] [stderr]   OSError: [Errno 30] Read-only file system: '/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/src/ffi/selinux.rs'
[INFO] [stderr]   thread 'main' panicked at 'processing of /opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/xml/xselinux.xml returned non-zero (1)', /opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/build.rs:75:17
[INFO] [stderr]   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[INFO] [stderr] error: failed to run custom build command for `xcb v0.8.2`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/xcb-e7147420ca72501a/build-script-build` (exit code: 101)
[INFO] [stderr]   --- stderr
[INFO] [stderr]   error occured in handler:  ('request: ', ('xcb', 'SELinux', 'GetClientContext'))
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 2448, in <module>
[INFO] [stderr]       module.generate()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/xcbgen/state.py", line 108, in generate
[INFO] [stderr]       self.close()
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 296, in rs_close
[INFO] [stderr]       _f.writeout(os.path.join(module.rs_srcdir, "ffi", "%s.rs" % _module_name(_ns.ext_name)))
[INFO] [stderr]     File "/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/rs_client.py", line 114, in writeout
[INFO] [stderr]       with open(path, 'w') as f:
[INFO] [stderr]   OSError: [Errno 30] Read-only file system: '/opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/src/ffi/selinux.rs'
[INFO] [stderr]   thread 'main' panicked at 'processing of /opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/xml/xselinux.xml returned non-zero (1)', /opt/rustwide/cargo-home/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/xcb-0.8.2/build.rs:75:17
[INFO] [stderr]   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@follower
Copy link
Contributor

follower commented Feb 8, 2021

However, in terms of reasons to switch, I did notice that it appears there are some other, security related concerns with xcb (but it may still be a dependency of alternatives, also):

@follower
Copy link
Contributor

TL;DR: Workaround is probably to override rust-clipboard dependency on x11-clipboard to version 0.5.1.

Details

cargo tree reveals:

│   ├── egui_glium v0.8.0
│   │   ├── clipboard v0.5.0
│   │   │   └── x11-clipboard v0.3.3
│   │   │       └── xcb v0.8.2
│   │   │           ├── libc v0.2.80
│   │   │           └── log v0.4.11
│   │   │               └── cfg-if v0.1.10
│   │   │           [build-dependencies]
│   │   │           └── libc v0.2.80
│   │   ├── egui v0.8.0 (*)

Which lead to discovering:

@MatchaChoco010
Copy link

For your information, copypasta is a fork in the rust-clipboard crate that is maintained.
You can find it at https://github.com/alacritty/copypasta
My egui integration changed to use copypasta from rust-clipboard and my docs.rs now builds correctly.

@follower
Copy link
Contributor

Nice, thanks for mentioning copypasta[0]!

Can confirm the version bump is here:

The README mentions also adding support for Wayland clipboard so not sure if that would cause any unexpected issues elsewhere.

Good to know that the docs now at least build for you.


[0] I had just noticed the copypasta dependency name earlier today while looking at some crates but hadn't actually looked to find out what the crate did! So it's amusing that it turned out to be a fix for this unrelated issue. :)

@emilk emilk added the help wanted Extra attention is needed label Feb 28, 2021
parasyte added a commit to parasyte/egui that referenced this issue Mar 10, 2021
emilk pushed a commit that referenced this issue Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken help wanted Extra attention is needed native-glium Relates to running egui_glium on native
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants