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

Will not build (3.7, 3.8, 4.1) #112

Closed
Kendra opened this issue Mar 25, 2021 · 4 comments
Closed

Will not build (3.7, 3.8, 4.1) #112

Kendra opened this issue Mar 25, 2021 · 4 comments

Comments

@Kendra
Copy link

Kendra commented Mar 25, 2021

Bundle update with appropriate dependencies:
Have tried all versions. 3.6 worked and then before our deploy, it was yanked.

Error...

Installing mimemagic 0.3.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml",
"/usr/share/mime/packages/freedesktop.org.xml"]

Ensure you have either installed the shared-mime-types package for your distribution, or
obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
of that file.
/Users/bob/.rvm/gems/ruby-2.6.5@abaqis/gems/mimemagic-0.3.8/ext/mimemagic/Rakefile:14:in locate_mime_database' /Users/bob/.rvm/gems/ruby-2.6.5@abaqis/gems/mimemagic-0.3.8/ext/mimemagic/Rakefile:25:in block in <top (required)>'
/Users/bob/.rvm/gems/ruby-2.6.5@abaqis/gems/rake-13.0.3/exe/rake:27:in `

'
Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/bob/.rvm/gems/ruby-2.6.5@abaqis/gems/mimemagic-0.3.8 for inspection.
Results logged to /Users/bob/.rvm/gems/ruby-2.6.5@abaqis/extensions/x86_64-darwin-19/2.6.0/mimemagic-0.3.8/gem_make.out

An error occurred while installing mimemagic (0.3.8), and Bundler cannot continue.
Make sure that gem install mimemagic -v '0.3.8' --source 'https://rubygems.org/' succeeds before bundling.

@kieran
Copy link

kieran commented Mar 25, 2021

on MacOS you need to install shared-mime-info before you can build this extension

via homebrew:

brew install shared-mime-info

@justrudd
Copy link

I build for Ruby 2.7.1. But this should also work for other versions...

Alpine apk add shared-mime-info

For images I build based off Debian Buster, I didn't have to do anything.

@mrinterweb
Copy link

Considering that mimemagic is a dependency of rails, it is lumped in with ActiveStorage and ActionMailbox. My rails project uses neither so it never calls mimemagic. Needing to have the hurdle of downloading the mime types file and pointing and ENV var at it seems unnecessary for all applications. Would it make more sense to have the gem warn if it can not automatically download the file on install or if the file does not exist? Then raise a runtime error if the file does not exist when mimemagic is called?

@jellybob
Copy link
Member

When making these changes the decision was made to have a build time error, rather than a runtime error. This was because we considered the risk to running applications of problems at build time was much lower than the potential for unexpected runtime errors in production systems, potentially weeks after a deployment.

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

No branches or pull requests

5 participants