Chia-Network / chia_rs

Rust crate & wheel with consensus code
Apache License 2.0
20 stars 25 forks source link

Freebsd 13.2 ./install.sh failure #349

Open SweetAndLow opened 9 months ago

SweetAndLow commented 9 months ago

Cloned the latest chia as of yesterday into my jail on freebsd 13.2, created my virtual environment and executed the bash ./install.sh script. Got this error. I did a little poking around to see if i could just install via pip or build manually but didn't have any luck,

`Collecting chia-rs==0.2.13 (from chia-blockchain==2.1.2) Using cached chia_rs-0.2.13.tar.gz (299 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [12 lines of output] 💥 maturin failed Caused by: Cargo metadata failed. Does your crate compile with cargo build? Caused by: cargo metadata exited with an error: error: failed to load manifest for workspace member /tmp/pip-install-r8vvmcgg/chia-rs_93784bac3d044b36b6413a2c3ed8292d/chia-bls/fuzz

  Caused by:
    failed to read `/tmp/pip-install-r8vvmcgg/chia-rs_93784bac3d044b36b6413a2c3ed8292d/chia-bls/fuzz/Cargo.toml`

  Caused by:
    No such file or directory (os error 2)
  Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-tz7m0cpv', '--interpreter', '/root/chia-2.1.0/chia-blockchain/venv/bin/python']' returned non-zero exit status 1.
  Checking for Rust toolchain....
  Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-tz7m0cpv --interpreter /root/chia-2.1.0/chia-blockchain/venv/bin/python`
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.`

hoffmang9 commented 9 months ago

I've tried the basics on 13.2 including replication.

I can also build the crate in the root dir of chia_rs and pip install . in the wheel/ dir and that all works.

Not sure why it is choking on the bls fuzzer.

Others can look at it during the week.

hoffmang9 commented 9 months ago

Doing a little more troubleshooting with @Rigidity -

both cargo and rustc are versions 1.7.2.

pip install . from the wheel directory builds fine both for main and the 0.2.13 tag.

Full error log attached below - I think it's safe to ignore the earlier sql version checking errors. error.txt

Rigidity commented 9 months ago

Alright, I think the issue has been identified - We have prebuilt wheels for various platforms on PyPI, but FreeBSD is not one of them:

https://pypi.org/project/chia-rs/0.2.13/#files

Since there is no prebuilt wheel for FreeBSD, it tries to compile it from source. Which would be fine, except that the fuzz directories for each crate are missing. Will work on a fix so that this can hopefully be resolved in a future Chia version.

hoffmang9 commented 9 months ago

This can be worked around on BSD by making your own wheel from the chia_rs repository. If you git clone and then cd into the wheel directory while in the chia-blockchain venv - you can pip install . and you'll get chia_rs installed. Then re-run install.sh and you should complete the install for now.

SweetAndLow commented 9 months ago

@hoffmang9 thanks before your comment I tried but didn't realize I need to be in the wheel directory. Built and installed chia_rs 0.2.13 successfully. clvm_tools_rs didn't seem to be in pypi so I built and installed that also and now have chia 2.1.3 up and running. I'll update my install steps and probably continue to be a bother for freebsd support ;)

hoffmang9 commented 9 months ago

We will also fix this as it's a general problem for anyone who is trying to build without a binary wheel.

ChristopherP1221 commented 5 months ago

For others coming along behind me that might be running into this. I am trying to upgrade Chia in a Truenas 13.2 jail and was running into errors with clvm_rs failing during the install.sh execution. I tried the suggestions of git clone on the clvm_rs and clvm_tools_rs repos. Unfortunately, I was not paying attention to the version numbers and took the "latest" for both of those packages. The install.sh dependencies are looking specifically for

clvm_rs=0.6.1 clvm_tools_rs=0.1.40

So, from within your /chia-blockchain folder and with your venv activated, you'd do

git clone http://github.com/Chia-Network/clvm_rs.git --branch 0.6.1
git clone http://github.com/Chia-Network/clvm_tools_rs.git --branch 0.1.40

Not sure if this is necessary or not but I did anyway, build the wheel with maturin.

cd clvm_rs/
maturin build -m Cargo.toml 
cd wheel 
maturin build -m Cargo.toml
#this will create a wheel file, pip install it to the get correct version
pip install <path to your created wheel file>

Repeat the same steps for clvm_tools_rs and reattempt your install command again. Make sure you're in your venv and it should work.

cd /chia-blockchain
bash install.sh
wallentx commented 4 months ago

Just in case this is somehow related and useful, I saw similar issues building on termux, and was able to build the wheel by specifying a pyo3_config.txt https://gist.github.com/wallentx/a9e816e565f3d1be77d3cd263ffd42b7 That script generated the config. On termux, it looks like:

implementation=CPython
version=3.11
shared=true
abi3=true
build_flags=WITH_THREAD
suppress_build_script_link_lines=false
lib_dir=/data/data/com.termux/files/usr/lib
lib_name=python3.11
source chia-blockchain/activate
cd clvm_rs/wheel
pyo3-config
PYO3_CONFIG_FILE=$(pwd)/pyo3_config.txt pip wheel .
pip install chia_rs-0.9.0-cp311-cp311-linux_aarch64.whl
smasharov commented 3 months ago

FreeBSD 14.1-RELEASE I was unable to build since 2.1.4 release

cvlm_rs 0.6.1 separate build gives me:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 2m 33s
💥 maturin failed
  Caused by: Cargo didn't build a cdylib. Did you miss crate-type = ["cdylib"] in the lib section of your Cargo.toml?
ChristopherP1221 commented 2 weeks ago

Just in case this is somehow related and useful, I saw similar issues building on termux, and was able to build the wheel by specifying a pyo3_config.txt https://gist.github.com/wallentx/a9e816e565f3d1be77d3cd263ffd42b7 That script generated the config. On termux, it looks like:

implementation=CPython
version=3.11
shared=true
abi3=true
build_flags=WITH_THREAD
suppress_build_script_link_lines=false
lib_dir=/data/data/com.termux/files/usr/lib
lib_name=python3.11
source chia-blockchain/activate
cd clvm_rs/wheel
pyo3-config
PYO3_CONFIG_FILE=$(pwd)/pyo3_config.txt pip wheel .
pip install chia_rs-0.9.0-cp311-cp311-linux_aarch64.whl

Saved my ass on the subsequent upgrade and move to python 3.11. Thank you!

In case it's not obvious, copy the script linked by Wallentex to your machine and run it. It will generate the pyo3_config.txt file in your current directory. Run the next command as it to build the wheel and then install it! I needed to do this for chia-rs on freebsd13.1. It's such a pain keeping this environment going. I need to get onto truenas scale soon!