Failing to install colorls on Ubuntu WSL
Closed this issue · 2 comments
userhiren commented
Description
I have been trying to install colorls on my Ubuntu WSL system and hitting an issue when running the sudo gem install colorls
command. I did install the prerequisite of ruby using sudo apt install ruby-full
and validated the installation using ruby -version
. I am referencing the error and the mkmf.log file for reference.
- Relevant Issues : (none)
- Relevant PRs : (none)
- Type of issue :
- Installation
- Font-related
- Feature request
- Bug in existing feature
- Developer mode : Code quality / Tests / Documentation
➜ workspaces sudo gem install colorls
Building native extensions. This could take a while...
ERROR: Error installing colorls:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/3.0.0/gems/clocale-0.0.4/ext/clocale
/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20221206-1296-zq9pyu.rb extconf.rb
checking for locale.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)3.0
--with-locale-dir
--without-locale-dir
--with-locale-include
--without-locale-include=${locale-dir}/include
--with-locale-lib
--without-locale-lib=${locale-dir}/lib
/usr/lib/ruby/3.0.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/3.0.0/mkmf.rb:613:in `try_cpp'
from /usr/lib/ruby/3.0.0/mkmf.rb:1124:in `block in have_header'
from /usr/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for'
from /usr/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /usr/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /usr/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
from /usr/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /usr/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
from /usr/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for'
from /usr/lib/ruby/3.0.0/mkmf.rb:1123:in `have_header'
from extconf.rb:9:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/clocale-0.0.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/3.0.0/gems/clocale-0.0.4 for inspection.
Results logged to /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/clocale-0.0.4/gem_make.out
➜ workspaces cat /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/clocale-0.0.4/mkmf.log
"x86_64-linux-gnu-gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-3.0.0 -I/usr/include/ruby-3.0.0/ruby/backward -I/usr/include/ruby-3.0.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/build/ruby3.0-W371Hm/ruby3.0-3.0.2=. -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-3.0 -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
avdv commented
Do you have a C compiler and make installed? Try installing the build-essential
package.