Skip to content

Always add conda dirs to default paths - #48

Open
amoeba wants to merge 1 commit into
ruby-gnome:mainfrom
amoeba:fix-add-conda-base-dir
Open

Always add conda dirs to default paths#48
amoeba wants to merge 1 commit into
ruby-gnome:mainfrom
amoeba:fix-add-conda-base-dir

Conversation

@amoeba

@amoeba amoeba commented Jul 24, 2026

Copy link
Copy Markdown

Related to ruby-gnome/rubygems-requirements-system#27.

When trying to install the red-arrow gem with rubygems-system-requirements, I get a pre-install hook error. That's fixed by ruby-gnome/rubygems-requirements-system#27. But then I also get an extconf error,

checking for arrow version (>= 24.0.0)... no (nonexistent)
*** 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.

What happened before was that rubygems-system-requiements detected by system had conda on it, installed arrow-glib to my base conda prefix. Then the red-arrow gem's extconfig.rb depends on this gem which doesn't support that case.

This PR unconditionally adds the pkgconfig dirs from conda to the list of default paths, adding both the base dir and the dir from any currently activated envs. This PR along with ruby-gnome/rubygems-requirements-system#27 gets red-arrow installing correctly on my system.

@amoeba

amoeba commented Jul 24, 2026

Copy link
Copy Markdown
Author

cc @kou

@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

It seems that this is different changes from ruby-gnome/rubygems-requirements-system#27 ?
Is there any for it?

Comment thread lib/pkg-config.rb
Comment on lines +366 to +377
conda_prefixes = []
conda_prefixes << ENV["CONDA_PREFIX"] if ENV["CONDA_PREFIX"]
if ENV["CONDA_EXE"]
conda_base = File.dirname(File.dirname(ENV["CONDA_EXE"]))
conda_prefixes << conda_base
end
conda_prefixes.uniq.each do |prefix|
lib_pkgconfig = File.join(prefix, "lib", "pkgconfig")
share_pkgconfig = File.join(prefix, "share", "pkgconfig")
paths << lib_pkgconfig if File.directory?(lib_pkgconfig)
paths << share_pkgconfig if File.directory?(share_pkgconfig)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do it here

conda_prefix = ENV["CONDA_PREFIX"]
if conda_prefix
default_paths << File.join(conda_prefix, "lib", "pkgconfig")
default_paths << File.join(conda_prefix, "share", "pkgconfig")
end
?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yep. Let me test that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. I think my approach here is wrong. I previously thought default_paths was nil but it's not,

(ruby:remote) native_pkg_config
#<Pathname:/opt/homebrew/bin/pkgconf>
(ruby:remote) default_paths
["/opt/homebrew/lib/pkgconfig",
 "/opt/homebrew/share/pkgconfig",
 "/usr/local/lib/pkgconfig",
 "/usr/lib/pkgconfig",
 "/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/26"]

I thought this PR was fixing my issue but, now that I test again, it's not.

Maybe this PR can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants