cqfn / pdd

Command line toolkit for collecting TODO markers from your code, known as Puzzle Driven Development (PDD)
https://www.0pdd.com
MIT License
76 stars 25 forks source link

'gem install pdd' failed on MacOs Silicone Chip #227

Closed pnatashap closed 7 months ago

pnatashap commented 8 months ago
  1. First of all some libraries requires higher permissions (run with sudo): ~ % gem install pdd Fetching pdd-0.23.2.gem Fetching slop-4.10.1.gem Fetching ruby-filemagic-0.7.3.gem Fetching rainbow-3.1.1.gem ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
  2. But fails even if them: `sudo gem install pdd
    Password: Fetching pdd-0.23.2.gem Fetching ruby-filemagic-0.7.3.gem Fetching rainbow-3.1.1.gem Fetching slop-4.10.1.gem Successfully installed slop-4.10.1 Building native extensions. This could take a while... ERROR: Error installing pdd: ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ruby-filemagic-0.7.3/ext/filemagic /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20240107-49962-hl5jhx.rb extconf.rb checking for -lgnurx... no checking for magic_open() in -lmagic... no ERROR: missing required library to compile this module 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.`

php-coder commented 8 months ago

1) this is how the things works on *nix systems -- in order to install files you have to have write permissions to the destination directory. One way to solve it, is to use sudo (su, etc). Another way, is to change the destination directory to the one where you have permissions (for instance, home directory). There is --user-install option exactly for that purpose.

2) while it looks like related to pdd, in fact it isn't. It caused by a missing dependency for one of the pdd's dependencies. ruby-filemagic seems like a native extension that requires libmagic library and its headers the compilation. You have to install it with command brew install libmagic (or apt install libmagic-dev on Ubuntu).

As I can see, the only thing that can be improved is the installation documentation.

yegor256 commented 7 months ago

@pnatashap if the solution explained by @php-coder works for you, maybe you can update the README file accordingly, in order to help other users?

pnatashap commented 7 months ago

Yes, I fix this also using this way, will add a note to README about this. Problem on Windows is also in this library, will check if it possible to fix without WSL

pnatashap commented 7 months ago

Looks like there is no easy way to use libmagic on windows, so it's better to update docs for now and create a docker file to simplify usage

php-coder commented 7 months ago

and create a docker file to simplify usage

In case it's useful for someone, here is mine:

FROM ruby:2.7-slim
RUN apt-get update && apt -y install gcc libmagic-dev make
RUN gem install pdd
php-coder commented 7 months ago

This was fixed by #230 and seems like we can close it.

pnatashap commented 7 months ago

Fixed