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

gem install snappy breaks on Ubuntu jammy / aarch64 #47

Open
libweirdness opened this issue Jun 9, 2022 · 7 comments
Open

gem install snappy breaks on Ubuntu jammy / aarch64 #47

libweirdness opened this issue Jun 9, 2022 · 7 comments

Comments

@libweirdness
Copy link

this is my learning-programming environment:
aarch64/Android/Termux/Ubuntu server, Jammy, aka 22.04 LTS
Ruby 3.0.2
( I tried the git version of rbenv,
and discovered that NO version of Ruby can be compiled on this system except 3.1.2,
for some reason.
I reported that to bugs.ruby-lang, and they closed it almost immediately,
saying it was an ssl bug? )

Anyways, the bug looks simple, for a change...

stderr recorded this:

1 ERROR:  Error installing snappy:
  2    ERROR: Failed to build gem native extension.
  3                                                                                                 
 4     current directory: /var/lib/gems/3.0.0/gems/snappy-0.3.0/ext                                
 5 /usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20220609-23120-u8yna8.rb extconf.rb  
 6 checking for -lsnappy... yes                                                                    
 7 creating Makefile                                                                               
 8                                                                                                 
 9 current directory: /var/lib/gems/3.0.0/gems/snappy-0.3.0/ext                                    
10 make DESTDIR\= clean                                                                            
11                                                                                                 
12 current directory: /var/lib/gems/3.0.0/gems/snappy-0.3.0/ext                                    
13 make DESTDIR\=                                                                                  
14 compiling api.c                                                                                 
15 linking shared-object snappy_ext.so                                                             
16                                                                                                 
17 current directory: /var/lib/gems/3.0.0/gems/snappy-0.3.0/ext                                    
18 make DESTDIR\= install                                                                          
19 make: /usr/bin/mkdir: No such file or directory                                                 
20 make: *** [Makefile:202: .sitearchdir.time] Error 127                                           
21                                                                                                 22 make install failed, exit code 2                                                                23                                                                                                 24 Gem files will remain installed in /var/lib/gems/3.0.0/gems/snappy-0.3.0 for inspection.        
25 Results logged to /var/lib/gems/3.0.0/extensions/aarch64-linux/3.0.0/snappy-0.3.0/gem_make.out

I checked: the ONLY mkdir is in /bin not in /usr/bin
( and offhand, I don't recall any recent version of Linux having those under /usr?
is it searching for a special version?
one that includes the attr capabilities or something? )

Anyways, I hope this is a bug as easy to fix as my beginner-at-programming eyes thinks it is.

Salut, Namaste, & Kaizen!

