sparklemotion / sparklemotion/sqlite3-ruby

Miniportile2 recipe.host is nil on windows in extconf.rb

Open
#506 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
845
Forks
220
Avg merge
2d 17h
Merged PRs (30d)
3

Description

It throws on this line as a result

https://github.com/sparklemotion/sqlite3-ruby/blob/16470dedb21c3054807ed70847f5ab99d333ff19/ext/sqlite3/extconf.rb#L70

I do use a mswin built of ruby (ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mswin64_140]) in this specific case, but I can reproduce using 2.7.2 mingw.

Miniportile2 uses the output of running gcc -v to detect the host, and obviously this fails in this case.

https://github.com/flavorjones/mini_portile/blob/52fb0bc41c89a10f1ac7b5abcf0157e059194374/lib/mini_portile2/mini_portile.rb#L542-L557

I am able to work around it by using the same code as nokogiri: https://github.com/sparklemotion/nokogiri/blob/d7ee3b683246a9fdc19c51aabc98868dc8dcf134/ext/nokogiri/extconf.rb#L443-L446

    # We use 'host' to set compiler prefix for cross-compiling. Prefer host_alias over host. And
    # prefer i686 (what external dev tools use) to i386 (what ruby's configure.ac emits).
    recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
    recipe.host = recipe.host.gsub("i386", "i686")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ext/sqlite3/extconf.rb at the linked line and compare its recipe setup with the Nokogiri extconf.rb example. Check Miniportile2's host detection references to understand why Windows leaves recipe.host nil. Done means the Windows build no longer raises there and uses the appropriate Ruby host configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.