ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 81 forks source link

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #146

Open Indolia opened 4 years ago

Indolia commented 4 years ago
Using rake 13.0.1
Using CFPropertyList 3.0.2
Using concurrent-ruby 1.1.6
Using i18n 0.9.5
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using activesupport 4.2.11.1
Using public_suffix 2.0.5
Using addressable 2.7.0
Using httpclient 2.8.3
Using json 2.3.0
Using algoliasearch 1.27.1
Using atomos 0.1.3
Using aws-eventstream 1.0.3
Using aws-partitions 1.289.0
Using aws-sigv4 1.1.1
Using jmespath 1.4.0
Using aws-sdk-core 3.92.0
Using aws-sdk-kms 1.30.0
Using aws-sdk-s3 1.61.1
Using babosa 1.0.3
Using curb 0.9.10
Using fastimage 2.1.7
Using bundler 2.1.4
Using colored 1.2
Using highline 1.7.10
Using commander-fastlane 4.4.6
Using dotenv 2.7.5
Using emoji_regex 1.0.1
Using excon 0.73.0
Using multipart-post 2.0.0
Using faraday 0.17.3
Using unf_ext 0.0.7.6
Using unf 0.1.4
Using domain_name 0.5.20190701
Using http-cookie 1.0.3
Using faraday-cookie_jar 0.0.6
Using faraday_middleware 0.13.1
Using gh_inspector 1.1.3
Using jwt 2.1.0
Using memoist 0.16.2
Using multi_json 1.14.1
Using os 1.0.1
Using signet 0.13.2
Using googleauth 0.11.0
Using mini_mime 1.0.2
Using declarative 0.0.10
Using declarative-option 0.1.0
Using uber 0.1.0
Using representable 3.0.4
Using retriable 3.1.2
Using google-api-client 0.36.4
Using digest-crc 0.5.1
Using google-cloud-env 1.3.1
Using google-cloud-errors 1.0.0
Using google-cloud-core 1.5.0
Using google-cloud-storage 1.25.1
Using mini_magick 4.10.1
Using multi_xml 0.6.0
Using plist 3.5.0
Using rubyzip 1.3.0
Using security 0.1.3
Using naturally 2.2.0
Using simctl 1.6.8
Using slack-notifier 2.3.2
Using terminal-notifier 2.0.0
Using unicode-display_width 1.7.0
Using terminal-table 1.8.0
Using tty-screen 0.7.1
Using tty-cursor 0.7.1
Using tty-spinner 0.9.3
Using word_wrap 1.0.0
Using claide 1.0.3
Using colored2 3.1.2
Using nanaimo 0.2.6
Using xcodeproj 1.15.0
Using rouge 2.0.7
Using xcpretty 0.3.0
Using xcpretty-travis-formatter 1.0.0
Using fastlane 2.144.0
Using badge 0.12.0
Using cork 0.3.0
Using nap 1.1.0
Using open4 1.3.4
Using claide-plugins 0.9.2
Using fuzzy_match 2.0.4
Using netrc 0.11.0
Using ffi 1.12.2
Using ethon 0.12.0
Using typhoeus 1.3.1
Using cocoapods-core 1.9.1
Using cocoapods-deintegrate 1.0.4
Using cocoapods-downloader 1.3.0
Using cocoapods-plugins 1.0.0
Using cocoapods-search 1.0.0
Using cocoapods-stats 1.1.0
Using cocoapods-trunk 1.4.1
Using cocoapods-try 1.1.0
Using escape 0.0.4
Using fourflusher 2.3.1
Using molinillo 0.6.6
Using ruby-macho 1.4.0
Using cocoapods 1.9.1
Using faraday-http-cache 2.0.0
Using rchardet 1.8.0
Using git 1.6.0
Using kramdown 2.1.0
Using kramdown-parser-gfm 1.1.0
Using no_proxy_fix 0.1.2
Using sawyer 0.8.2
Using octokit 4.18.0
Using danger 6.3.2
Using mime-types-data 3.2019.1009
Using mime-types 3.3.1
Using httparty 0.18.0
Using gitlab 4.14.1
Using danger-gitlab 7.0.0
Using thor 0.20.3
Fetching danger-swiftlint 0.24.2
Installing danger-swiftlint 0.24.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint
/Users/rishi/.rbenv/versions/2.5.0/bin/ruby -rrubygems
/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.1/exe/rake
RUBYARCHDIR=/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-19/2.5.0/danger-swiftlint-0.24.2
RUBYLIBDIR=/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-19/2.5.0/danger-swiftlint-0.24.2
mkdir -p
'/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin'
&& curl -s -L
https://github.com/realm/SwiftLint/releases/download/0.39.1/portable_swiftlint.zip
-o portable_swiftlint.zip && unzip -q portable_swiftlint.zip -d
'/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin'
&& rm portable_swiftlint.zip
Downloading swiftlint@0.39.1
rake aborted!
Command failed with status (56): [mkdir -p '/Users/rishi/.rbenv/versions/2.5...]

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

rake failed, exit code 1

Gem files will remain installed in
/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2
for inspection.
Results logged to
/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-19/2.5.0/danger-swiftlint-0.24.2/gem_make.out

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

In Gemfile:
  danger-swiftlint

Getting this issue when hile installing danger-swiftlint

ashfurrow commented 4 years ago

Hmm, seems to be failing on this line:

mkdir -p
'/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin'

Can you try running that command manually and seeing what it says?

Indolia commented 4 years ago

HI @ashfurrow , I have run "gem install danger-swiftlint -v '0.24.2' --source 'https://rubygems.org/' " Manually but got the same error.

I have also run these command "mkdir -p '/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin' && curl -s -L https://github.com/realm/SwiftLint/releases/download/0.39.1/portable_swiftlint.zip -o portable_swiftlint.zip && unzip -q portable_swiftlint.zip -d '/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin' && rm portable_swiftlint.zip"

If you need any information about the system please let me know

ashfurrow commented 4 years ago

Hmm, not sure. That command is actually a series of commands:

Could you run each one and tell me which one is failing and what the error message is?

Indolia commented 4 years ago

Hi @ashfurrow , I have run each command one by one

  1. mkdir -p '/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin' (Success)

  2. curl -s -L https://github.com/realm/SwiftLint/releases/download/0.39.1/portable_swiftlint.zip -o portable_swiftlint.zip (failed) because when I run this command

_unzip -q portable_swiftlint.zip -d '/Users/rishi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin'_

it show me this error [portable_swiftlint.zip] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of portable_swiftlint.zip or portable_swiftlint.zip.zip, and cannot find portable_swiftlint.zip.ZIP, period.

and I go manually at the path I did not find any portable_swiftlint.zip file there I think I am not able to download the portable_swiftlint.zip file

please share if you have suggestion on it

ashfurrow commented 4 years ago

That's so weird, I'm not really sure what to tell you. Can you try following the SwiftLint instructions for installing and let me know if they succeed? I really don't know what we could do...

oct0f1sh commented 4 years ago

I just started seeing this same issue, seemingly out of nowhere. One moment bundle install was working on our CI, and then 5 minutes later I was getting hit by this same error message about portable_swift.zip. I tried rerunning a couple times, but it constantly failed.

I even tried running bundle install, bundle update, and gem install danger-swiftlint -v '0.24.2' --source 'https://rubygems.org/' on my local machine but kept seeing this error.

Fetching danger-swiftlint 0.24.2
Installing danger-swiftlint 0.24.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/danger-swiftlint-0.24.2/ext/swiftlint
/Users/duncanmacdonald/.rvm/rubies/ruby-2.6.3/bin/ruby -rrubygems /Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/exe/rake
RUBYARCHDIR\=/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/extensions/x86_64-darwin-19/2.6.0/danger-swiftlint-0.24.2
RUBYLIBDIR\=/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/extensions/x86_64-darwin-19/2.6.0/danger-swiftlint-0.24.2
mkdir -p '/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin' && curl -s -L
https://github.com/realm/SwiftLint/releases/download/0.39.1/portable_swiftlint.zip -o portable_swiftlint.zip && unzip -q portable_swiftlint.zip -d
'/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/danger-swiftlint-0.24.2/ext/swiftlint/bin' && rm portable_swiftlint.zip
Downloading swiftlint@0.39.1
[portable_swiftlint.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of portable_swiftlint.zip or
        portable_swiftlint.zip.zip, and cannot find portable_swiftlint.zip.ZIP, period.
rake aborted!
Command failed with status (9): [mkdir -p '/Users/duncanmacdonald/.rvm/gems...]
/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/danger-swiftlint-0.24.2/ext/swiftlint/Rakefile:17:in `block (2 levels) in <top (required)>'
/Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/rake-13.0.1/exe/rake:27:in `<main>'
Tasks: TOP => default => swiftlint:install
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/gems/danger-swiftlint-0.24.2 for inspection.
Results logged to /Users/duncanmacdonald/.rvm/gems/ruby-2.6.3/extensions/x86_64-darwin-19/2.6.0/danger-swiftlint-0.24.2/gem_make.out

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

Update As I was writing this issue, I kept trying bundle install every couple minutes to see if anything would change, and sure enough it was able to install successfully. It's working now both on our CI and on my local machine. Not sure if someone fixed the issue right after it happened or if it was some random issue with downloading that zip from github, but waiting a couple minutes was all I needed. 🤦 I'll leave this comment up in case anyone else runs into this issue.

Update to the update Around half an hour later it started failing again with the same issue 😭

mokagio commented 4 years ago

Gosh! That looks super weird 😞 .

Could it be possible that there was some error on the binary on the SwiftLint or GitHub side? The error seems to suggest some kind of corruption in the .zip file...

allen-zeng commented 4 years ago

This turned out to be a problem with bundler. Deleting folders like ~/.gem and ~/.bundle worked for me.

Although this problem comes back pretty quickly. I'm running into this in my CI environment, which can run multiple jobs in parallel. My suspicion right now are:

I have no proof though :/

mokagio commented 4 years ago

@allen-zeng thanks for the info.

Can you share the config for your CI? It might be that this race condition of sort can be avoided by rearranging some of the steps.

allen-zeng commented 4 years ago

@mokagio I'm using Jenkins pipeline to run scripts in CI. Each agent could be executing 2 jobs concurrently, so that might be where the source of the race condition, if it's a race condition.

Weirdly, this doesn't happen much any more, although it was happening consistently last week, which led me here 🤷

rrolland commented 4 years ago

Hello, I'm also seeing exactly the same issue. I tried to force to the 0.24.2 version in the gemfile, and it worked.