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

WIP: cargo-c: New recipe #5534

Merged
merged 2 commits into from
Jun 6, 2022
Merged

WIP: cargo-c: New recipe #5534

merged 2 commits into from
Jun 6, 2022

Conversation

linkmauve
Copy link
Contributor

This dependency is required for building ffmpeg with rav1e support, for AV1 encoding.

I haven’t managed to finish the build nor to debug why it seemingly stops building once it reaches the cargo crate, hence the WIP tag. It runs fine until then, but then all cores are mostly idle despite a rustc process still existing. I let it run for close to five hours, to no avail.

haiku-bot pushed a commit to haiku/haiku that referenced this pull request Aug 27, 2021
This translator only supports still images for now, and supports both
decoding and encoding.

Encoding support has been tested only with aom, rav1e doesn’t build on
Haiku yet, see haikuports/haikuports#5534 for
one of the missing dependencies.

Change-Id: I716f4b862ed316b89b227bfed38072d72074201f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3040
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
@Begasus
Copy link
Contributor

Begasus commented May 31, 2022

Got a bit further (version 0.9.9) but then:

undefined reference to `getloadavg' 

@Begasus
Copy link
Contributor

Begasus commented Jun 1, 2022

Build log:

Building ...
   Compiling cargo-c v0.9.9+cargo-0.61 (/sources/cargo-c-0.9.9)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m32" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.0.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.1.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.10.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.11.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.12.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.13.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.14.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.15.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.2.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.3.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.4.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.5.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.6.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.7.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.8.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.cargo_cinstall.0d06dd71-cgu.9.rcgu.o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7.201vz7rcw6nrrxh5.rcgu.o" "-Wl,--as-needed" "-L" "/sources/cargo-c-0.9.9/target/release/deps" "-L" "/packages/openssl_x86-1.1.1n-1/.self/develop/lib/x86" "-L" "/packages/curl_x86-7.82.0-1/.self/develop/lib/x86" "-L" "/sources/cargo-c-0.9.9/target/release/build/libnghttp2-sys-f351fef23873a625/out/i/lib" "-L" "/packages/zlib_x86-1.2.12-1/.self/lib/x86" "-L" "/sources/cargo-c-0.9.9/target/release/build/libgit2-sys-76c00317dc79c9ae/out/build" "-L" "/sources/cargo-c-0.9.9/target/release/build/libssh2-sys-d9b5a2813172bee6/out/build" "-L" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib" "-Wl,-Bstatic" "/sources/cargo-c-0.9.9/target/release/deps/libcargo_c-65eec1b0e095a617.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcc-a1acbdf13fb5666d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcbindgen-b23bfe0732c4db1a.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libheck-8eb11f485a52d292.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtoml-bee284177661498a.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libsyn-e8feecf1dd2ea366.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libquote-e18dd264a81a14bc.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libproc_macro2-0f464b82ba49675a.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libproc_macro-bf840ff2c778460f.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcargo-60cc0f44f5e9776d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libhome-b8bc407ebaaf3b84.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libopener-80e3c189ea8c8657.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libunicode_xid-7b2a0f9ef92267d8.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libim_rc-a1143abf1efe2d6e.rlib" "/sources/cargo-c-0.9.9/target/release/deps/librand_xoshiro-7152f8ea5daebffa.rlib" "/sources/cargo-c-0.9.9/target/release/deps/librand_core-23e791b2e8704766.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libsized_chunks-780c3dff6afafee9.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libbitmaps-23cdc609898d6d0e.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtypenum-a3d81c88bb48952e.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libhumantime-cb045dd59a15f0c5.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libstrip_ansi_escapes-0b99315c1441ed14.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libvte-5219515fe0d8e817.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libutf8parse-935491d4a7994814.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libarrayvec-8bb6b6b9f70835c2.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libnum_cpus-59de45146873f6bf.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libserde_ignored-0caac9590c8d985a.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libunicode_width-fe2ba48a976c8e1c.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libclap-4dc74e0372ec98e7.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libstrsim-067c289f58e7174d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libatty-929b35f66e7c3148.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libclap_lex-add7a0f51b43176d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libos_str_bytes-6f3548adec67e01d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtextwrap-2920bf968490a0b0.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libignore-16cc2a25ec398931.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libthread_local-b9aca09853ee7022.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libglobset-2a6d448cef8e5dd4.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libfnv-175207b81c80ae09.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libregex-586c0f7064700d65.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libregex_syntax-e8169e5a7e4aa071.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libbstr-a416f421b6cbe281.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libaho_corasick-62c533799e6e20dd.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libgit2-fc370a1658900b34.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libopenssl_probe-d50c0f5c5edf98f5.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblibgit2_sys-a2264f754c868112.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblibssh2_sys-89379d0c75d0c22b.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcrates_io-3928445d7bf0d58f.rlib" "/sources/cargo-c-0.9.9/target/release/deps/librustfix-7772760b856c3a7a.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtar-5d659401ff1c7576.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libflate2-9de0c741275eb725.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblibz_sys-92969b7201f54f4c.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcrc32fast-358f256a9976ba44.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libserde_json-3d815c2ac46619df.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libryu-84b1d4332802e547.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libitoa-54e026600bc4cfc0.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libglob-3d81742de69585eb.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtermcolor-f632941c7392feaa.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcurl-ec57d258f6a88417.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libsocket2-b6410cb8849a6355.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcurl_sys-211f6a5a47f85d86.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libbytesize-37fc579aa4a45dfb.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtoml_edit-574c29b0cc67ca7f.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libkstring-628f772a5f065198.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libindexmap-baf452866df84301.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libhashbrown-b78e2d9ec40e4c39.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libitertools-c259f592fb350c1b.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libeither-faddedf682537b18.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcombine-6868bb7613e9e24d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libmemchr-2ca552f36ef2495d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libbytes-c236bb59d86d751e.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liburl-d5664acf603bf7c4.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libidna-0c09ff658ae8c366.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libunicode_normalization-c0bdf5ef9aed4a6c.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtinyvec-d616d11fe77dea48.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtinyvec_macros-50f6288ea892b3ee.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libunicode_bidi-48999d8ed10c0325.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libform_urlencoded-eb405a757882e946.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libpercent_encoding-41945ea2204c5eda.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libmatches-646aa6f9eec345ac.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libsemver-4b3ae07d9fbf4301.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcrossbeam_utils-289fcfba8e831f02.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblazy_static-b4874519ffbb0cdd.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblazycell-4ee1ce818ae5e6ed.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcargo_platform-921c6240fb428c68.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libserde-daab990325a40020.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcargo_util-408289ee7d82355b.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libhex-db4df7921209653c.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libwalkdir-f657be8105d5ea32.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libsame_file-bfa7104a2efeaaab.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcrypto_hash-4d33dc7f86a43be4.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libopenssl-ae2a9b26860bea22.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libonce_cell-1f4f23e6759ded3d.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libbitflags-1ec30651783c75f2.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libforeign_types-03652041508ef1b4.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libforeign_types_shared-29f9852ae9e5f695.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libopenssl_sys-3fb09d6551d9c4a6.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libhex-9f4016eecaf35af1.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libshell_escape-fa64cb8c993a7b67.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libjobserver-b92d94551324da72.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libtempfile-c51c8b1bb336bfd2.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libfastrand-b5ab87866877c5a2.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libremove_dir_all-2db436ab15a32af3.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libfiletime-7584955a5eafde8e.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblibc-cad67c1e58645468.rlib" "/sources/cargo-c-0.9.9/target/release/deps/liblog-c12c9e2a760ce6b9.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libcfg_if-5869755afc9bd755.rlib" "/sources/cargo-c-0.9.9/target/release/deps/libanyhow-1fbbb51e98035b42.rlib" "-Wl,--start-group" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libstd-68614ffd5f1112d5.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libpanic_unwind-ce886471e47c3aaa.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libminiz_oxide-3059253b2cb211b1.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libadler-473b2f689453a7f0.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libobject-1ca6db6d145b5678.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libmemchr-3582ca0312a8d5b7.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libaddr2line-63ea52bc8f64712f.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libgimli-162bf0e040422800.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/librustc_demangle-d1a0dc183382db20.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libstd_detect-d441a208a471e998.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libhashbrown-7029879467cf9aa8.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/librustc_std_workspace_alloc-de08f0f17511be31.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libunwind-5e748e868c76cc07.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libcfg_if-03f9a7e40ec2a416.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/liblibc-c4bbff0dae3b0215.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/liballoc-5fc1fdb3d93d238f.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/librustc_std_workspace_core-764944408a8b9c2c.rlib" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libcore-988c1c65dd457878.rlib" "-Wl,--end-group" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib/libcompiler_builtins-2c99002e469f285d.rlib" "-Wl,-Bdynamic" "-lz" "-lcurl" "-lssl" "-lcrypto" "-lbsd" "-lgcc_s" "-lroot" "-lnetwork" "-lbsd" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/boot/system/develop/tools/x86/rust/lib/rustlib/i686-unknown-haiku/lib" "-o" "/sources/cargo-c-0.9.9/target/release/deps/cargo_cinstall-aff94bac55a45bd7" "-Wl,--gc-sections" "-no-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /boot/system/develop/tools/x86/bin/../lib/gcc/i586-pc-haiku/11.2.0/../../../../i586-pc-haiku/bin/ld: /sources/cargo-c-0.9.9/target/release/deps/liblibgit2_sys-a2264f754c868112.rlib(rand.o): in function `git_rand_global_init':
          rand.c:(.text.git_rand_global_init+0x98): undefined reference to `getloadavg'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

Maybe @nielx could shed a light here?

@nielx
Copy link
Contributor

nielx commented Jun 1, 2022

The issue is described here: nielx/rust#15
The upstream patch to fix libgit2 is here: libgit2/libgit2#6248
The patch seems to be stalled at the moment. The weakness of having a single gatekeeper for libgit2 is keeping this from being merged.

Two alternatives:

  • Roll your own git2-rs with the alternative source tree where this is fixed, and then roll your own cargo
  • Revert to the last working cargo, which was part of Rust 1.60.0.

@Begasus
Copy link
Contributor

Begasus commented Jun 1, 2022

The issue is described here: nielx/rust#15 The upstream patch to fix libgit2 is here: libgit2/libgit2#6248 The patch seems to be stalled at the moment. The weakness of having a single gatekeeper for libgit2 is keeping this from being merged.

Two alternatives:

* Roll your own git2-rs with the alternative source tree where this is fixed, and then roll your own cargo

* Revert to the last working cargo, which was part of Rust 1.60.0.

Thanks, will look at those links in a bit, now going for the Gentoo approach described here: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-util/cargo-c/cargo-c-0.9.5.ebuild#n188

@nielx
Copy link
Contributor

nielx commented Jun 1, 2022

The issue is described here: nielx/rust#15 The upstream patch to fix libgit2 is here: libgit2/libgit2#6248 The patch seems to be stalled at the moment. The weakness of having a single gatekeeper for libgit2 is keeping this from being merged.
Two alternatives:

* Roll your own git2-rs with the alternative source tree where this is fixed, and then roll your own cargo

* Revert to the last working cargo, which was part of Rust 1.60.0.

Thanks, will look at those links in a bit, now going for the Gentoo approach described here: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-util/cargo-c/cargo-c-0.9.5.ebuild#n188

Not sure what the gentoo approach is, but the issue is likely that the current recipe pulls the latest dependencies, which includes the broken libgit2. Ideally during the build process you want to downgrade to libgit2-sys 0.12.24+1.3.0.

The build steps before cargo build would look something like:
cargo generate-lockfile
cargo update -p libgit2-sys --precise "0.12.24+1.3.0"

@Begasus
Copy link
Contributor

Begasus commented Jun 1, 2022

If I read it right it's forcing the build to use the system libgit2:

# Some crates will auto-build and statically link C libraries(!)
	# Tracker bug #709568
	export LIBSSH2_SYS_USE_PKG_CONFIG=1
	export LIBGIT2_SYS_USE_PKG_CONFIG=1
	export PKG_CONFIG_ALLOW_CROSS=1

EDIT that didn't work ;)

@nielx
Copy link
Contributor

nielx commented Jun 1, 2022

If I read it right it's forcing the build to use the system libgit2:

# Some crates will auto-build and statically link C libraries(!)
	# Tracker bug #709568
	export LIBSSH2_SYS_USE_PKG_CONFIG=1
	export LIBGIT2_SYS_USE_PKG_CONFIG=1
	export PKG_CONFIG_ALLOW_CROSS=1

That might actually worth a try! Though I don't know how close the libgit2.a version and the rust libgit2-sys are coupled, so you might run into other linker errors.

@Begasus
Copy link
Contributor

Begasus commented Jun 3, 2022

Getting there (slowly) with 0.9.8 (which is still using libgit2-sys 0.12.26+1.3.0 (so prior to 0.13.2+1.4.2 in regard to version 0.9.9))
I also created a package for libgit2 version 1.4.3 with your (awaiting PR) @nielx
Needs some fine-tuning (INSTALL part wasn't setup right atm) :)

@Begasus
Copy link
Contributor

Begasus commented Jun 3, 2022

Not to bad I think (but no recipe yet):

/Opslag/wip/rav1e-0.5.1/target/release> ./rav1e -V
rav1e 0.5.1 (release)

EDIT not there yet, rav1e was build with cargo (not cargo-c), for cargo-c I guess adding support for Haiku is needed (looking into that)

@nielx
Copy link
Contributor

nielx commented Jun 3, 2022

I also created a package for libgit2 version 1.4.3 with your (awaiting PR)

Great call! I may add that as a build dependency for Rust as well, though I am not sure if I can get it using cross-compiling.

@Begasus
Copy link
Contributor

Begasus commented Jun 3, 2022

OK, so far, build libgit2 version 1.4.3, build cargo-c version 0.9.8 and had been able to build (in Terminal) rav1e version 0.5.1
Would it be advised to first bump a version for libgit2, then bump this PR to use cargo-c 0.9.8 and (if I'm succesfull building rav1e with a recipe) push a PR for that?
EDIT libgit2 doesn't build for gcc2, so I only used secondary architecture there

@Begasus
Copy link
Contributor

Begasus commented Jun 4, 2022

Progress! :)

warning: `rav1e` (lib) generated 40 warnings
Finished release [optimized + debuginfo] target(s) in 47m 35s
Building pkg-config files
Building header file using cbindgen
Populating uninstalled header directory
Installing pkg-config file
Installing header file
Installing static library
Installing shared library

EDIT Guess I should start pushing some things here :)

rav1e

@Begasus
Copy link
Contributor

Begasus commented Jun 4, 2022

@nielx @linkmauve I've pushed my local changes here, together with the PR for libgit2 (#6974) I've been able to build rav1e as seen in the screenshot earlier, would be nice if someone could check this on 64bit (haven't got around to that yet).
Recipe for rav1e hasn't been started yet, and thinking of upstreaming the patch for Haiku support later.

@Begasus
Copy link
Contributor

Begasus commented Jun 6, 2022

Patchset updated after using cargo fmt for the correct format. Thanks @nielx and @lu-zero

@Begasus Begasus merged commit 3cf3303 into haikuports:master Jun 6, 2022
@lu-zero
Copy link

lu-zero commented Jun 6, 2022

cargo-c 0.9.10 has the haiku support in, please let me know if it works fine for you :)

@Begasus
Copy link
Contributor

Begasus commented Jun 6, 2022

Thanks for that @lu-zero ! for now I'm still using 0.9.8 as that doesn't involve the broken libgit2-sys as mentioned here earlier.
Looks like 64bit is doing OK on our buildmaster, I've been running this on 32bit the past 5 days without problems, but seems at our buildmaster the build there failed: https://build.haiku-os.org/buildmaster/master/x86_gcc2/logviewer.html?buildruns/2870/builds/78217.log
Not sure there how to solve it atm.

@Begasus
Copy link
Contributor

Begasus commented Jun 7, 2022

@nielx been looking into creating a package for git2-rs, have been talking to the guys in the rust channel on IRC (very helpful!)
This is on my last try:

waiting for build package git2_rs_x86-0.14.4-1 to be activated
Building ...
HAIKU_USE_VENDOR_DIRECTORIES=1
PWD=/sources/git2-rs-0.14.4
TERM=xterm
LIBRARY_PATH=%A/lib:/boot/home/config/non-packaged/lib:/boot/home/config/lib:/boot/system/non-packaged/lib:/boot/system/lib
SHLVL=1
LC_ALL=POSIX
PATH=/boot/system/bin/x86:.:/boot/home/config/non-packaged/bin:/boot/home/config/bin:/boot/system/non-packaged/bin:/bin:/boot/system/apps:/boot/system/preferences
_=/bin/env
1.4.3
1.4.3
1.4.3
    Updating crates.io index
       Fresh pkg-config v0.3.25
       Fresh autocfg v1.1.0
       Fresh tinyvec_macros v0.1.0
       Fresh matches v0.1.9
       Fresh unicode-bidi v0.3.8
       Fresh percent-encoding v2.1.0
       Fresh cfg-if v1.0.0
       Fresh openssl-probe v0.1.5
       Fresh bitflags v1.3.2
       Fresh tinyvec v1.6.0
       Fresh form_urlencoded v1.0.1
       Fresh libc v0.2.126
       Fresh jobserver v0.1.24
       Fresh unicode-normalization v0.1.19
       Fresh log v0.4.17
       Fresh cc v1.0.73
       Fresh idna v0.2.3
       Fresh url v2.2.2
       Fresh openssl-sys v0.9.74
       Fresh libz-sys v1.1.8
       Fresh libssh2-sys v0.2.23
   Compiling libgit2-sys v0.13.4+1.4.2 (/sources/git2-rs-0.14.4/libgit2-sys)
     Running `/sources/git2-rs-0.14.4/target/release/build/libgit2-sys-ce9e7edfa6beac46/build-script-build`
[libgit2-sys 0.13.4+1.4.2] cargo:rustc-cfg=libgit2_vendored
[libgit2-sys 0.13.4+1.4.2] error: pathspec 'libgit2' did not match any file(s) known to git
[libgit2-sys 0.13.4+1.4.2] thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: -2147459069, kind: NotFound, message: "No such file or directory" }', libgit2-sys/build.rs:204:39
[libgit2-sys 0.13.4+1.4.2] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to run custom build command for `libgit2-sys v0.13.4+1.4.2 (/sources/git2-rs-0.14.4/libgit2-sys)`

Caused by:
  process didn't exit successfully: `/sources/git2-rs-0.14.4/target/release/build/libgit2-sys-ce9e7edfa6beac46/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=libgit2_vendored

  --- stderr
  error: pathspec 'libgit2' did not match any file(s) known to git
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: -2147459069, kind: NotFound, message: "No such file or directory" }', libgit2-sys/build.rs:204:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Warning: Command '['bash', '-c', '. /wrapper-script']' returned non-zero exit status 101.
Error: Build has failed - stopping.
~> 

Looking at the env output it doesn't search for .../lib/x86? (even when switching arch in Terminal)

@Begasus
Copy link
Contributor

Begasus commented Jun 8, 2022

Thanks to some pointers on the IRC channel for rust yesterday I've been able to build cargo-c version 0.9.10 (@nielx @lu-zero )

grabbing cargo_c_x86-0.9.10-1-x86_gcc2.hpkg and moving it to /Opslag/haikuports/packages/cargo_c_x86-0.9.10-1-x86_gcc2.hpkg

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

Successfully merging this pull request may close these issues.

None yet

4 participants