From 21424ed4e05763a0bebc3b26e7201142d6634c0b Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 4 Jul 2025 13:18:18 -0400 Subject: [PATCH] On linux and darwin, ensure we can resolve dlopen et al Fixes https://github.com/sparklemotion/sqlite3-ruby/issues/634 --- .github/workflows/ci.yml | 2 +- ext/sqlite3/extconf.rb | 4 ++++ patches/001-dl-and-pthread-flags.patch | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 patches/001-dl-and-pthread-flags.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73c23f5d..1c86c3b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: steps: - run: | dnf group install -y "C Development Tools and Libraries" - dnf install -y ruby ruby-devel + dnf install -y ruby ruby-devel patch - uses: actions/checkout@v4 - run: bundle install - run: bundle exec rake compile -- --disable-system-libraries diff --git a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb index 7111c1d0..d6acea6f 100644 --- a/ext/sqlite3/extconf.rb +++ b/ext/sqlite3/extconf.rb @@ -194,6 +194,10 @@ def darwin? RbConfig::CONFIG["target_os"].include?("darwin") end + def windows? + RbConfig::CONFIG["target_os"].match?(/mingw|mswin/) + end + def print_help print(<<~TEXT) USAGE: ruby #{$PROGRAM_NAME} [options] diff --git a/patches/001-dl-and-pthread-flags.patch b/patches/001-dl-and-pthread-flags.patch new file mode 100644 index 00000000..55ba23d9 --- /dev/null +++ b/patches/001-dl-and-pthread-flags.patch @@ -0,0 +1,17 @@ +commit d9eae6b7 (HEAD -> master, origin/master, origin/HEAD) +Author: stephan +Date: 2025-07-04 17:20:37 +0000 + + Propagate the -ldl and -lpthread flags, if needed, into sqlite3.pc, per request in [forum:44a58c807353162f | forum post 44a58c807353162f]. + + FossilOrigin-Name: 64f5f14322349b47451b8cac03bf8cd6f1ae45a8822e7f1ddee3d0b265047501 + +--- a/sqlite3.pc.in ++++ b/sqlite3.pc.in +@@ -9,5 +9,5 @@ Name: SQLite + Description: SQL database engine + Version: @PACKAGE_VERSION@ + Libs: -L${libdir} -lsqlite3 +-Libs.private: @LDFLAGS_MATH@ @LDFLAGS_ZLIB@ @LDFLAGS_ICU@ ++Libs.private: @LDFLAGS_MATH@ @LDFLAGS_ZLIB@ @LDFLAGS_DLOPEN@ @LDFLAGS_PTHREAD@ @LDFLAGS_ICU@ + Cflags: -I${includedir}