timescale / pgvectorscale

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

[Bug]: Build failing on Amazon linux 2 #158

Closed shreeramk closed 2 weeks ago

shreeramk commented 2 weeks ago

What happened?

While trying to do install --release following error is coming.

$ cargo pgrx install --release Using PgConfig("pg15") and pg_config from /usr/pgsql-15/bin/pg_config Building extension with features pg15 Running command "/home/ec2-user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo" "build" "--lib" "--release" "--features" "pg15" "--no-default-features" "--message-format=json-render-diagnostics" Compiling pgrx-pg-sys v0.12.5 error: failed to run custom build command for pgrx-pg-sys v0.12.5

Caused by: process didn't exit successfully: /tmp/pgvectorscale/pgvectorscale/target/release/build/pgrx-pg-sys-cb64941d069e3ca4/build-script-bindgen (exit status: 1) --- stdout cargo:rerun-if-env-changed=PGRX_BUILD_VERBOSE cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE cargo:rerun-if-env-changed=PGRX_PG_CONFIG_PATH cargo:rerun-if-env-changed=PGRX_PG_CONFIG_AS_ENV cargo:rerun-if-env-changed=LLVM_CONFIG_PATH cargo:rerun-if-env-changed=LIBCLANG_PATH cargo:rerun-if-env-changed=LIBCLANG_STATIC_PATH cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE cargo:rerun-if-changed=include cargo:rerun-if-changed=pgrx-cshim.c cargo:rerun-if-changed=/home/ec2-user/.pgrx/config.toml cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG15_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG15 cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG15_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG15 cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER cargo:rerun-if-env-changed=PGRX_PG_SYS_EXTRA_OUTPUT_PATH

--- stderr build_paths=BuildPaths { manifest_dir: "/home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-pg-sys-0.12.5", out_dir: "/tmp/pgvectorscale/pgvectorscale/target/release/build/pgrx-pg-sys-15a4c54dd7f3eedb/out", src_dir: "/home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-pg-sys-0.12.5/src/include", shim_src: "/home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-pg-sys-0.12.5/pgrx-cshim.c", shim_dst: "/tmp/pgvectorscale/pgvectorscale/target/release/build/pgrx-pg-sys-15a4c54dd7f3eedb/out/pgrx-cshim.c" } Generating bindings for pg15 pg_config --configure CLANG = Some("/opt/rh/llvm-toolset-7/root/usr/bin/clang") Bindgen found clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2) found libclang at /usr/lib64/libclang.so.7 Found include dirs ["/usr/lib64/clang/7.0.1/include"] clang diag: /usr/pgsql-15/include/server/port.h:212:70: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/port.h:214:55: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/port.h:216:58: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/port.h:218:43: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:173:40: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:174:49: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:177:56: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:177:30: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:179:43: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:180:52: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:182:47: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:186:57: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:186:31: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:189:56: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:189:30: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:191:41: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:194:57: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:194:31: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:208:48: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:239:54: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/elog.h:468:47: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/palloc.h:155:44: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/utils/palloc.h:156:80: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/lib/stringinfo.h:96:67: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] clang diag: /usr/pgsql-15/include/server/lib/stringinfo.h:107:78: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes] Error: bindgen failed for pg15

Caused by: 0: failed to parse generated bindings 1: expected identifier or _

Location: /home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-bindgen-0.12.5/src/build.rs:751:40

pgvectorscale extension affected

No response

PostgreSQL version used

15

What operating system did you use?

Amazon Linux 2

What installation method did you use?

Source

What platform did you run on?

Amazon Web Services (AWS)

Relevant log output and stack trace

No response

How can we reproduce the bug?

While performing the tasks mentioned in Readme

# install prerequisites
## rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
## pgrx
cargo install --locked cargo-pgrx
cargo pgrx init --pg16 pg_config

#download, build and install pgvectorscale
cd /tmp
git clone --branch <version> https://github.com/timescale/pgvectorscale
cd pgvectorscale/pgvectorscale
cargo pgrx install --release

Are you going to work on the bugfix?

None

deklanw commented 2 weeks ago

Same issue here. Also pg15.

Note that I ran cargo pgrx init --pg15 pg_config

(pg15 not pg16).

Note also that initially I got

$ cargo pgrx install --release
Error:
   0: The installed cargo-pgrx 0.12.8 is not compatible with the dependencies in ./Cargo.toml:
      pgrx = 0.12.5, pgrx-macros = 0.12.5, pgrx-sql-entity-graph = 0.12.5, pgrx-tests = 0.12.5
      cargo-pgrx and pgrx library versions must be identical.
      help: cargo install cargo-pgrx --version 0.12.5 --locked

Location:
   /home/deklan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.12.8/src/metadata.rs:83

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   0: cargo_pgrx::metadata::validate
      at /home/deklan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.12.8/src/metadata.rs:30
   1: cargo_pgrx::command::install::execute
      at /home/deklan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-pgrx-0.12.8/src/command/install.rs:63

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

So per the suggestion I downgraded cargo-pgrx with

cargo install cargo-pgrx --version 0.12.5 --locked

after which cargo pgrx install --release gives me the same error as OP.

shreeramk commented 2 weeks ago

@deklanw do following steps.

In Cargo.toml - modify pgrx, pgrx-tests, pgrx-pg-config versions to 0.12.8 . Then update pgrx to 0.12.8

cargo install cargo-pgrx --version 0.12.5 --locked

And then do cargo pgrx install --release

This worked fine for me.