Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Shopify CLI not installing due to gem native extension. #1857

Closed
lakshyaIncaendo opened this issue Dec 16, 2021 · 14 comments
Closed

Shopify CLI not installing due to gem native extension. #1857

lakshyaIncaendo opened this issue Dec 16, 2021 · 14 comments

Comments

@lakshyaIncaendo
Copy link

Issue summary

Write a short description of the issue here ↓
So i have been trying to install the shopify-cli using the apt (dabian), but i get this error
ERROR: Error installing shopify-cli:
ERROR: Failed to build gem native extension.

Expected behavior

What do you think should happen?
Shopify-cli should install.

Actual behavior

What actually happens?
image

Tip: include an error message (in a <details></details> tag) if your issue is related to an error

Steps to reproduce the problem

Specifications

  • App type: Native
  • Operating System: Ububntu 16.04
  • Shell: bash
  • Ruby version (ruby -v): ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux-gnu]
@mateus-dias-cwb
Copy link

mateus-dias-cwb commented Jan 5, 2022

I was having a similar problem but installing this:

sudo apt install ruby-dev

and then trying to install Shopify CLI again solved it for me.

I found the solution here.

@regexj
Copy link

regexj commented Jan 17, 2022

Same problem here.

Have installed ruby 2.7.0 and the recommended fix of installing ruby-dev. On Linux Mint 20.3. Trying to install Shopify App CLI gets the same error as above.

➜  ~ sudo apt install /home/joe/Downloads/shopify-cli-2.8.0.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'shopify-cli' instead of '/home/joe/Downloads/shopify-cli-2.8.0.deb'
The following NEW packages will be installed
  shopify-cli
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/960 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/joe/Downloads/shopify-cli-2.8.0.deb shopify-cli all 2.8.0 [960 B]
(Reading database ... 408675 files and directories currently installed.)
Preparing to unpack .../shopify-cli-2.8.0.deb ...
Building native extensions. This could take a while...
ERROR:  Error installing shopify-cli:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20220117-10774-167cn1y.rb extconf.rb
checking for ffi.h... *** 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.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/$(RUBY_BASE_NAME)2.7
	--with-ffi_c-dir
	--without-ffi_c-dir
	--with-ffi_c-include
	--without-ffi_c-include=${ffi_c-dir}/include
	--with-ffi_c-lib
	--without-ffi_c-lib=${ffi_c-dir}/lib
	--enable-system-libffi
	--disable-system-libffi
	--with-libffi-config
	--without-libffi-config
	--with-pkg-config
	--without-pkg-config
	--with-ffi-dir
	--without-ffi-dir
	--with-ffi-include
	--without-ffi-include=${ffi-dir}/include
	--with-ffi-lib
	--without-ffi-lib=${ffi-dir}/lib
/usr/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/lib/ruby/2.7.0/mkmf.rb:613:in `try_cpp'
	from /usr/lib/ruby/2.7.0/mkmf.rb:1124:in `block in have_header'
	from /usr/lib/ruby/2.7.0/mkmf.rb:971:in `block in checking_for'
	from /usr/lib/ruby/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
	from /usr/lib/ruby/2.7.0/mkmf.rb:331:in `open'
	from /usr/lib/ruby/2.7.0/mkmf.rb:361:in `block in postpone'
	from /usr/lib/ruby/2.7.0/mkmf.rb:331:in `open'
	from /usr/lib/ruby/2.7.0/mkmf.rb:357:in `postpone'
	from /usr/lib/ruby/2.7.0/mkmf.rb:970:in `checking_for'
	from /usr/lib/ruby/2.7.0/mkmf.rb:1123:in `have_header'
	from extconf.rb:10:in `system_libffi_usable?'
	from extconf.rb:42:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.15.5/gem_make.out
dpkg: error processing archive /home/joe/Downloads/shopify-cli-2.8.0.deb (--unpack):
 new shopify-cli package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /home/joe/Downloads/shopify-cli-2.8.0.deb

The mkmf log:

➜  ~ cat /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.15.5/mkmf.log
"pkg-config --exists libffi"
package configuration for libffi is not found
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -fdebug-prefix-map=/build/ruby2.7-QclakL/ruby2.7-2.7.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -lruby-2.7  -lm   -lc"
In file included from /usr/include/ruby-2.7.0/ruby/ruby.h:29,
                 from /usr/include/ruby-2.7.0/ruby.h:33,
                 from conftest.c:1:
/usr/include/ruby-2.7.0/ruby/defines.h:126:10: fatal error: stdio.h: No such file or directory
  126 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

Versions

➜  ~ ruby -v        
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
➜  ~ sudo apt install ruby-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ruby-dev is already the newest version (1:2.7+1).
➜  ~ make -v        
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
➜  ~ shopify version
zsh: command not found: shopify

@regexj
Copy link

regexj commented Jan 19, 2022

After much frustration I found the problem in my machine.

package configuration for libffi is not found

This error indicated I needed libffi installed. sudo apt install libffi-dev

Didn't fix the issue.

fatal error: stdio.h: No such file or directory

After some googling the answers suggested I needed libc6-dev installed, which was included among other essential build tools in build-essential. So I ran aptitude install build-essential

