Chia-Network / chia_rs

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

Freebsd building from source failing - Undefined symbol "_ZNSt3__122__libcpp_verbose_abortEPKcz" #638

Closed SweetAndLow closed 3 months ago

SweetAndLow commented 3 months ago

Freebsd 13.1 -> TrueNAS

When trying to execut the chia bash install script it fails for chia_rs because it doesn't have the pre built wheels. So I tried building them manually and this use to work but it seems like it is broken at the moment.

(venv) [root@chia-farmer ~/chia-latest/chia_rs/wheel]# pip install .
Processing /root/chia-latest/chia_rs/wheel
  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
  ╰─> [8 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: process didn't exit successfully: `rustc -vV` (exit status: 1)
      --- stderr
      ld-elf.so.1: /usr/local/bin/../lib/librustc_driver-d829a4d8a572ebe4.so: Undefined symbol "_ZNSt3__122__libcpp_verbose_abortEPKcz"
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-x6u3r27o', '--interpreter', '/root/chia-2.3.0/venv/bin/python3.11']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-x6u3r27o --interpreter /root/chia-2.3.0/venv/bin/python3.11`
      [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.

Maybe it has to do with the version of rust?

(venv) [root@chia-farmer ~/chia-latest/chia_rs]# pkg info rust
rust-1.79.0_1
Name           : rust
Version        : 1.79.0_1
Installed on   : Wed Jul 31 21:33:57 2024 PDT
Origin         : lang/rust
Architecture   : FreeBSD:13:amd64
Prefix         : /usr/local
Categories     : lang
Licenses       : MIT or APACHE20
Maintainer     : rust@FreeBSD.org
WWW            : https://www.rust-lang.org/
Comment        : Language with a focus on memory safety and concurrency
Options        :
        DOCS           : on
        GDB            : off
        LTO            : off
        PORT_LLVM      : off
        SOURCES        : on
        WASM           : on
Shared Libs required:
        libcurl.so.4
Annotations    :
        FreeBSD_version: 1303001
        build_timestamp: 2024-07-25T01:14:57+0000
        built_by       : poudriere-git-3.4.1-30-g79e3edcd
        cpe            : cpe:2.3:a:rust-lang:rust:1.79.0:::::freebsd13:x64:1
        port_checkout_unclean: no
        port_git_hash  : be013aced
        ports_top_checkout_unclean: no
        ports_top_git_hash: 0fd8189d7
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 1.06GiB
Description    :
Rust is an open-source systems programming language that runs blazingly
fast, prevents almost all crashes, and eliminates data races.
Some of its features:

  - Algebraic data types, type inference
  - Pattern matching and closures
  - Concurrency without data races
  - Guaranteed memory safety
  - Optional garbage collection
  - Zero-cost abstractions
  - Minimal runtime
  - Efficient C bindings
Rigidity commented 3 months ago

Does it work if you build the wheel directly, without using pip?

You can try running this from the chia_rs/ root, rather than chia_rs/wheel/ (but still in the virtual env)

pip install maturin
maturin build --release -m wheel/Cargo.toml
SweetAndLow commented 3 months ago

Same undefined symbols error

(venv) [root@chia-farmer ~/chia-latest/chia_rs]# maturin build --release -m wheel/Cargo.toml
error: process didn't exit successfully: `rustc -vV` (exit status: 1)
--- stderr
ld-elf.so.1: /usr/local/bin/../lib/librustc_driver-d829a4d8a572ebe4.so: Undefined symbol "_ZNSt3__122__libcpp_verbose_abortEPKcz"

💥 maturin failed
  Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
  Caused by: `cargo metadata` exited with an error:
SweetAndLow commented 3 months ago

I built a new jail running 13.3 and no longer got this error. I'm not sure what was going on but it doesn't seem to be related to chia_rs. Sorry for the bogus bug. I'm still hitting issues with the bash ./install.sh when it comes to psutil building so I'll see what I can find out there.