From 4dba824727751bd4ccf68badeea2f65c5bf3963d Mon Sep 17 00:00:00 2001 From: lovasoa Date: Mon, 27 Oct 2025 14:56:17 +0100 Subject: [PATCH 1/2] Enhance ODBC support for Debian-based systems by setting the library search path in build.rs. Update CI configuration to use the correct PostgreSQL driver name. Document changes in CHANGELOG.md. --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 1 + build.rs | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20485478..47625c5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: db_url: "mssql://root:Password123!@127.0.0.1/sqlpage" - database: odbc container: postgres - db_url: "Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!" + db_url: "Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!" setup_odbc: true steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf8bc1b..a4e00999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - SQLPage now sets the [`Server-Timing` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server-Timing) in development. So when you have a page that loads slowly, you can open your browser's network inspector, click on the slow request, then open the timing tab to understand where it's spending its time. - image - Fixed a memory corruption issue in the builtin odbc driver manager + - ODBC: fix using globally installed system drivers by their name in debian-based linux distributions. ## v0.38.0 diff --git a/build.rs b/build.rs index a39ea959..2b99740c 100644 --- a/build.rs +++ b/build.rs @@ -29,6 +29,7 @@ async fn main() { ] { h.await.unwrap(); } + set_odbc_rpath(); } fn make_client() -> awc::Client { @@ -171,3 +172,14 @@ fn make_url_path(url: &str) -> PathBuf { ); sqlpage_artefacts.join(filename) } + +/// On debian-based linux distributions, odbc drivers are installed in /usr/lib/-linux-gnu/odbc +/// which is not in the default library search path. +fn set_odbc_rpath() { + if cfg!(all(target_os = "linux", feature = "odbc-static")) { + println!( + "cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/{}-linux-gnu/odbc", + std::env::var("TARGET").unwrap().split('-').next().unwrap() + ); + } +} \ No newline at end of file From afde9e1f09d5159c9bc42289fecb73fd29d2ff16 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Mon, 27 Oct 2025 15:12:39 +0100 Subject: [PATCH 2/2] fmt --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 2b99740c..ed14c612 100644 --- a/build.rs +++ b/build.rs @@ -182,4 +182,4 @@ fn set_odbc_rpath() { std::env::var("TARGET").unwrap().split('-').next().unwrap() ); } -} \ No newline at end of file +}