( :

@libweirdness
Copy link
Author

I just discovered the sha3 gem failed for the same reason!

This suggests there is some building-tool that both of youse are using,
that is the actual culprit!

Ha!

@miyucy
Copy link
Owner

miyucy commented Jun 9, 2022

Could you try below command?

ruby -v -rrbconfig -e "puts RbConfig::CONFIG['MAKEDIRS']"

👇 In my env.

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
/usr/local/bin/gmkdir -p

And, this command.

grep -A 3 -B 3 mkdir $(gem env gemdir)/gems/snappy-0.3.0/ext/Makefile 

👇 In my env.

RM = rm -f
RM_RF = rm -fr
RMDIRS = rmdir -p
MAKEDIRS = /usr/local/bin/gmkdir -p
INSTALL = /usr/local/bin/ginstall -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644

mkmf https://github.com/ruby/ruby/blob/75223433512d46f94fba5c0cb6f585fff5e9eee7/lib/mkmf.rb#L2084

@miyucy
Copy link
Owner

miyucy commented Jun 9, 2022

Could you try one more command? (If you builded ruby from source with rbenv/ruby-build.)

grep -i mkdir ~/.rbenv/sources/3.1.2/ruby-3.1.2/config.status 

(please replace path with your using ruby version before run)

👇 In my env.

  mkdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
as_fn_mkdir_p ()
  test -d "$as_dir" || eval $as_mkdir_p || {
    test -z "$as_dirs" || eval "mkdir $as_dirs"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
  as_mkdir_p='mkdir -p "$as_dir"'
  as_mkdir_p=false
MKDIR_P='/usr/local/bin/gmkdir -p'
  (umask 077 && mkdir "$tmp")
S["MAKEDIRS"]="/usr/local/bin/gmkdir -p"
S["MKDIR_P"]="/usr/local/bin/gmkdir -p"
  as_dir="$ac_dir"; as_fn_mkdir_p
  ac_MKDIR_P=$MKDIR_P
  case $MKDIR_P in
  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
s&@MKDIR_P@&$ac_MKDIR_P&;t t

@libweirdness
Copy link
Author

libweirdness commented Jun 9, 2022

I think you've got it!

$ ruby -v -rrbconfig -e "puts RbConfig::CONFIG['MAKEDIRS']"
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [aarch64-linux-gnu]
/usr/bin/mkdir -p

But there IS no mkdir, there!

That needs to get upstream to someone
( meaning you, who actually know what you're doing,
needs to get that to someone : )


$ grep -A 3 -B 3 mkdir $(gem env gemdir)/gems/snappy-0.3.0/ext/Makefile
RM = rm -f
RM_RF = $(RUBY) -run -e rm -- -rf
RMDIRS = rmdir --ignore-fail-on-non-empty -p
MAKEDIRS = /usr/bin/mkdir -p
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644

again!


While I did build 3.1.2 from source,
it wasn't my goal:
I wanted Ruby 2.5.x, so I could have the same generation of Ruby as my
"The Well Grounded Rubyist, 3rd edition" book is using,
and 2.5.x never built, using apt installed rbenv,
so I tried the git rbenv, to see if ANY could be built,
& ended up with the newest, but all others failed...

I tried your search for config.status,
but there is no config.status under .rbenv,
according to find...

Awesome-quick insight, from you, tho!

I'm going to tell the sha3 issue tracker of this stuff you realized!

Kaizen, eh?

( :

@miyucy
Copy link
Owner

miyucy commented Jun 9, 2022

ah, you need install with -k option.

rbenv install --help                                     
Usage: rbenv install [-f|-s] [-kpv] <version>
       rbenv install [-f|-s] [-kpv] <definition-file>
       rbenv install -l|--list
       rbenv install --version

  -l/--list          List latest stable versions for each Ruby
  -L/--list-all      List all local versions
  -f/--force         Install even if the version appears to be installed already
  -s/--skip-existing Skip if the version appears to be installed already

  ruby-build options:

  -k/--keep          Keep source tree in $RBENV_BUILD_ROOT after installation
                     (defaults to $RBENV_ROOT/sources)
: 

(I'm always use -k option.)

@miyucy
Copy link
Owner

miyucy commented Jun 9, 2022

MAKEDIRS = /usr/bin/mkdir -p

I don't know why /usr/bin/mkdir...

docker run --rm ruby:3.1.2 ruby -v -rrbconfig -e 'puts RbConfig::CONFIG["MAKEDIRS"]'
Unable to find image 'ruby:3.1.2' locally
3.1.2: Pulling from library/ruby
Digest: sha256:af018e85cfae54a8d4c803640663e26232f49f31bfbe8b876e678e5365bc13ff
Status: Downloaded newer image for ruby:3.1.2
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
/bin/mkdir -p

I think that value is /bin/mkdir typically...

@libweirdness
Copy link
Author

that I recall, mkdir was in /bin back in 1996-8 or thereabouts:

hard-drives were so cramped, slow, & expensive,
that linux needed to be able to work in single-user mode without /usr partition even mounted,
( was much more common, back then, now only OpenBSD does it that way, I think ),
and you can't fix much without things like bash, ls, cp, rm, mkdir, rmdir, etc, can you?

After scrubbing my Ubuntu install, again,
I'll try rbenv with the -k option,
but I have no use for space-eating sources,
especially while trying to build-up my ultimate learning-programming environment in this machine!

It may take a couple of days,
but you'll get your info.

( :

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

2 participants