timescale / timescaledb-toolkit

Extension for more hyperfunctions, fully compatible with TimescaleDB and PostgreSQL 📈
https://www.timescale.com
Other
383 stars 47 forks source link

Error at cargo run --manifest-path ../tools/post-install/Cargo.toml -- pg_config #789

Open MtnBiker opened 10 months ago

MtnBiker commented 10 months ago

Relevant system information:

Describe the bug Followed source install .

To Reproduce Did the following: git clone https://github.com/timescale/timescaledb-toolkit.git cd timescaledb-toolkit OK and folder is there. Added export PGRX_HOME="${HOME}/.cargo/“ to .zshrc after next step failed cargo pgrx install --release # reran successfully

Then the following

timescaledb-toolkit/extension on  main is 📦 vtimescaledb_toolkit@1.18.0-dev via 𝗥 v1.74.0
➜ cargo run --manifest-path ../tools/post-install/Cargo.toml -- pg_config
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `/Users/gscar/Documents/Delicias/Utilities, Energy and Solar/Solar Panels 2023-ABC/Solar production, etc/enphase2/timescaledb-toolkit/target/debug/post-install pg_config`
Generating Version 1.18.0-dev
Upgradable From ["1.6.0", "1.7.0", "1.8.0", "1.10.0-dev", "1.10.1", "1.11.0", "1.12.0", "1.12.1", "1.13.0", "1.13.1", "1.14.0", "1.15.0", "1.16.0", "1.17.0"]
thread 'main' panicked at tools/post-install/src/main.rs:330:9:
cannot rename `/Applications/Postgres.app/Contents/Versions/16/lib/postgresql/timescaledb_toolkit.so` to `/Applications/Postgres.app/Contents/Versions/16/lib/postgresql/timescaledb_toolkit-1.18.0-dev.so` due to `No such file or directory (os error 2)`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The other files in /Applications/Postgres.app/Contents/Versions/16/lib/postgresql/ are .dylib and no .so files.

This is the first pg extention I've installed with Rust. I am a little surprised that the install is into the Postgres.app rather than /Users/gscar/Library/Application Support/Postgres/var-16/

Thanks for any suggestions on how to proceed.

adam-micromelon commented 4 months ago

Did you find a solution to this?

spohlenz commented 4 months ago

@adam-micromelon I encountered this a couple of days ago. I was able to get it working by replacing any instances of .so with .dylib in tools/post-install/src/main.rs and re-running the release command.

diff --git a/tools/post-install/src/main.rs b/tools/post-install/src/main.rs
index 6669ff3..2909c0e 100644
--- a/tools/post-install/src/main.rs
+++ b/tools/post-install/src/main.rs
@@ -47,7 +47,7 @@ fn try_main() -> xshell::Result<()> {
     // is left anywhere in the install script, it will fail to install.
     remove_module_path_from_control_file(&extension_info);

-    // rename timescaledb_toolkit.so to timescaledb_toolkit-<current version>.so
+    // rename timescaledb_toolkit.dylib to timescaledb_toolkit-<current version>.dylib
     add_version_to_binary(&extension_info);

     // replace `MODULE_PATH` with `$libdir/timescaledb_toolkit-<current version>`
@@ -189,8 +189,8 @@ fn add_version_to_binary(
         ..
     }: &ExtensionInfo,
 ) {
-    let bin_file = path!(bin_dir / "timescaledb_toolkit.so");
-    let versioned_file = path!(bin_dir / format!("timescaledb_toolkit-{}.so", current_version));
+    let bin_file = path!(bin_dir / "timescaledb_toolkit.dylib");
+    let versioned_file = path!(bin_dir / format!("timescaledb_toolkit-{}.dylib", current_version));
     rename_file(bin_file, versioned_file);
 }
adam-micromelon commented 4 months ago

@spohlenz Thank you! That fixed it for me