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

fails to build via cargo on FreeBSD 13.2-RELEASE #11

Closed
vyryls opened this issue Jun 18, 2023 · 10 comments · May be fixed by zmwangx/rust-ffmpeg#152
Closed

fails to build via cargo on FreeBSD 13.2-RELEASE #11

vyryls opened this issue Jun 18, 2023 · 10 comments · May be fixed by zmwangx/rust-ffmpeg#152
Labels
upstream Blocked on upstream issues

Comments

@vyryls
Copy link

vyryls commented Jun 18, 2023

cargo 1.70.0

joel@t440s ~ [1]> cargo install --git https://github.com/russelltg/wl-screenrec
    Updating git repository `https://github.com/russelltg/wl-screenrec`
  Installing wl-screenrec v0.1.0 (https://github.com/russelltg/wl-screenrec#fc918f78)
    Updating crates.io index
  Downloaded bitflags v1.3.2
  Downloaded autocfg v1.1.0
  Downloaded anstyle-query v1.0.0
  Downloaded static_assertions v1.1.0
  Downloaded rustc-hash v1.1.0
  Downloaded scoped-tls v1.0.1
  Downloaded colorchoice v1.0.0
  Downloaded peeking_take_while v0.1.2
  Downloaded strsim v0.10.0
  Downloaded ffmpeg-sys-next v6.0.1
  Downloaded heck v0.4.1
  Downloaded thiserror-impl v1.0.40
  Downloaded utf8parse v0.2.1
  Downloaded wayland-sys v0.30.1
  Downloaded signal-hook-registry v1.4.1
  Downloaded cfg-if v1.0.0
  Downloaded pkg-config v0.3.27
  Downloaded smallvec v1.10.0
  Downloaded wayland-protocols-wlr v0.1.0
  Downloaded num_cpus v1.15.0
  Downloaded downcast-rs v1.2.0
  Downloaded lazycell v1.3.0
  Downloaded is-terminal v0.4.7
  Downloaded dlib v0.5.2
  Downloaded lazy_static v1.4.0
  Downloaded anstyle v1.0.0
  Downloaded anstream v0.3.2
  Downloaded clap_derive v4.3.2
  Downloaded thiserror v1.0.40
  Downloaded memoffset v0.7.1
  Downloaded clap_lex v0.5.0
  Downloaded errno v0.3.1
  Downloaded glob v0.3.1
  Downloaded log v0.4.19
  Downloaded io-lifetimes v1.0.11
  Downloaded proc-macro2 v1.0.60
  Downloaded wayland-scanner v0.30.1
  Downloaded libloading v0.8.0
  Downloaded clap v4.3.4
  Downloaded signal-hook v0.3.15
  Downloaded cc v1.0.79
  Downloaded memchr v2.5.0
  Downloaded wayland-backend v0.1.2
  Downloaded unicode-ident v1.0.9
  Downloaded once_cell v1.18.0
  Downloaded clang-sys v1.6.1
  Downloaded minimal-lexical v0.2.1
  Downloaded nom v7.1.3
  Downloaded clap_builder v4.3.4
  Downloaded quick-xml v0.28.2
  Downloaded bindgen v0.64.0
  Downloaded regex v1.8.4
  Downloaded syn v2.0.18
  Downloaded nix v0.26.2
  Downloaded rustix v0.37.20
  Downloaded libc v0.2.146
  Downloaded quote v1.0.28
  Downloaded cexpr v0.6.0
  Downloaded anstyle-parse v0.2.0
  Downloaded syn v1.0.109
  Downloaded regex-syntax v0.7.2
  Downloaded wayland-protocols v0.30.0
  Downloaded shlex v1.1.0
  Downloaded libloading v0.7.4
  Downloaded wayland-client v0.30.2
  Downloaded human-size v0.4.2
  Downloaded drm-fourcc v2.2.0
  Downloaded ffmpeg-next v6.0.0
  Downloaded 68 crates (4.6 MB) in 2.05s
   Compiling proc-macro2 v1.0.60
   Compiling quote v1.0.28
   Compiling libc v0.2.146
   Compiling unicode-ident v1.0.9
   Compiling memchr v2.5.0
   Compiling pkg-config v0.3.27
   Compiling cc v1.0.79
   Compiling bitflags v1.3.2
   Compiling io-lifetimes v1.0.11
   Compiling glob v0.3.1
   Compiling clang-sys v1.6.1
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.109
   Compiling minimal-lexical v0.2.1
   Compiling autocfg v1.1.0
   Compiling libloading v0.7.4
   Compiling nom v7.1.3
   Compiling bindgen v0.64.0
   Compiling regex-syntax v0.7.2
   Compiling memoffset v0.7.1
   Compiling cexpr v0.6.0
   Compiling regex v1.8.4
   Compiling libloading v0.8.0
   Compiling wayland-sys v0.30.1
   Compiling rustc-hash v1.1.0
   Compiling peeking_take_while v0.1.2
   Compiling lazycell v1.3.0
   Compiling shlex v1.1.0
   Compiling lazy_static v1.4.0
   Compiling rustix v0.37.20
   Compiling dlib v0.5.2
   Compiling wayland-backend v0.1.2
   Compiling num_cpus v1.15.0
   Compiling errno v0.3.1
   Compiling static_assertions v1.1.0
   Compiling log v0.4.19
   Compiling nix v0.26.2
   Compiling syn v2.0.18
   Compiling quick-xml v0.28.2
   Compiling smallvec v1.10.0
   Compiling downcast-rs v1.2.0
   Compiling scoped-tls v1.0.1
   Compiling utf8parse v0.2.1
   Compiling anstyle-parse v0.2.0
   Compiling wayland-scanner v0.30.1
   Compiling is-terminal v0.4.7
   Compiling colorchoice v1.0.0
   Compiling anstyle-query v1.0.0
   Compiling anstyle v1.0.0
   Compiling anstream v0.3.2
   Compiling wayland-client v0.30.2
   Compiling signal-hook v0.3.15
   Compiling ffmpeg-sys-next v6.0.1
   Compiling heck v0.4.1
   Compiling ffmpeg-next v6.0.0
   Compiling drm-fourcc v2.2.0
   Compiling thiserror v1.0.40
   Compiling strsim v0.10.0
   Compiling clap_lex v0.5.0
   Compiling clap_builder v4.3.4
   Compiling wayland-protocols v0.30.0
   Compiling clap_derive v4.3.2
   Compiling thiserror-impl v1.0.40
   Compiling signal-hook-registry v1.4.1
   Compiling once_cell v1.18.0
   Compiling clap v4.3.4
error[E0432]: unresolved imports `libc::ENODATA`, `libc::ENOSR`, `libc::ENOSTR`, `libc::ETIME`
  --> /home/joel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ffmpeg-next-6.0.0/src/util/error.rs:20:22
   |
20 |     ENFILE, ENOBUFS, ENODATA, ENODEV, ENOENT, ENOEXEC, ENOLCK, ENOLINK, ENOMEM, ENOMSG,
   |                      ^^^^^^^ no `ENODATA` in the root
21 |     ENOPROTOOPT, ENOSPC, ENOSR, ENOSTR, ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE,
   |                          ^^^^^  ^^^^^^ no `ENOSTR` in the root
   |                          |
   |                          no `ENOSR` in the root
22 |     ENOTSOCK, ENOTSUP, ENOTTY, ENXIO, EOPNOTSUPP, EOVERFLOW, EOWNERDEAD, EPERM, EPIPE, EPROTO,
23 |     EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, ESRCH, ETIME, ETIMEDOUT, ETXTBSY,
   |                                                                ^^^^^ no `ETIME` in the root
   |
help: a similar name exists in the module
   |
21 |     ENOPROTOOPT, ENOSPC, ENOSR, NOSTR, ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE,
   |                                 ~~~~~
help: a similar name exists in the module
   |
23 |     EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, ESRCH, VTIME, ETIMEDOUT, ETXTBSY,
   |                                                                ~~~~~

For more information about this error, try `rustc --explain E0432`.
error: could not compile `ffmpeg-next` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `wl-screenrec v0.1.0 (https://github.com/russelltg/wl-screenrec#fc918f78)`, intermediate artifacts can be found at `/tmp/cargo-installGm3OOM```
@russelltg
Copy link
Owner

russelltg commented Jun 24, 2023

It seems that this project requires ffmpeg 5--are you aware of a way to install that on freebsd? (I'm unfamiliar, doing my best with a FreeBSD 13.2 VM I just installed)

@russelltg
Copy link
Owner

Regardless, adding

[patch.crates-io]
ffmpeg-next = { git = "https://github.com/russelltg/rust-ffmpeg", branch = "fix_freebsd_build" }

To the Cargo.toml does get past the error that you referenced. However, I get stuck on no VAAPI symbol due to no ffmpeg 5.

@jbeich
Copy link
Contributor

jbeich commented Jun 24, 2023

no ffmpeg 5

Until 2023Q3 branches on 2023-07-01 and propagates into /quarterly around 2023-07-10 ffmpeg >= 5 is only available from /latest package repo. See Handbook how to switch.

@russelltg
Copy link
Owner

Okay, got it to build now.

This requires the dmabuf protocol-- I don't think this is supported on BSD. Can you confirm?

@jbeich
Copy link
Contributor

jbeich commented Jun 25, 2023

BSDs reimplemented DMABUF under BSD license when porting MIT-licensed Linux DRM drivers. linux in linux-dmabuf-unstable-v1 is simply a vendor name, the one who created the uAPI. The actual support depends on Wayland compositor. For example, wlroots is supported on FreeBSD and DragonFly. I can confirm linux-dmabuf-unstable-v1 used by mpv, wl-mirror, wayvnc, wlvncc, waypipe, xdg-desktop-portal-wlr works fine under Sway.

Note, testing in a VM requires GPU pass-through as FreeBSD lacks kernel drivers for virtual GPUs (e.g., vmwgfx).

@russelltg
Copy link
Owner

russelltg commented Jun 25, 2023

I went ahead and installed it on an external drive so it's running natively, and with that cargo patch line it builds nicely and seems to work! (I'm in sway)

@russelltg
Copy link
Owner

I added some docs to the readme on how to build this for FreeBSD. Closing this for now--eventually I'll remove that when my PR gets merged.

@jbeich
Copy link
Contributor

jbeich commented Jul 15, 2023

Packaged. DragonFly may catch up later.

@russelltg
Copy link
Owner

Very cool!

I think your dependency list is sufficient as it will pull ffmpeg and llvm15 (I'm assuming library deps are implied as build deps, I'm unfamiliar with how pkg works)

However, it does also require libclang (for parsing ffmpeg headers and generating bindings) and ends up depending on libavcodec as well I believe.

Also, I've been lose about versioning this far since it was not officially packaged somewhere (and since most people packaged through the AUR, I could easily get the commit hash from them), would it be helpful if I formally versioned this program now?

@jbeich
Copy link
Contributor

jbeich commented Jul 22, 2023

I think your dependency list is sufficient

FreeBSD packages are built in a clean jail via poudriere (example log). I've also tested runtime in a jail with X11/Wayland sockets passed through.

However, it does also require libclang

Already specified. libclang is part of llvm* packages until subpackaging arrives.

since most people packaged through the AUR

FreeBSD uses a monorepo but lacks anything central and unmoderated like AUR for user repos. This has advantages (more binary packages) and disadvantages (poor WIP discoverability).

I could easily get the commit hash from them

FreeBSD package currently uses Git commit date as version. I've recently exposed Git hash in --version but otherwise one has to check the package recipe for GH_TAGNAME.

would it be helpful if I formally versioned this program now?

If you're ready for more users. Releases signal distros what is ready to package. Some package regardless (e.g., AUR, Nix, FreeBSD).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Blocked on upstream issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants