Discourse can't find gems specified in the plugin

Hello! I’m developing a plugin to enable Sign-In with Ethereum on Discourse. The problem is that when installing the plugin I get an error with one of the dependencies (rbsecp256k1).

ERROR:  Error installing rbsecp256k1:
	ERROR: Failed to build gem native extension.

    current directory: /var/www/discourse/plugins/sdp/gems/2.7.5/gems/rbsecp256k1-5.1.0/ext/rbsecp256k1
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.7.0 -r ./siteconf20220303-1234-gyqjb.rb extconf.rb
extconf.rb:3:in `require': cannot load such file -- mini_portile2 (LoadError)
	from extconf.rb:3:in `<main>'

extconf failed, exit code 1

I wonder what might be happening since it works on development if I manually install the dependencies.

That gem has OS-level dependencies that you need to have installed, according to their documentation: GitHub - etscrivner/rbsecp256k1: Compiled Ruby wrapper around libsecp256k1 for secp256k1 ECDSA.

Yeah, I have those installed already the problem happens when it can’t find mini_portile2, which is one of it’s dependency

1 Like

How did you declare the mini_portile2 dependency on your plugin?

1 Like

I’ve experienced the same issue installing the same gem dependency.

Take a look

I would love it if there was a more straightfwd solution.

2 Likes

Can’t you just drop that since it’s already in Discourse core?

1 Like

I mean, I can but the problem is not with that gem the problem is with rbsecp256k1, when it tries to build it doesn’t find the mini_portile2 gem (As the error says: cannot load such file -- mini_portile2 (LoadError) from extconf.rb:3:in <main>'

You are going over the same ground as @fzngagan , see his link above: Having a hard time installing `eth` gem in a plugin in production - #3 by fzngagan, perhaps you can contribute to his solution.

His solution works, but I don’t consider that a valid option, no user would be willing to do all of that just to add a plugin. I just wanted to know if someone could think of a better approach (the closest to just add the repo and you’re good to go). as @fzngagan himself said:

I would love it if there was a more straightfwd solution.

And now we have two Topics on the exact same problem …

1 Like

I’ve been narrowing it down, it doesn’t seem related to the gems, it seems to be related to extconf.rb. I tried with other few gems with a more complex setup (ruby-magic and libusb), both doesn’t work (for different reason) all they have in common are dependencies at extconf.rb.

1 Like

This issue has been fixed on the latest tests-passed and stable branches of discourse.

2 Likes

Not yet, the PR is not merged yet.

1 Like

@RGJ There were some test failures that needed to be address first. Its merged now.

2 Likes