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

rpm for ppc64le platform #540

Open
bogdansavu opened this issue Aug 28, 2023 · 11 comments
Open

rpm for ppc64le platform #540

bogdansavu opened this issue Aug 28, 2023 · 11 comments

Comments

@bogdansavu
Copy link

I need to compile the agent for ppc64le platform. I moved the discussion from logdna/logdna-agent#151 to this issue.

@dkhokhlov
Copy link
Contributor

dkhokhlov commented Aug 28, 2023

I tried using: [patch.crates-io] ring = { git = "https://github.com/ibm/ring.git", branch = "ppc-0.16.20" }

but I'm getting this error: error[E0599]: no method named description_ found for struct KeyRejected in the current scope --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rcgen-0.9.3/src/lib.rs:1624:35 | 1624 | RcgenError::RingKeyRejected(err.description_()) | ^^^^^^^^^^^^ method not found in KeyRejected

For more information about this error, try rustc --explain E0599. error: could not compile rcgen (lib) due to previous error warning: build failed, waiting for other jobs to finish...

Any suggestion? It is something that I can fix?

@bogdansavu
I noticed that ring has two branches:

- main-ppc for the somewhat-upstream version
- ppc-0.16.20 for the current latest version published to crates.io

have you tried main?

@bogdansavu
Copy link
Author

Hey @dkhokhlov

main-ppc:
error: failed to run custom build command for ring v0.16.20
Caused by:
process didn't exit successfully: /root/logdna-agent-v2/target/release/build/ring-fc628d533a3f1b6c/build-script-build (exit status: 101)
--- stderr
thread 'main' panicked at 'called Option::unwrap() on a None value', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:358:10
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

ppc-0.16.20:
error[E0599]: no method named description_ found for struct KeyRejected in the current scope
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rcgen-0.9.3/src/lib.rs:1624:35
|
1624 | RcgenError::RingKeyRejected(err.description_())
| ^^^^^^^^^^^^ method not found in KeyRejected

For more information about this error, try rustc --explain E0599.
error: could not compile rcgen due to previous error

@dkhokhlov
Copy link
Contributor

looks like ring build script fails. can you build ring?

sudo apt install gcc-powerpc64le-linux-gnu
git clone git@github.com:IBM/ring.git
git co main-ppc
cargo build --target powerpc64le-unknown-linux-gnu

@bogdansavu
Copy link
Author

cargo build --target powerpc64le-unknown-linux-gnu
Updating crates.io index
Compiling libc v0.2.147
Compiling untrusted v0.9.0
Compiling once_cell v1.18.0
Compiling cc v1.0.83
Compiling ring v0.17.0-not-released-yet (/root/ring)
warning: unnecessary parentheses around match arm expression
--> build.rs:676:21
|
676 | "x86_64" => ("win64"),
| ^ ^
|
= note: #[warn(unused_parens)] on by default
help: remove these parentheses
|
676 - "x86_64" => ("win64"),
676 + "x86_64" => "win64",
|

warning: unnecessary parentheses around match arm expression
--> build.rs:677:18
|
677 | "x86" => ("win32"),
| ^ ^
|
help: remove these parentheses
|
677 - "x86" => ("win32"),
677 + "x86" => "win32",
|

warning: ring (build script) generated 2 warnings
Finished dev [unoptimized + debuginfo] target(s) in 8.08s

@bogdansavu
Copy link
Author

@dkhokhlov any other suggestion? Is something that I can do?

@bogdansavu
Copy link
Author

@dkhokhlov I successfully compiled logdna using :
ring = { git = "https://github.com/erichte-ibm/ring.git", branch = "ppc-0.16.20-rework" }

I have a question, there is any way to generate rpm packages?

@dkhokhlov
Copy link
Contributor

dkhokhlov commented Sep 15, 2023

@bogdansavu
this is great!
packages can be produced by:

make build-rpm
make build-deb

@bogdansavu
Copy link
Author

this make build-rpm is failing, I don't understand why docker is needed, there is any other command that I can use for rpm build?

