Repository navigation
Support pkg-config #39
Copy link
Copy link
Closed
Description
While installing the ruby-lua gem, I found out that the plugin doesn't support pkg-config. Other plugins such as asdf-ruby support pkg-config. Homebrew's Lua package supports it as well. Is it possible to include the support in this plugin?
In case you're interested in the error message due to the absence of pkg-config, I have included it here. Thank you for creating this plugin.
Error due to the absence of pkg-config
Installing ruby-lua 0.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/human/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/gems/ruby-lua-0.6.0/ext
/Users/human/.asdf/installs/ruby/2.6.8/bin/ruby -I /Users/human/.asdf/installs/ruby/2.6.8/lib/ruby/2.6.0 -r ./siteconf20240706-11547-1pxuoc6.rb extconf.rb
checking for lua-config... no
checking for pkg-config... yes
Package lua was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua' found
Package lua was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua' found
Package lua5.1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.1' found
Package lua5.1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.1' found
Package lua5.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.2' found
Package lua5.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.2' found
Package lua5.3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.3' found
Package lua5.3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.3' found
checking for lua.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-lua50-dir
--without-lua50-dir
--with-lua50-include
--without-lua50-include=${lua50-dir}/include
--with-lua50-lib
--without-lua50-lib=${lua50-dir}/lib
--with-lua-dir
--without-lua-dir
--with-lua-include
--without-lua-include=${lua-dir}/include
--with-lua-lib
--without-lua-lib=${lua-dir}/lib
--with-lua51-dir
--without-lua51-dir
--with-lua51-include
--without-lua51-include=${lua51-dir}/include
--with-lua51-lib
--without-lua51-lib=${lua51-dir}/lib
--with-lua52-dir
--without-lua52-dir
--with-lua52-include
--without-lua52-include=${lua52-dir}/include
--with-lua52-lib
--without-lua52-lib=${lua52-dir}/lib
--with-lua53-dir
--without-lua53-dir
--with-lua53-include
--without-lua53-include=${lua53-dir}/include
--with-lua53-lib
--without-lua53-lib=${lua53-dir}/lib
extconf failure: need liblua50 (headers not found)
Install the library or try one of the following options to extconf.rb:
--with-lua-lib=/path/to/liblua/lib
--with-lua-include=/path/to/liblua/include
or
--with-lua50-lib=/path/to/liblua/lib
--with-lua50-include=/path/to/liblua/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/human/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/extensions/arm64-darwin-23/2.6.0/ruby-lua-0.6.0/mkmf.log
extconf failed, exit code 1Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Stratus3D commentedon Jul 8, 2024
Hi @tyrro ! I'm not familiar with
pkg-config, can you provide a rough example of how I'd add support to asdf-lua, and how it'd be used once support is added? Happy to add it if I can.Also, PR is welcome if you want to try implementing support for it!
Stratus3D commentedon May 1, 2026
Closing due to lack of a response. @tyrro happy to reopen if you can provide more details on this, as well as impact this is having in your work.
tyrro commentedon May 5, 2026
Hi @Stratus3D — following up on this since the issue was closed. I originally opened it while debugging a native gem build failure with ruby-lua. After digging deeper, I found that adding
pkg-configsupport wouldn't actually fix the underlying problem, so I took a different approach.Why
pkg-configdidn't work here:ruby-lua'sextconf.rbtries several detection strategies in order. The one that fires with an asdf-installed Lua is thedir_config("lua")branch, which hardcodes-llualib -lluain the linker flags. Since Lua 5.1,liblualibwas merged intoliblua, so asdf installs only shipliblua.a— there is noliblualib.a— causingld: library 'lualib' not found.Even if
pkg-configwere supported:exec-envhook (wherePKG_CONFIG_PATHwould be exported) only fires when a Lua shim is directly invoked (e.g.lua,luac). Whenbundle installruns Ruby to compile a native gem, the Luaexec-envis never sourced, so the env var is invisible to the compiler/linker.lua-configbinary (another fallback in extconf.rb) fails when invoked from a gem build directory that has no.tool-versions, printing "No version is set for command lua-config".The actual fix:
Creating a
liblualib.a → liblua.asymlink in the install script is the minimal, targeted fix. It matches what Homebrew does and requires no changes to shell environment or gem build flags. I've opened a PR with this single change:➡️ #50
Happy to discuss further or adjust the approach if needed. Thanks!
Stratus3D commentedon May 9, 2026
Hi @tyrro ,
Are you using AI to generate your comments? I'm not getting paid to maintain this library, I'm happy to help you directly, but I'm unwilling to give your AI agent free assistance.
In any case, it sounds like this is an issue with should be fixed in ruby-lua. It is not a bug in Lua or this asdf-lua plugin.
tyrro commentedon Jun 9, 2026
Hi @Stratus3D ,
Yes, I used AI to help draft the above comment. I'm not an expert on this entire codebase, so I used it to help translate my thoughts into technical terms. I completely understand if you don't want to engage with it.
Regarding the PR itself: the workaround I suggested is actually how I've been successfully running
asdf-luaon my local machine. Since theruby-luagem is no longer maintained, this seemed like the most viable path forward for my setup.I understand if this falls outside the scope of this plugin, but I wanted to share what worked for me. Thank you for creating and maintaining
asdf-lua!