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

fix(builder): replace manual cmake commands with cmake crate to support all archs. #73

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

humb1t
Copy link

@humb1t humb1t commented Oct 30, 2024

Description

This PR attempts to solve #49 by using cmake crate.

Motivation and Context

I have an issue building a project that depends on randomx-rs with a setup of Mac M1 as host machine and docker builder that uses Linux ARM architecture.

How Has This Been Tested?

image

What process can a PR reviewer use to test or verify this change?

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

@humb1t
Copy link
Author

humb1t commented Oct 30, 2024

I made a test repo: https://github.com/humb1t/randomxtest

Using it, I tested that new version compiles fine:

docker build .
[+] Building 20.0s (15/15) FINISHED                                                                                                                                                                                                                                             docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 1.68kB                                                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/debian:unstable-slim                                                                                                                                                                                                                         0.6s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                                                 0.6s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                 0.0s
 => [builder 1/6] FROM docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97                                                                                                                                                                   0.0s
 => [internal] load build context                                                                                                                                                                                                                                                               0.1s
 => => transferring context: 90.11kB                                                                                                                                                                                                                                                            0.0s
 => CACHED [stage-1 1/3] FROM docker.io/library/debian:unstable-slim@sha256:1c6547721f3b1f43654a2b5f23c5d95342d8e92f84f69ad1c6675eb35e8ce42c                                                                                                                                                    0.0s
 => CACHED [builder 2/6] WORKDIR /app                                                                                                                                                                                                                                                           0.0s
 => CACHED [builder 3/6] COPY ./rust-toolchain.toml .                                                                                                                                                                                                                                           0.0s
 => CACHED [builder 4/6] RUN set -eux;     apt-get update;     apt-get install -y --no-install-recommends         ca-certificates         gcc         libc6-dev         curl         git         pkg-config         libssl-dev         llvm         libclang-dev         clang         make     0.0s
 => [builder 5/6] COPY . .                                                                                                                                                                                                                                                                      0.3s
 => [builder 6/6] RUN --mount=type=cache,target=/usr/local/cargo/git     --mount=type=cache,target=/usr/local/cargo/registry     --mount=type=cache,target=/root/.cargo     --mount=type=cache,target=/app/target     cargo build --release &&     find ./target/release/ -maxdepth 1 -type f   7.5s
 => [stage-1 2/3] COPY --from=builder /usr/local/bin /usr/local/bin                                                                                                                                                                                                                             0.0s
 => [stage-1 3/3] RUN apt-get update && apt-get -y upgrade && apt-get install -y libssl-dev ca-certificates   && chmod -R a+x /usr/local/bin                                                                                                                                                    9.2s
 => exporting to image                                                                                                                                                                                                                                                                          0.2s
 => => exporting layers                                                                                                                                                                                                                                                                         0.2s
 => => writing image sha256:ed7578d8ffbe3b2d769ba343daf07934e1025a0646a23caeab2650f7c96c8ccb

So randomx-rs = { git = "https://github.com/humb1t/randomx-rs.git", branch = "build-using-cmake-crate" } works while randomx-rs = { version = "1.3" } fails to be built.

Unfortunately, I'm not using randomx-rs directly. Only as transitive dependency. So additional testing is 100% needed before this PR being merged.

@humb1t humb1t marked this pull request as ready for review October 30, 2024 16:04
@humb1t humb1t changed the title fix(builder): Replace manual cmake commands with cmake crate to support all archs. Replace manual cmake commands with cmake crate to support all archs. Oct 30, 2024
@humb1t humb1t changed the title Replace manual cmake commands with cmake crate to support all archs. fix(builder): replace manual cmake commands with cmake crate to support all archs. Oct 30, 2024
@leet4tari
Copy link
Contributor

PR breaks Windows builds

msvc\\release\\deps\\randomx_rs-e0701b90ace6255a.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-2024-08-01-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-2024-08-01-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-2024-08-01-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-2024-08-01-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: LINK : fatal error LNK1181: cannot open input file 'stdc++.lib'␍
          

error: could not compile `randomx-rs` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

We need to get a matrix build for all supported platforms to test better.

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

Successfully merging this pull request may close these issues.

2 participants