openwrt / openwrt/packages

ruby/ruby-dev: Failed to install gem racc

Open
#19,867 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

OpenWrt R21.8.6

I have installed ruby and ruby-dev packages, and gcc, and gem install normal(no ext) gems success. But failed to install gem which need build ext, for example:

gem install racc
root@OpenWrt:~/rbtemp# gem install racc
Building native extensions. This could take a while...
ERROR:  Error installing racc:
	ERROR: Failed to build gem native extension.

    current directory: /usr/lib/ruby/gems/3.0/gems/racc-1.6.0/ext/racc/cparse
/usr/bin/ruby -I /usr/lib/ruby/3.0 -r ./siteconf20221109-30543-9inmjv.rb extconf.rb
checking for rb_block_call()... *** 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)
/usr/lib/ruby/3.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/mkmf.rb:567:in `try_link0'
	from /usr/lib/ruby/3.0/mkmf.rb:585:in `try_link'
	from /usr/lib/ruby/3.0/mkmf.rb:797:in `try_func'
	from /usr/lib/ruby/3.0/mkmf.rb:1086:in `block in have_func'
	from /usr/lib/ruby/3.0/mkmf.rb:974:in `block in checking_for'
	from /usr/lib/ruby/3.0/mkmf.rb:361:in `block (2 levels) in postpone'
	from /usr/lib/ruby/3.0/mkmf.rb:331:in `open'
	from /usr/lib/ruby/3.0/mkmf.rb:361:in `block in postpone'
	from /usr/lib/ruby/3.0/mkmf.rb:331:in `open'
	from /usr/lib/ruby/3.0/mkmf.rb:357:in `postpone'
	from /usr/lib/ruby/3.0/mkmf.rb:973:in `checking_for'
	from /usr/lib/ruby/3.0/mkmf.rb:1085:in `have_func'
	from extconf.rb:6:in `'

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

  /usr/lib/ruby/gems/3.0/extensions/aarch64-linux/3.0/racc-1.6.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/lib/ruby/gems/3.0/gems/racc-1.6.0 for inspection.
Results logged to /usr/lib/ruby/gems/3.0/extensions/aarch64-linux/3.0/racc-1.6.0/gem_make.out

I did some debug in /usr/lib/ruby/3.0/mkmf.rb

                                                      
  def have_devel?
    unless defined? $have_devel
      $have_devel = true
      $have_devel = try_link(MAIN_DOES_NOTHING)
    end
    $have_devel
  end               
                    
  def try_do(src, command, *opts, &b)
    unless have_devel?
      raise <<MSG
The compiler failed to generate an executable file.
You have to install development tools first.
MSG                                                                
    end    
    begin            
      src = create_tmpsrc(src, &b)
      xsystem(command, *opts)
    ensure    
      log_src(src)
    end
  end

Got used build command :

aarch64-openwrt-linux-musl-gcc -o conftest -I/usr/include/ruby-3.0/aarch64-linux-gnu -I/usr/include/ruby-3.0/ruby/backward -I/usr/include/ruby-3.0 -I. -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/include/fortify -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/include -I/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libiconv-stub/include -I/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libintl-stub/include    -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/builder/shared-workdir/build/sdk/build_dir/target-aarch64_cortex-a53_musl/ruby-3.0.4=ruby-3.0.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libiconv-stub/include -I/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libintl-stub/include  -fPIC conftest.c  -L. -L/usr/lib -L. -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/lib -znow -zrelro -L/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libiconv-stub/lib -L/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libintl-stub/lib -Wl,-rpath-link=/builder/shared-workdir/build/sdk/staging_dir/target-aarch64_cortex-a53_musl/usr/lib/libintl-stub/lib -L/builder/shared-workdir/build/sdk/build_dir/target-aarch64_cortex-a53_musl/ruby-3.0.4  -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -lruby  -lm   -lc

@luizluca

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported gem install racc failure on OpenWrt R21.8.6 and inspect the referenced /usr/lib/ruby/3.0/mkmf.rb behavior. Review the generated mkmf.log, gem_make.out, extconf.rb, and compiler command to identify why the native extension cannot build; done would require a confirmed diagnosis and an agreed repository change.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.