But a new error came up:

libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.3 is installed

The following stackoverflow question explained what the issue was and the solution: https://askubuntu.com/questions/1315906/unmet-dependencies-libc6-the-package-system-is-broken

So a downgrade was needed:
sudo apt install libc6=2.31-0ubuntu9.2 libc-bin=2.31-0ubuntu9.2

It removed a lot of stuff:

The following packages will be REMOVED
  libatomic1:i386 libbsd0:i386 libc6:i386 libc6-dbg libcrypt1:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386
  libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libffi7:i386
  libgcc-s1:i386 libgl1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386 libglvnd0:i386
  libglx-mesa0:i386 libglx0:i386 libgpg-error0:i386 libidn2-0:i386 libllvm12:i386 libnvidia-compute-460:i386
  libnvidia-decode-460:i386 libnvidia-encode-460:i386 libnvidia-fbc1-460:i386 libnvidia-gl-460:i386
  libnvidia-ifr1-460:i386 libpciaccess0:i386 libsensors5:i386 libstdc++6:i386 libtinfo6:i386 libudev1:i386
  libunistring2:i386 libvulkan1:i386 libwayland-client0:i386 libx11-6:i386 libxau6:i386 libxcb-dri2-0:i386
  libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-randr0:i386 libxcb-shm0:i386 libxcb-sync1:i386
  libxcb-xfixes0:i386 libxcb1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxinerama1:i386 libxshmfence1:i386
  libxss1:i386 libxxf86vm1:i386 libzstd1:i386 mesa-vulkan-drivers:i386 steam:i386 zlib1g:i386
The following packages will be DOWNGRADED:
  libc-bin libc6

But then I was finally able to install build-essential which included all the relevant lib6c dev packages.

sudo aptitude install build-essential
The following NEW packages will be installed:
  build-essential g++{a} g++-9{a} libc-dev-bin{a} libc6-dev{a} libcrypt-dev{a} libstdc++-9-dev{a}

Then finally after all this effort I was able to gem install shopify-cli.

Tldr: If you have ruby and ruby-dev installed and it's still not working for you then your libc6 might be too up to date. The following downgrade should fix things for you:

sudo apt install libc6=2.31-0ubuntu9.2 libc-bin=2.31-0ubuntu9.2
sudo aptitude install build-essential
gem install shopify-cli

@pepicrft
Copy link
Contributor

Hey @regexj,
Apologies for the inconvenience that might have caused. By looking at the errors, it seems that the installation of the CLI triggered the compilation of the native extensions of some gems, and they failed to compile because of some missing components in your system. Do you preserve those logs by any chance? Do you remember the gem it was trying to install when the error blew up?

@madalinignisca
Copy link

I'd like to ask why the debian package is packing scripts to compile the extension and it is not providing prebuilt binaries, as a debian/ubuntu user is expecting from a debian binary package?

If you are not intending to provide the debian packages as per how Debian and Ubuntu are doing packages, could you at least highlight to users that?

@MehediHasan06
Copy link

MehediHasan06 commented Mar 28, 2022

Hi @regexj,
Thanks for the solution. I've installed the Shopify-cli as I've confirmed it from this.

➜  ~ sudo gem install shopify-cli 
[sudo] password for mehedi:  
Building native extensions. This could take a while...
Successfully installed shopify-cli-2.15.2
Parsing documentation for shopify-cli-2.15.2
Done installing documentation for shopify-cli after 2 seconds
1 gem installed

After that, I've tried to check the version. But got this -

➜  ~ shopify version             
zsh: command not found: shopify

Can you indicate what's the problem here?

@MandarDevarshi
Copy link

Install libltdl-dev

apt-get install libltdl-dev ( use sudo if required )

Then, install shopify-cli whichever way you prefer,

Hope this does the trick :)

@MehediHasan06
Copy link

I've installed libtdl-dev and then I've installed the shopify but shopify command can't be found like before.

@MandarDevarshi
Copy link

I've installed libtdl-dev and then I've installed the shopify but shopify command can't be found like before.

I do not understand what do you mean by command cannot be "found like before" ?

@MehediHasan06
Copy link

I've installed libtdl-dev. Then I run the shopify command to see the version and got this.

➜  ~ shopify version             
zsh: command not found: shopify

@MandarDevarshi
Copy link

First of all, did the installation succeed ?
Have you checked the environment variable PATH ?
Have you searched for shopify binary location ? Eg. /usr/local/bin etc.

@github-actions
Copy link

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.

→ If there's no activity within a week, then a bot will automatically close this.

Thanks for helping to improve Shopify's dev tooling and experience.

@edarioq
Copy link

edarioq commented Jul 24, 2022

This solved it

@madalinignisca
Copy link

I wonder why Shopify's developers leave this unsorted. shopify cli in a binary package MUST not contain it's sources and compile on the system. Any Linux user expects to have the binary already compiled from a package installation, and who wants the source, can use the source packages. It's been like this since early days of RedHat, Debian and many other distros.

This Issue proves that Shopify developers are not able to understand the standards of any Linux distribution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants