timescale / pgvectorscale

A complement to pgvector for high performance, cost efficient vector search on large workloads.
PostgreSQL License
1.35k stars 57 forks source link

[Bug]: Can not build on Mac OS X86. #155

Open qianwch opened 1 week ago

qianwch commented 1 week ago

What happened?

I had to set RUSTFLAGS="-C target-feature=+avx2,+fma" to perform the build. But the building still failed:

  = note: Undefined symbols for architecture x86_64:
            "_AllocSetContextCreateInternal", referenced from:
                cee_scape::asm_based::call_with_sigsetjmp::call_from_c_to_rust::h2ed01fd6369823c8 in libpgrx-f450b0fe18c45ace.rlib[3](pgrx-f450b0fe18c45ace.pgrx.77db9fdf0f84df65-cgu.0.rcgu.o)
            "_BufferBlocks", referenced from:
                vectorscale::access_method::graph::Graph::prune_neighbors::h8a5b41a25296b520 in vectorscale.vectorscale.fdcca75cf4de3bfb-cgu.0.rcgu.o
                vectorscale::access_method::graph::Graph::prune_neighbors::h8a5b41a25296b520 in vectorscale.vectorscale.fdcca75cf4de3bfb-cgu.0.rcgu.o
                vectorscale::access_method::meta_page::MetaPage::overwrite::hce8ba90535a7927b in vectorscale.vectorscale.fdcca75cf4de3bfb-cgu.0.rcgu.o
                vectorscale::access_method::meta_page::MetaPage::fetch::hc9745515cd3e1e8f in vectorscale.vectorscale.fdcca75cf4de3bfb-cgu.0.rcgu.o

pgvectorscale extension affected

0.4.0

PostgreSQL version used

16.4

What operating system did you use?

macOS 15.0.1

What installation method did you use?

Source

What platform did you run on?

Other

Relevant log output and stack trace

No response

How can we reproduce the bug?

Use homebrew to install rust the current version is 1.8.1.
Follow the building steps.

RUSTFLAGS="-C target-feature=+avx2,+fma" cargo pgrx install --release

Are you going to work on the bugfix?

🆘 No, could someone else please work on the bugfix?

tjgreen42 commented 6 days ago

Agreed that this platform should be supported. What is the build error that you see without passing target-feature=+avx2,+fma? I'm guessing your hardware does not have the expected SIMD support, but this shouldn't be required anyway, there are non-SIMD codepaths for everything.

qianwch commented 6 days ago

Agreed that this platform should be supported. What is the build error that you see without passing target-feature=+avx2,+fma? I'm guessing your hardware does not have the expected SIMD support, but this shouldn't be required anyway, there are non-SIMD codepaths for everything.

It informs me to add the flags:

   Compiling vectorscale v0.4.0 (pgvectorscale/pgvectorscale)
error: On x86, the AVX2 feature must be enabled. Set RUSTFLAGS="-C target-feature=+avx2,+fma"
 --> src/access_method/distance.rs:5:1
  |
5 | / compile_error!(
6 | |     "On x86, the AVX2 feature must be enabled. Set RUSTFLAGS=\"-C target-feature=+avx2,+fma\""
7 | | );
  | |_^

error: On x86, the AVX2 feature must be enabled. Set RUSTFLAGS="-C target-feature=+avx2,+fma"
  --> src/access_method/distance_x86.rs:11:1
   |
11 | / compile_error!(
12 | |     "On x86, the AVX2 feature must be enabled. Set RUSTFLAGS=\"-C target-feature=+avx2,+fma\""
13 | | );
   | |_^

error: On x86, the fma feature must be enabled. Set RUSTFLAGS="-C target-feature=+avx2,+fma"
  --> src/access_method/distance_x86.rs:18:1
   |
18 | / compile_error!(
19 | |     "On x86, the fma feature must be enabled. Set RUSTFLAGS=\"-C target-feature=+avx2,+fma\""
20 | | );
   | |_^

error: could not compile `vectorscale` (lib) due to 3 previous errors
cevian commented 6 days ago

@qianwch can you please provide the output of rustc --print cfg -C target-cpu=native and also tell us your processor as found in [apple] -> "About This Mac" -> "processor" or "chip". Thanks.

qianwch commented 6 days ago

rustc --print cfg -C target-cpu=native

$ rustc --print cfg -C target-cpu=native
debug_assertions
panic="unwind"
target_abi=""
target_arch="x86_64"
target_endian="little"
target_env=""
target_family="unix"
target_feature="aes"
target_feature="avx"
target_feature="avx2"
target_feature="bmi1"
target_feature="bmi2"
target_feature="cmpxchg16b"
target_feature="f16c"
target_feature="fma"
target_feature="fxsr"
target_feature="lzcnt"
target_feature="movbe"
target_feature="pclmulqdq"
target_feature="popcnt"
target_feature="rdrand"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"
target_feature="xsave"
target_feature="xsaveopt"
target_has_atomic="128"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_os="macos"
target_pointer_width="64"
target_vendor="apple"
unix

The CPU is intel i7 4 cores, 2.2 GHz