polars icon indicating copy to clipboard operation
polars copied to clipboard

Question: build py-polars with arrow2 simd error

Open gaoxinge opened this issue 3 years ago • 3 comments

environement

  • os: windows
  • rust:
cargo 1.62.0 (a748cf5a3 2022-06-08)
release: 1.62.0
commit-hash: a748cf5a3e666bc2dcdf54f37adef8ef22196452
commit-date: 2022-06-08
host: x86_64-pc-windows-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:Schannel)
os: Windows 10.0.19043 (Windows 10 Home China) [64-bit]

question

I build py-polars from source code by following the command in https://github.com/pola-rs/polars#python-compile-polars-from-source, but with error:

error[E0432]: unresolved import `std::simd::SimdPartialEq`
 --> C:\Users\gaoxinge\.cargo\git\checkouts\arrow2-945af624853845da\fed029b\src\types\simd\packed.rs:4:5
  |
4 |     SimdPartialEq,
  |     ^^^^^^^^^^^^^ no `SimdPartialEq` in `simd`
...

gaoxinge avatar Aug 05 '22 07:08 gaoxinge

You need to use latest nightly to compile SIMD.

ritchie46 avatar Aug 05 '22 08:08 ritchie46

Thx, I upgrade the rust to

cargo 1.64.0-nightly (4fd148c47 2022-08-03)
release: 1.64.0-nightly
commit-hash: 4fd148c47e733770c537efac5220744945d572ef
commit-date: 2022-08-03
host: x86_64-pc-windows-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:Schannel)
os: Windows 10.0.19043 (Windows 10 Home China) [64-bit]

And now it's ok to run maturin develop to build py-polars, but it fails to run

maturin develop --release -- -C codegen-units=16 -C lto=thin -C target-cpu=native

with link error

error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "x86_64-w64-mingw32-gcc" "..."
  = note: C:/gaoxinge/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\gaoxinge\github\polars\py-polars\target\release\deps\polars.
polars.0186173c-cgu.10.rcgu.o:polars.0186173c-cg:(.text+0x4043): undefined reference to `__imp__ZN11polars_core10PROCESS_ID17ha0408888220fd33aE'
...
          collect2.exe: error: ld returned 1 exit status

  = help: 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#cargorustc-link-
libkindname)

gaoxinge avatar Aug 07 '22 05:08 gaoxinge

Think I've got a related issue in #4339

braaannigan avatar Aug 11 '22 14:08 braaannigan

@braaannigan You can run cargo --version --verbose command to check whether rust version is stable or nightly in your development directory right now.

If rust is stable in your development directory, you should change the version to nigthly, because simd feature is depend on it.

There have two ways to change the version to nightly:

  • use rustup default nightly to set default version to nigthly instead of stable
  • use rust-toolchain to explicitly declare the rust version in the development directory

I recommand to use second one. But now in the polars project, the rust-toolchain is only in py-polars directory, not in the root directory. So when you in root directory or polars directory, you should use first one to change the version to nightly by yourself.

To be convenient, I push a pr https://github.com/pola-rs/polars/pull/4275 for this.

Except for rust version, you may also need to run command rustup update to upgrade your rust, if your rust is old.

gaoxinge avatar Aug 12 '22 09:08 gaoxinge