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

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

Open
qianwch opened this issue Nov 12, 2024 · 5 comments
Open

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

qianwch opened this issue Nov 12, 2024 · 5 comments
Labels
bug Something isn't working community pgvectorscale

Comments

@qianwch
Copy link

qianwch commented Nov 12, 2024

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?

@qianwch qianwch added bug Something isn't working community pgvectorscale labels Nov 12, 2024
@tjgreen42
Copy link
Contributor

tjgreen42 commented Nov 13, 2024

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.

@qianwch
Copy link
Author

qianwch commented Nov 14, 2024

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
Copy link
Collaborator

cevian commented Nov 14, 2024

@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
Copy link
Author

qianwch commented Nov 14, 2024

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

@tjgreen42
Copy link
Contributor

tjgreen42 commented Dec 4, 2024

Okay, so SIMD is not the issue.

I hauled an old iMac out of the garage and spent a little time looking at this today. The symbols like _AllocSetContextCreateInternal and _BufferBlocks are Postgres functions that for whatever reason are not linking properly on this hardware configuration. It doesn't exactly seem to be a pgvectorscale-specific issue, although it may be as plain vanilla pgrx projects do compile and link properly.

I think we are just going to have to document that x86 macos is not supported, unless somebody who is passionate about it wants to dive deep and figure out a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community pgvectorscale
Projects
None yet
Development

No branches or pull requests

3 participants