Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve checks for pkg-config and fall back to gpgme-config #168

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

stanhu
Copy link
Collaborator

@stanhu stanhu commented Dec 5, 2022

#166 changed from pkg-config to gpgme-config, but if PKG_CONFIG_PATH is not set properly, the C extension library will quietly build without the right linker dependencies.

To fix this, we now check for the existence of gpgme.pc in PKG_CONFIG_PATH and attempt to fall back to gpgme-config if it does not exist.

Closes #167

ueno#166 changed from `pkg-config`
to `gpgme-config`, but if `PKG_CONFIG_PATH` is not set properly, the C
extension library will quietly build without the right linker
dependencies.

To fix this, we now check for the existence of `gpgme.pc` in
`PKG_CONFIG_PATH` and attempt to fall back to `gpgme-config` if it
does not exist.

Closes ueno#167
Copy link
Owner

@ueno ueno left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable change, thanks!

@ueno ueno merged commit 644296a into ueno:master Dec 5, 2022
@stanhu
Copy link
Collaborator Author

stanhu commented Dec 5, 2022

Thanks @ueno! Would you mind tagging 2.0.23 with this?

@ueno
Copy link
Owner

ueno commented Dec 6, 2022

I'm not sure if this single change qualifies a new release: we had no checks on the existence of gpgme-config for a decade and the issue can be easily worked around.

@stanhu
Copy link
Collaborator Author

stanhu commented Dec 6, 2022

@ueno The issue is that there is a regression in v2.0.22 due to #166. You can install a broken version of gpgme without knowing it by compiling all the gpgme dependencies from source, installing them in custom prefix, and then then running:

root@160b17998071:/# RUBY_GPGME_USE_SYSTEM_LIBRARIES=1 gem install gpgme
Building native extensions. This could take a while...
Successfully installed gpgme-2.0.22
Parsing documentation for gpgme-2.0.22
Done installing documentation for gpgme after 0 seconds
1 gem installed

The gem is broken:

root@160b17998071:/# irb
irb(main):001:0> require 'gpgme'
Traceback (most recent call last):
       10: from /usr/bin/irb:23:in `<main>'
        9: from /usr/bin/irb:23:in `load'
        8: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.1/exe/irb:11:in `<top (required)>'
        7: from (irb):1
        6: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
        5: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `rescue in require'
        4: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `require'
        3: from /var/lib/gems/2.7.0/gems/gpgme-2.0.22/lib/gpgme.rb:3:in `<top (required)>'
        2: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        1: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
LoadError (/var/lib/gems/2.7.0/gems/gpgme-2.0.22/lib/gpgme_n.so: undefined symbol: gpgme_data_release - /var/lib/gems/2.7.0/gems/gpgme-2.0.22/lib/gpgme_n.so)

stanhu added a commit to stanhu/ruby-gpgme that referenced this pull request Sep 14, 2023
Cleaning is on by default; it's just that prior to ueno#168 the cleaning
was quietly failing:

```
Cleaning files only used during build.
/Users/stanhu/.asdf/installs/ruby/3.1.4/lib/ruby/3.1.0/fileutils.rb:637:in `rm_rf': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from ./extconf.rb:28:in `block in <main>'
	from <internal:dir>:220:in `glob'
	from ./extconf.rb:27:in `glob'
	from ./extconf.rb:27:in `<main>'
make: [clean-ports] Error 1 (ignored)
```
ueno pushed a commit that referenced this pull request Sep 14, 2023
Cleaning is on by default; it's just that prior to #168 the cleaning
was quietly failing:

```
Cleaning files only used during build.
/Users/stanhu/.asdf/installs/ruby/3.1.4/lib/ruby/3.1.0/fileutils.rb:637:in `rm_rf': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from ./extconf.rb:28:in `block in <main>'
	from <internal:dir>:220:in `glob'
	from ./extconf.rb:27:in `glob'
	from ./extconf.rb:27:in `<main>'
make: [clean-ports] Error 1 (ignored)
```
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.

v2.0.22 ignores pkg-config failures and creates a shared library that cannot load symbols
2 participants