简体   繁体   中英

Running passenger_native_support.so on heroku

When I deploy my Rails 3 app with Passenger 5.3.1 on heroku I see the following failed downloads in the logs

Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz : The requested URL returned error: 404 Not Found

Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz : The requested URL returned error: 403 Forbidden

Can someone advise how I can get around this? I checked said URLs and the files are at a different URL (the path my app tries to download from is slightly wrong). Can I configure the download URL somewhere?

Due to lack of SSH access on heroku I am not quite sure where to go from here.

I'm also not sure about the advantages of PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable and where I would configure this when deploying to heroku.

Logs:

2018-05-22T14:22:02.337983+00:00 app[web.1]: --> Downloading a Phusion Passenger agent binary for your platform 2018-05-22T14:22:02.709603+00:00 app[web.1]: 2018-05-22T14:22:02.709640+00:00 app[web.1]: --> Installing Nginx 1.14.0 engine 2018-05-22T14:22:02.779900+00:00 app[web.1]: 2018-05-22T14:22:02.779946+00:00 app[web.1]: -------------------------- 2018-05-22T14:22:02.779967+00:00 app[web.1]: 2018-05-22T14:22:02.792581+00:00 app[web.1]: [passenger_native_support.so] trying to compile for the current user (u56245) and Ruby interpreter... 2018-05-22T14:22:02.792586+00:00 app[web.1]: (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable) 2018-05-22T14:22:03.114593+00:00 app[web.1]: Warning: compilation didn't succeed. To learn why, read this file: 2018-05-22T14:22:03.114653+00:00 app[web.1]: /tmp/passenger_native_support-fgpk65.log 2018-05-22T14:22:03.114732+00:00 app[web.1]: [passenger_native_support.so] finding downloads for the current Ruby interpreter... 2018-05-22T14:22:03.114766+00:00 app[web.1]: (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable) 2018-05-22T14:22:03.837288+00:00 app[web.1]: Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz : The requested URL returned error: 404 Not Found 2018-05-22T14:22:03.837312+00:00 app[web.1]: Trying next mirror... 2018-05-22T14:22:04.331785+00:00 app[web.1]: Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz : The requested URL returned error: 403 Forbidden 2018-05-22T14:22:04.332030+00:00 app[web.1]: [passenger_native_support.so] will not be used (can't compile or download) 2018-05-22T14:22:04.332036+00:00 app[web.1]: --> Passenger will still operate normally. 2018-05-22T14:22:04.410350+00:00 app[web.1]: =============== Phusion Passenger Standalone web server started =============== 2018-05-22T14:22:04.410358+00:00 app[web.1]: PID file: /app/passenger.11176.pid 2018-05-22T14:22:04.410360+00:00 app[web.1]: Log file: /app/log/passenger.11176.log 2018-05-22T14:22:04.410361+00:00 app[web.1]: Environment: production

TL;DR : You can use precompiled binary from oss-binaries.phusionpassenger.com by upgrading your Ruby to the version they bundled for, eg to v2.2.8 if you use Passenger gem v.5.3.1 , or by downgrading the Passenger gem to v5.1.9 if you prefer to stay with Ruby 2.2.7.

However binaries are not critical to Passenger operation. As the log says: Passenger will still operate normally. The absence of binaries Passenger tries to download is also ok - they don't publish binaries for every Ruby version. You can safely set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 and PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to mute both - that's in Config Vars settings of your Heroku app.

Details re Passenger compilation issue: Passenger can't compile native binaries on Heroku, at least on new heroku-16 stack. We can inspect the /tmp/passenger_native_support-fgpk65.log and then mkmf.log by doing this:

heroku run bash 
bundle exec passenger start # just to make it fill the error log file
# hit [ctrl-c]
cat /tmp/passenger_native_support-*.log

Its output has smth like this:

# /app/vendor/ruby-2.3.1/bin/ruby /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb
checking for alloca.h... *** /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/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.

It's not clear where's the mkmf.log file however, but we can make it appear in current dir by running /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb manually by using the same command that the log above has:

/app/vendor/ruby-2.3.1/bin/ruby /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb
cat mkmf.log

Then we have this:

"gcc -o conftest -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0 -I/app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension     -O3 -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wno-maybe-uninitialized  -fPIC -g conftest.c  -L. -L/app/vendor/ruby-2.3.1/lib -Wl,-R/app/vendor/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
sh: 1: gcc: not found
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

So, the root issue is that gcc is not available in heroku-16 stack runtime - and that's probably by purpose. It's not easy to make gcc available there, though it looks to be possible , but I'd not go for that provided that we can solve this issue otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM