passenger: passenger_native_support.so not being downloaded/built

Answer to questions below, but it looks like it’s an issue with the PATH being cleared out somehow before/during invocation of /usr/share/passenger/helper-scripts/rack-preloader.rb.

Question 1: What is the problem? On start, passenger is unable to build or fetch the passenger_native_support.so. In the logs we have the following:

App 9467 stdout:
App 9467 stderr:  [passenger_native_support.so] trying to compile for the current user (tom) and Ruby interpreter...
App 9467 stderr:
App 9467 stderr:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 9467 stderr:
App 9467 stdout: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
App 9467 stderr:      Warning: compilation didn't succeed. To learn why, read this file:
App 9467 stderr:
App 9467 stderr:      /tmp/passenger_native_support-eyz7qt.log
App 9467 stderr:
App 9467 stderr:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
App 9467 stderr:
App 9467 stderr:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
App 9467 stderr:
App 9467 stderr:      Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.1.4/rubyext-ruby-2.1.9-x86-linux.tar.gz: no download tool found (curl or wget required)
App 9467 stderr:      Trying next mirror...
App 9467 stderr:      Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.1.4/rubyext-ruby-2.1.9-x86-linux.tar.gz: no download tool found (curl or wget required)
App 9467 stderr:  [passenger_native_support.so] will not be used (can't compile or download)
App 9467 stderr:
App 9467 stderr:   --> Passenger will still operate normally.
App 9467 stderr:
App 9467 stderr: /usr/share/passenger/helper-scripts/rack-preloader.rb: No such file or directory - uname
App 9467 stderr:
App 9467 stderr: Rack::File headers parameter replaces cache_control after Rack 1.5.
App 9467 stderr:
App 9467 stderr: sh: 1:
App 9467 stderr: env: not found
App 9467 stderr:

Contents of temp file:

# current user is: tom
# mkdir -p /home/tom/.passenger/native_support/5.1.4/ruby-2.1.9-x86-linux
# cd /home/tom/.passenger/native_support/5.1.4/ruby-2.1.9-x86-linux
# /usr/bin/ruby2.1 /usr/share/passenger/ruby_extension_source/extconf.rb
checking for alloca.h... *** /usr/share/passenger/ruby_extension_source/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=/usr/share/passenger/ruby_extension_source
	--curdir
	--ruby=/usr/bin/ruby2.1
/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
	from /usr/lib/ruby/2.1.0/mkmf.rb:1061:in `block in have_header'
	from /usr/lib/ruby/2.1.0/mkmf.rb:912:in `block in checking_for'
	from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
	from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
	from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
	from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
	from /usr/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
	from /usr/lib/ruby/2.1.0/mkmf.rb:911:in `checking_for'
	from /usr/lib/ruby/2.1.0/mkmf.rb:1060:in `have_header'
	from /usr/share/passenger/ruby_extension_source/extconf.rb:38:in `<main>'

Contents of mkmf.log:

"gcc -o conftest -I/usr/include/i386-linux-gnu/ruby-2.1.0 -I/usr/include/ruby-2.1.0/ruby/backward -I/usr/include/ruby-2.1.0 -I/usr/share/passenger/ruby_extension_source -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -g conftest.c  -L. -L/usr/lib/i386-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/ruby2.1-CoNdM8/ruby2.1-2.1.9/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby-2.1  -lpthread -lrt -lgmp -ldl -lcrypt -lm   -lc"
gcc: error trying to exec 'cc1': execvp: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Manually running the extconf.rb:

$ /usr/bin/ruby2.1 /usr/share/passenger/ruby_extension_source/extconf.rb
checking for alloca.h... yes
checking for ruby/version.h... yes
checking for ruby/io.h... yes
checking for ruby/thread.h... yes
checking for ruby_version... no
checking for rb_thread_io_blocking_region() in ruby/io.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
creating Makefile

Presence of curl:

$ which curl
/usr/bin/curl

Question 2: Passenger version and integration mode: Open-source 5.1.4/nginx

Question 3: OS or Linux distro, platform (including version): Ubuntu 12.04.5 LTS i386

Question 4: Passenger installation method: [ ] RubyGems + Gemfile [ ] RubyGems, no Gemfile [x] Phusion APT repo [ ] Phusion YUM repo [ ] OS X Homebrew [ ] source tarball [ ] Other, please specify:

Question 5: Your app’s programming language (including any version managers) and framework (including versions): Ruby 2.1.9 Rails 3.2.22.5

Question 6: Are you using a PaaS and/or containerization? If so which one? No

Question 7: Anything else about your setup that we should know? No

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 32 (12 by maintainers)

Most upvoted comments

@Tectract the best way to compile the missing file is via:

passenger-config build-native-support

This will build the file in the correct location, for me:

/home/tom/.gem/ruby/2.5.0/gems/passenger-5.3.5/buildout/ruby/ruby-2.5.1-x86_64-linux/passenger_native_support.so

@jemminger the actual issue is not being able to compile passenger_native_support.so due to the environment not being passed along correctly to the build script.