Compilation issue (Debian Trixie)
- Compilation on Debian 13 Trixie from source from github
- PG 17 from Debian repo, clang 19.0, rustc 1.83.0
- The compilation is succesfull (according to https://postgresql-anonymizer.readthedocs.io/en/latest/INSTALL/#install-from-source)
make extension PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config PGVER="17"
make extension PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config PGVER="pg17"
cargo pgrx package --pg-config /usr/lib/postgresql/17/bin/pg_config
Using PgConfig("pg17") and `pg_config` from /usr/lib/postgresql/17/bin/pg_config
Building extension with features pg17
Running command "/usr/bin/cargo" "build" "--lib" "--release" "--features" "pg17" "--no-default-features" "--message-format=json-render-diagnostics"
Finished `release` profile [optimized] target(s) in 0.08s
Installing extension
Copying control file to target/release/anon-pg17/usr/share/postgresql/17/extension/anon.control
Copying shared library to target/release/anon-pg17/usr/lib/postgresql/17/lib/anon.so
Discovered 176 SQL entities: 1 schemas (1 unique), 165 functions, 0 types, 0 enums, 10 sqls, 0 ords, 0 hashes, 0 aggregates, 0 triggers
Rebuilding pgrx_embed, in debug mode, for SQL generation with features pg17
Compiling anon v2.0.0 (/home/vagrant/postgresql_anonymizer)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.91s
Writing SQL entities to /home/vagrant/postgresql_anonymizer/target/release/anon-pg17/usr/share/postgresql/17/extension/anon--2.0.0.sql
Finished installing anon
mkdir -p target/release/anon-pg17///usr/share/postgresql/17/extension/anon/
install data/*.csv target/release/anon-pg17///usr/share/postgresql/17/extension/anon/
install data/en_US/fake/*.csv target/release/anon-pg17///usr/share/postgresql/17/extension/anon/
release contains two directories:
ls -l target/release/
total 30064
drwxrwxr-x 3 vagrant vagrant 4096 Jan 27 18:02 anon-17
drwxrwxr-x 3 vagrant vagrant 4096 Jan 27 18:01 anon-pg17
That contain:
target/release/anon-17/usr/share/postgresql/17/extension/anon/first_name.csv
… …
target/release/anon-17/usr/share/postgresql/17/extension/anon/identifiers_category.csv
and:
target/release/anon-pg17/usr/share/postgresql/17/extension/anon.control
target/release/anon-pg17/usr/share/postgresql/17/extension/anon--2.0.0.sql
target/release/anon-pg17/usr/lib/postgresql/17/lib/anon.so
make install takes the wrong directory and fails:
$ sudo make install PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config PGVER="17"
cp -r target/release/anon-17///usr/share/postgresql/17/extension/* /usr/share/postgresql/17/extension/
install target/release/anon-17///usr/lib/postgresql/17/lib/anon.so /usr/lib/x86_64-linux-gnu
install: cannot stat 'target/release/anon-17///usr/lib/postgresql/17/lib/anon.so': No such file or directory
make: *** [Makefile:141: install] Error 1
That may help:
grep 'default = \[".*\"]' Cargo.toml | sed -e 's/.*\["//' | sed -e 's/"].*//'
pg13
cargo pgrx info pg-config pg17||echo pg_config
/home/vagrant/.pgrx/17.2/pgrx-install/bin/pg_config
Modifying PGVER does not work, anon.so goes to /usr/lib/x86_64-linux-gnu ?!
make extension PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config PGVER="pg17"
sudo make install PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config PGVER="pg17"
cp -r target/release/anon-pg17///usr/share/postgresql/17/extension/* /usr/share/postgresql/17/extension/
install target/release/anon-pg17///usr/lib/postgresql/17/lib/anon.so /usr/lib/x86_64-linux-gnu
Edited by Christophe Courtois