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

Locate SO_TARGET_DIR with gem rather than system #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewhamon
Copy link

@andrewhamon andrewhamon commented Feb 2, 2023

Previously, SO_TARGET_DIR was hardcoded to install the built 7z.so into RbConfig::CONFIG["sitearchdir"], which is typically located wherever ruby is installed.

This is seems like an unusual thing for a gem to do, and breaks if ruby is installed in a read only location. It also breaks caching assumptions for some PaaS rails hosts, like Heroku.

This PR tweaks SO_TARGET_DIR so that 7z.so is instead installed in the gem directory with the rest of the seven_zib_ruby, i.e. $GEM_HOME/gems/seven_zip_ruby-1.3.0/lib which I think falls back to ~/.gem/ruby/2.7.0/gems/seven_zip_ruby-1.3.0/lib

This change allows seven_zip_ruby to build on my system, and I can also require "seven_zip_ruby" successfully. I also believe that this will not impact other users.

Fixes #41 and fixes #42

@andrewhamon andrewhamon force-pushed the ah/install-so-in-gem-lib branch from af0e3bf to 180f9bd Compare February 2, 2023 16:37
@tramuntanal
Copy link

I've deployed an app with your branch's seven_zip_ruby twice in Heroku. The first time purging the bundler cache and the second one without purging and it works.

To complete this PR it would be good to update the gem version and update the Release notes: https://github.com/masamitsu-murase/seven_zip_ruby#releases @andrewhamon

@andrewhamon
Copy link
Author

I wouldn't want to presume that @masamitsu-murase wants to cut a new release with just this commit

@tramuntanal
Copy link

It would be great to have a patch version so that apps in Heroku can be easily fixed.
I can do a PR to update the gem version and the doc once this PR is reviewed and merged.

As a temporal alternative merging this PR to master (I think it's stable), this will also ease the use of this gem.

@PikachuEXE
Copy link

I am not sure if this issue is related but I can't require seven_zip_ruby in ubuntu with ruby 3.3.0 (was ok with 3.2.2)
Error saying missing 7z.so or 7z.dll
Can provide a simplified Dockerfile example if needed (I replaced the gem with rubyzip when upgrading ruby to 3.3)

@Ph0tonic
Copy link

Hi, I thank you very for this gem and the fix, I am currently facing the same issue while installing a project using this gem.
@masamitsu-murase do you have any plan to merge this ? It would be great to be able to move forward.
Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants