Unable to build PL/Rust on Ubuntu 22.10
farazfazli opened this issue · 3 comments
farazfazli commented
Hi,
I'm facing the following issue while following the installation instructions:
$ cd ~/plrust/plrust
PG_VER=15 \
STD_TARGETS="x86_64-postgres-linux-gnu " \
./build
...
Running `/var/lib/postgresql/plrust/target/debug/build/pgx-pg-sys-54722aee5f63c36f/build-script-build`
Fresh atomic-traits v0.3.0
error: failed to run custom build command for `pgx-pg-sys v0.7.4`
Caused by:
process didn't exit successfully: `/var/lib/postgresql/plrust/target/debug/build/pgx-pg-sys-54722aee5f63c36f/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=PGX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
cargo:rerun-if-changed=/var/lib/postgresql/.pgx/config.toml
cargo:rerun-if-changed=include
cargo:rerun-if-changed=cshim
cargo:rerun-if-env-changed=PGX_PG_CONFIG_PATH
cargo:rerun-if-env-changed=PGX_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
--- stderr
build_paths=BuildPaths { manifest_dir: "/var/lib/postgresql/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.7.4", out_dir: "/var/lib/postgresql/plrust/target/debug/build/pgx-pg-sys-3c96fdf73631edbb/out", src_dir: "/var/lib/postgresql/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.7.4/src", shim_src: "/var/lib/postgresql/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.7.4/cshim", shim_dst: "/var/lib/postgresql/plrust/target/debug/build/pgx-pg-sys-3c96fdf73631edbb/out/cshim" }
Error: Postgres `pg15` is not managed by pgx
Location:
/var/lib/postgresql/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-config-0.7.4/src/lib.rs:496:13
As an alternative, I also tried building and running a Dockerfile following these instructions: #119 (comment) and although Postgres is running, it looks like plrust hasn't been installed.
2023-03-21 02:49:40.396 UTC [1] LOG: database system is ready to accept connections
2023-03-21 02:50:32.368 UTC [55] ERROR: language "plrust" does not exist
2023-03-21 02:50:32.368 UTC [55] STATEMENT: CREATE FUNCTION strlen(name TEXT) RETURNS int LANGUAGE plrust AS $$
Ok(Some(name.unwrap().len() as i32))
$$;
postgres=# SELECT * FROM pg_available_extensions WHERE name LIKE 'pl%';
name | default_version | installed_version | comment
---------+-----------------+-------------------+------------------------------
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
(1 row)
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)
Any ideas what could be causing this? Thank you.
eeeebbbbrrrr commented
When was the last time you ran “cargo pgx init”?
farazfazli commented
@eeeebbbbrrrr That worked, thank you. Any idea what update is needed on the Dockerfile to make that work properly? I would prefer a Docker image for ease of spinning up/down.
thomcc commented
That dockerfile seems to have:
RUN cargo install cargo-pgx --version 0.6.0-alpha.1 --locked
you need to use 0.7.2 at least currently, see https://github.com/tcdi/plrust/blob/main/plrust/build#L32