You are not logged in.
I tried to write a pkgbuild for a rust software today, but it kept failing to compile. I tried many methods, including explicitly specifying the library path, but it still failed to compile. However, I was able to build successfully by running
cargo build -r
directly in the project folder.
I hope someone can help me, thank you again
The following is the PKGBUILD
# Maintainer: gao <gao66 at sdf dot org>
pkgname=iptv-checker-rs-git
_pkgname=iptv-checker-rs
pkgver=3.2.1.r10.g0a1e1c9
pkgrel=1
pkgdesc="Checking links in IPTV playlists written in Rust"
arch=('x86_64' 'aarch64')
url="https://github.com/zhimin-dev/iptv-checker-rs"
license=('unknown')
depends=('ffmpeg')
makedepends=('rust' 'cargo' 'git' 'base-devel')
source=("git+$url.git")
sha256sums=('SKIP')
backup=("usr/share/${pkgname}/tasks.json")
pkgver() {
cd "$srcdir/$_pkgname"
git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir/$_pkgname"
git submodule update --init --recursive
}
build() {
cd "$srcdir/$_pkgname"
cargo build --release --verbose
}
package() {
cd "$srcdir/$_pkgname"
install -Dm755 "target/release/$_pkgname" "$pkgdir/usr/share/$_pkgname/$_pkgname"
install -d "$pkgdir/usr/share/$_pkgname/web"
cp -r web/* "$pkgdir/usr/share/$_pkgname/web"
ln -s "/usr/share/$_pkgname/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
}
Last edited by gao66 (Yesterday 10:05:54)
Offline
source=("git+$url.git")
prepare() {
cd "$srcdir/$_pkgname"
git submodule update --init --recursive
}
Using git submodules in a PKGBUILD requires more then that.
You should also read https://wiki.archlinux.org/title/Rust_p … guidelines
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Sad. Still can't build
Modified according to wiki requirements
# Maintainer: gao <gao66 at sdf dot org>
pkgname=iptv-checker-rs-git
_pkgname=iptv-checker-rs
pkgver=3.2.1.r10.g0a1e1c9
pkgrel=1
pkgdesc="Checking links in IPTV playlists written in Rust"
arch=('x86_64' 'aarch64')
url="https://github.com/zhimin-dev/iptv-checker-rs"
license=('unknown')
depends=('ffmpeg')
makedepends=('cargo' 'git')
source=("git+$url.git")
sha256sums=('SKIP')
backup=("usr/share/${pkgname}/tasks.json")
pkgver() {
cd "$srcdir/$_pkgname"
git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir/$_pkgname"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --offline --target "$CARCH-unknown-linux-gnu"
}
build() {
cd "$srcdir/$_pkgname"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release --all-features
}
package() {
cd "$srcdir/$_pkgname"
install -Dm755 "target/release/$_pkgname" "$pkgdir/usr/share/$_pkgname/$_pkgname"
install -d "$pkgdir/usr/share/$_pkgname/web"
cp -r web/* "$pkgdir/usr/share/$_pkgname/web"
ln -s "/usr/share/$_pkgname/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
}
And there are errors
<The above omitted>
...
/home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.104/src/./ssl.rs:468:(.text._ZN11openssl_sys7openssl3ssl29SSL_CTX_set_max_proto_version17hcb326ccf4a2ca007E+0x11): undefined reference to `SSL_CTX_ctrl'
/usr/bin/ld: /home/john/git/aur/iptv-checker-rs/src/iptv-checker-rs/target/release/deps/iptv_checker_rs-d37e696246cab059: hidden symbol `OPENSSL_cpuid_setup' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
= note: 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#rustc-link-lib)
warning: `iptv-checker-rs` (bin "iptv-checker-rs") generated 29 warnings
error: could not compile `iptv-checker-rs` (bin "iptv-checker-rs") due to 1 previous error; 29 warnings emitted
Although it can be compiled directly in the project folder, it cannot be compiled with pkgbuild
And If anyone can solve this problem, I will pay them 10 us dollers.
Last edited by gao66 (Yesterday 11:04:38)
Offline
Your cargo fetch command in prepare is not the same as in wiki, you are also no longer using git submodules .
The error itself looks like it may be caused by a missing dep or version mismatch .
Please link to the upstream build instructions you follow .
Added :
And If anyone can solve this problem, I will pay them 10 us dollers.
Every user of archlinux (including staff) volunteers their time and effort without asking anything in return.
Offers like that make people wonder if someone will fit in the community and increase the chance people won't help.
Last edited by Lone_Wolf (Yesterday 11:10:32)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Your cargo fetch command in prepare is not the same as in wiki, you are also no longer using git submodules .
Because the upstream project does not contain the cargo.lock file, an error will be reported if following the wiki command, so replace it with this command. This project also does not contain submodules.
Please link to the upstream build instructions you follow .
The upstream requires the use of the
make build
to build,
the makefile is as follows
.PHONY: build
all: build
build:
make init-cargo && \
cargo build -r --target x86_64-unknown-linux-musl && \
cargo build -r --target x86_64-apple-darwin && \
cargo build -r --target x86_64-pc-windows-gnu && \
cargo build -r --target aarch64-unknown-linux-gnu && \
make migrate
init-cargo:
mkdir .cargo && cp cargo_config.toml .cargo/config.toml
migrate-mac:
cp target/x86_64-apple-darwin/release/iptv-checker-rs ./iptv-checker-rs-x86_64-apple-darwin
migrate-win:
cp target/x86_64-pc-windows-gnu/release/iptv-checker-rs.exe ./iptv-checker-rs-x86_64-pc-windows-gnu.exe
migrate-linux:
cp target/x86_64-unknown-linux-musl/release/iptv-checker-rs ./iptv-checker-rs-x86_64-unknown-linux-musl
migrate-linux-arm:
cp target/aarch64-unknown-linux-gnu/release/iptv-checker-rs ./iptv-checker-rs-aarch64-unknown-linux-gnu
migrate:
make migrate-mac && make migrate-win && make migrate-linux && make migrate-linux-arm
And the following is cargo_config.toml
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-gcc-ar"
[target.x86_64-apple-darwin]
linker = "rust-lld"
Of course, pkgbuild here does not need to use musl instead of gnu
And in the "Cargo.toml", the openssl dependency as following
[dependencies]
...
openssl = { version = "0.10.61", features = ["vendored"] }
...
The "vendored" feature tells the openssl crate to bundle and compile the OpenSSL source code during the build process, instead of relying on the OpenSSL library installed on the system.
Last edited by gao66 (Yesterday 12:30:07)
Offline
And in the "Cargo.toml", the openssl dependency as following
[dependencies]
...
openssl = { version = "0.10.61", features = ["vendored"] }
...The "vendored" feature tells the openssl crate to bundle and compile the OpenSSL source code during the build process, instead of relying on the OpenSSL library installed on the system.
https://docs.rs/openssl/latest/openssl/ indicates those are bindings to allow rust to use OpenSSL libraries.
Try changing the version to 0.10 instead of 0.10.61 .
Last edited by Lone_Wolf (Today 09:37:48)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline