`Database#load_extensions` is not enabled on Windows when using native gems or compiling vendored source code (sqlite 3.48.0+)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- github-actions, ruby, sqlite
- 领域
- build-system, ci-cd, databases
调研方向
先从失败的 Windows GitHub Actions 日志和 gem 的 extconf.rb 入手,然后将其配置与 SQLite 的 autosetup 目录中的相关脚本进行比较。调查 Windows runner 在构建 vendored SQLite 源代码时如何解析 dlopen 及相关库。完成标准是:load-extension 能够在 Windows 上成功构建并通过测试,且不需要系统 SQLite 库。
由索引模型根据 Issue 内容生成。
描述
Summary
Loading extensions is not available on Windows when using the precompiled native gems or compiling the vendored sqlite library from source, starting with sqlite3-ruby v2.6.0.
We are asking for help from Windows users who want or need this feature.
Context
Sqlite 3.48.0 and later have dramatically changed the "autoconf amalgamation" that is vendored in
this gem. Specifically, the configuration is no longer actually autoconf, but some scripts that
emulate autoconf's interface and behavior.
Although this mostly "just worked", we're having a problem resolving the libraries necessary for
loading extensions. As a result, starting with sqlite3-ruby v2.6.0, extensions cannot be loaded on Windows when using precompiled native gems or when compiling the vendored sqlite library.
Workarounds
If you are a Windows user and need to load extensions, you have options.
- use a version of sqlite3-ruby
< 2.6.0 - compile from source, and link against a system sqlite library (not the vendored version). See https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md#avoiding-the-precompiled-native-gem for help doing this.
Request
If you are a windows user, and you want or need this feature, we need your help.
- If you can figure out how to make this build properly, please comment below, I'd like to work with you to update this gem's extconf.rb to link properly.
- If you know a lot about the Windows runner for Github Actions, or about how setup-ruby configures the runner, then please think and/or comment to let me know what I should be trying.
I have not started a thread in the upstream forum because I'm pretty sure this can be solved with the right set of configure options/compiler flags/linker flags, I just can't figure out what that combination is and I can't afford to spend more time on it right now.
Details
A good example of the failure in question is here: https://github.com/sparklemotion/sqlite3-ruby/actions/runs/13420426491/job/37491733507#step:5:368
Here's the full log: 44_test (windows, 3.4, disable).txt
Some of the relevant snippets from that log:
Configuring SQLite version 3.49.1
Warning: Failed to find x86_64-w64-mingw32-ld, falling back to ld which may be incorrect
Warning: Failed to find x86_64-w64-mingw32-ar, falling back to ar which may be incorrect
Looking for install ... c:/msys64/usr/bin/install
Checking for int8_t...ok
Checking for int16_t...ok
Checking for int32_t...ok
Checking for int64_t...ok
Checking for intptr_t...ok
Checking for uint8_t...ok
Checking for uint16_t...ok
Checking for uint32_t...ok
Checking for uint[64](https://github.com/sparklemotion/sqlite3-ruby/actions/runs/13420426491/job/37491733507#step:5:65)_t...ok
Checking for uintptr_t...ok
Checking for gmtime_r...not found
Checking for isnan...ok
Checking for localtime_r...not found
Checking for localtime_s...not found
Checking for malloc_usable_size...not found
Checking for strchrnul...not found
Checking for usleep...ok
Checking for utime...ok
Checking for pread...not found
Checking for pread64...not found
Checking for pwrite...not found
Checking for pwrite64...not found
Checking libs for fdatasync...no
Checking libs for nanosleep...none needed
Checking for sys/types.h...ok
Checking for sys/stat.h...ok
Checking for dlfcn.h...not found
Checking for unistd.h...ok
Checking for stdlib.h...(cached) ok
Checking for malloc.h...ok
Checking for memory.h...ok
Checking for string.h...ok
Checking for strings.h...ok
Checking for inttypes.h...ok
Checking for zlib.h...ok
Checking libs for deflate...-lz
Checking whether the C compiler accepts -rpath C:/hostedtoolcache/windows/Ruby/3.4.2/x64/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.test.2025.0219.1912/ports/x[86](https://github.com/sparklemotion/sqlite3-ruby/actions/runs/13420426491/job/37491733507#step:5:87)_64-w64-mingw32/sqlite3/3.49.1/lib...no
Checking whether the C compiler accepts -Wl,-rpath,C:/hostedtoolcache/windows/Ruby/3.4.2/x64/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.test.2025.0219.1[91](https://github.com/sparklemotion/sqlite3-ruby/actions/runs/13420426491/job/37491733507#step:5:92)2/ports/x86_64-w64-mingw32/sqlite3/3.49.1/lib...yes
SQLITE_DEBUG build? no
Support threadsafe operation? Checking for libs...
Checking libs for pthread_create...none needed
Checking libs for pthread_mutexattr_init...none needed
Checking for line-editing capability...
WARNING: Skipping check for readline.h because we're cross-compiling.
Line-editing support for the sqlite3 shell: none
Checking libs for dlopen...no
--enable-load-extension was provided but dlopen()
not found. Use --disable-load-extension to bypass this
check.
and
============
Failed: gcc -fPIC -O2 -fvisibility=hidden -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_USE_URI=1 conftest__.c -o conftest__
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\ccAsr52L.o:conftest__.c:(.text.startup+0xa): undefined reference to `dlopen'
collect2.exe: error: ld returned 1 exit status
child process exited abnormally
============
The failed code was:
extern void dlopen(void);
int main(void) {
dlopen();
return 0;
}
============
Failed: gcc -fPIC -O2 -fvisibility=hidden -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_USE_URI=1 conftest__.c -o conftest__ -ldl
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl: No such file or directory
collect2.exe: error: ld returned 1 exit status
child process exited abnormally
============
The failed code was:
extern void dlopen(void);
int main(void) {
dlopen();
return 0;
}
============
Relevant configure scripts are in https://github.com/sqlite/sqlite/tree/master/autosetup
cc @larskanis in case you have any ideas
- 主要语言
- Ruby
- 星标
- 845
- 派生
- 222
- 平均合并
- 4 天 6 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sparklemotion/sqlite3-ruby 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
sparklemotion/sqlite3-ruby#751 ·
-
needs-more-info
难度 3/5 1-2 天 新手友好度 42/100
sparklemotion/sqlite3-ruby#653 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
sparklemotion/sqlite3-ruby#639 · 4 条评论 ·
-
难度 4/5 3-5 天 新手友好度 42/100
sparklemotion/sqlite3-ruby#628 · 10 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
sparklemotion/sqlite3-ruby#573 · 2 条评论 ·
查看 sparklemotion/sqlite3-ruby 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
temporalio/sdk-ruby#625 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 94/100
zerocracy/judges-action#2803 ·
维护者通常 5 天内回复
-
empty tone.rb未关闭
难度 1/5 1 小时以内 新手友好度 78/100
-
难度 1/5 1-3 小时 新手友好度 92/100
-
enhancement good first issue
难度 2/5 半天 新手友好度 92/100
维护者通常 1 天内回复