make build-rpm
CACHE_TARGET="false" ARCH=x86_64 ./docker/dispatch.sh "/build" "/root/logdna-agent-v2:/build:Z" docker.io/logdna/build-images:rust-bullseye-1-stable-x86_64 "--env CARGO_TARGET_DIR=target/x86_64-linux-gnu --env RUST_BACKTRACE=full" "RUSTFLAGS='' BINDGEN_EXTRA_CLANG_ARGS='' cargo build --features libjournald --manifest-path bin/Cargo.toml --release --target x86_64-unknown-linux-gnu && llvm-strip ./target/x86_64-linux-gnu/x86_64-unknown-linux-gnu/release/logdna-agent"
./docker/lib.sh: line 12: docker: command not found
./docker/dispatch.sh: line 29: docker: command not found
./docker/dispatch.sh: line 33: docker: command not found
./docker/dispatch.sh: line 36: docker: command not found
./docker/dispatch.sh: line 39: docker: command not found
./docker/dispatch.sh: line 41: exit: : numeric argument required
make: *** [Makefile:200: build-release] Error 2

@dkhokhlov
Copy link
Contributor

we use docker container for builds. it is pre-configured with required tools. i am suggesting to install the docker.

@bogdansavu
Copy link
Author

I installed docker but the image build is failing:
ARCH=ppc64le scripts/mk.image
~/logdna-agent-v2 ~/logdna-agent-v2
DOCKER_BUILDKIT=1 docker build . -t logdna-agent-v2:0b89443-ppc64le

--progress=plain
--platform=linux/
--secret id=aws,src=/tmp/.aws_creds_static.WEBIEu
--rm
--build-arg BUILD_ENVS=" CARGO_TARGET_DIR=target/ppc64le-linux-gnu"
--build-arg BUILD_IMAGE=docker.io/logdna/build-images:rust-bullseye-1-stable-ppc64le
--build-arg TARGET=ppc64le-unknown-linux-gnu
--build-arg TARGET_DIR=target/ppc64le-linux-gnu
--build-arg TARGET_ARCH=ppc64le
--build-arg BUILD_TIMESTAMP=2023-09-19T15:15:11Z
--build-arg BUILD_VERSION=3.9.0-dev
--build-arg FEATURES='--features libjournald'
--build-arg REPO=logdna-agent-v2
--build-arg VCS_REF=0b89443
--build-arg VCS_URL=https://github.com/logdna/logdna-agent-v2
--build-arg SCCACHE_BUCKET=
--build-arg SCCACHE_REGION=
--build-arg SCCACHE_ENDPOINT=
ERROR: "" is an invalid component of "linux/": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
make: *** [Makefile:388: build-image] Error 1

@bogdansavu
Copy link
Author

bogdansavu commented Sep 21, 2023

@dkhokhlov I manually generated the rpm file, could you please have a look and let me know if you see any problem on these steps?

git clone https://github.com/logdna/logdna-agent-v2.git
cd logdna-agent-v2
git checkout 3.8.8

Building Agent Binary on Linux

vi Cargo.toml
[patch.crates-io]
ring = { git = "https://github.com/ibm/ring.git", branch = "ppc-0.16.20" }
ARCH=ppc64le cargo build --release

Building rpm package

dnf install ruby-devel gcc make rpm-build
gem install --no-ri --no-rdoc fpm
ARCH=ppc64le
BUILD_VERSION=$(sed -nE "s/^version = "(.+)"$$/\1/p" bin/Cargo.toml)
RPM_VERSION=1
package_version="${BUILD_VERSION}"
iteration="${RPM_VERSION}"
TARGET="/root/logdna-agent-v2/target"
echo "Generating rpm package for version ${BUILD_VERSION} as ${package_version}-${iteration}";
chmod +x ${TARGET}/release/logdna-agent
mkdir /release
fpm
-a "${ARCH}"
--verbose
--input-type dir
--output-type rpm
-p "${TARGET}/logdna-agent-${package_version}-${iteration}.${ARCH}.rpm"
--name "logdna-agent"
--version "${package_version}"
--iteration "${iteration}"
--license MIT
--vendor "LogDNA, Inc."
--description "LogDNA Agent for Linux"
--url "https://logdna.com/"
--maintainer "LogDNA support@logdna.com"
--before-remove packaging/linux/before-remove
--after-upgrade packaging/linux/after-upgrade
--force
"${TARGET}/release/logdna-agent=/usr/bin/logdna-agent"
"packaging/linux/logdna-agent.service=/lib/systemd/system/logdna-agent.service"

rpm -qlp /root/logdna-agent-v2/target/logdna-agent-3.8.8-1.ppc64le.rpm
/lib/systemd/system/logdna-agent.service
/usr/bin/logdna-agent
/usr/lib/.build-id
/usr/lib/.build-id/a1
/usr/lib/.build-id/a1/0a6d5a126b8e6bcddd13a27d7d64a04a314d01

I'm not sure if the '/usr/lib/.build-id' is expected to be there.

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

No branches or pull requests

2 participants