phusion / passenger

A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
MIT License
5.01k stars 547 forks source link

passenger-install-apache2-module fails with OpenSSL development headers not found on OSX El Capitan #1630

Closed Fallen-Zen-zz closed 9 years ago

Fallen-Zen-zz commented 9 years ago

After upgrading to El Capitan I'm unable to install the Apache module by running passenger-install-apache2-module.

I'm getting this error: * Checking for OpenSSL development headers... Found: no

There's for sure a default installation of OpenSSL on the system, also tried installing the latest one (OpenSSL 1.0.2d 9 Jul 2015) to /opt/local/bin/openssl but that did not help at all. Still the same problem.

How can I point to the correct path?

FooBarWidget commented 9 years ago

Can you re-run the installer with the environment variable VERBOSE=1 and tell me what you see?

Fallen-Zen-zz commented 9 years ago

Here you go:

`* Checking for OpenSSL development headers...
       -> Checking for openssl/ssl.h
          Running: cc -v -c '/var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c' -o '/var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c.o'
          Source file contains:
          -------------------------
          #include <openssl/ssl.h>
          -------------------------
       -> Output:
          -------------------------
          Apple LLVM version 7.0.0 (clang-700.0.72)
          Target: x86_64-apple-darwin15.0.0
          Thread model: posix
           "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name passenger-compile-check.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.2 -v -dwarf-column-info -coverage-file /var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0 -fdebug-compilation-dir /Library/Ruby/Gems/2.0.0/gems/passenger-5.0.20 -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -o /var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c.o -x c /var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c
          clang -cc1 version 7.0.0 based upon LLVM 3.7.0svn default target x86_64-apple-darwin15.0.0
          ignoring nonexistent directory "/usr/local/include"
          #include "..." search starts here:
          #include <...> search starts here:
           /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include
           /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
           /usr/include
           /System/Library/Frameworks (framework directory)
           /Library/Frameworks (framework directory)
          End of search list.
          /var/folders/6m/b07y8np14m98dzr7q5t5mw8h0000gn/T/passenger.59hzdd/passenger-compile-check.c:2:20: fatal error: 'openssl/ssl.h' file not found
                    #include <openssl/ssl.h>
                             ^
          1 error generated.

          -------------------------
       -> Check failed with exit status 1
      Found: no`

Also here's the output for locating ssl.h header:

`/Applications/Server.app/Contents/ServerRoot/usr/share/postgresql/html/libpq-ssl.html
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/apache2/mod_ssl.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/apache2/mod_ssl.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl/kssl.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl/ssl.h
/Library/WebServer/share/httpd/manual/mod/mod_nw_ssl.html
/Library/WebServer/share/httpd/manual/mod/mod_nw_ssl.html.en
/Library/WebServer/share/httpd/manual/mod/mod_nw_ssl.html.fr
/Library/WebServer/share/httpd/manual/mod/mod_ssl.html
/Library/WebServer/share/httpd/manual/mod/mod_ssl.html.en
/Library/WebServer/share/httpd/manual/mod/mod_ssl.html.en.orig
/Library/WebServer/share/httpd/manual/mod/mod_ssl.html.fr
/opt/local/include/boost/asio/ssl.hpp
/opt/local/include/openssl/kssl.h
/opt/local/include/openssl/ssl.h
/opt/local/share/doc/boost/doc/html/boost_asio/overview/ssl.html
/opt/local/share/doc/boost/doc/html/boost_asio/reference/ssl__stream__impl_struct/ssl.html
/usr/include/apache2/mod_ssl.h`
FooBarWidget commented 9 years ago

It looks like El Cptain no longer includes OpenSSL headers?

Can you try reinstalling the developer tools? Previous OS X upgrades broke development headers, which was fixed by reinstalling developer tools.

If that doesn't help, can you run the installer with these environment variables?

EXTRA_CFLAGS="-I/opt/local/include"
EXTRA_CXXFLAGS="-I/opt/local/include"
EXTRA_LDFLAGS="-L/opt/local/lib"
Fallen-Zen-zz commented 9 years ago

Environment variables seemed to help, thanks! Also on Mac OS X Server the apache config file is under: /Library/Server/Web/Config/apache2/.

FooBarWidget commented 9 years ago

So reinstalling the developer tools did not help?

Fallen-Zen-zz commented 9 years ago

Yes.

zhimin commented 9 years ago

I am having the same issue with Passenger Nginx installer after upgrading to Mac OS X El Capitan.

gremz commented 9 years ago

@Fallen-Zen are the environment variables all you set before running passenger-install-apache2-module again? I am having the same issue

Fallen-Zen-zz commented 9 years ago

@gremz I've also had to install OpenSSL from source.

gremz commented 9 years ago

@Fallen-Zen I've built OpenSSL 1.1.0-dev from source and linked to bin. Should I be looking elsewhere?

PeterMozesMerl commented 9 years ago

Setting the EXTRA_XXXLAGS makes the apache2-module compile.

System: Mac OS X El Capitan, Macports, RVM.

joebrislin commented 9 years ago

For those that use homebrew, you can simply install openssl using homebrew.

brew install openssl

Make sure that you have updated XCode and agreed to the license and then run

xcode-select --install

Then you can simply run the following with the included environment variables

export EXTRA_CFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include & export EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib & passenger-install-apache2-module
b-mandelbrot commented 9 years ago
brew install openssl
brew link openssl --force
zhimin commented 9 years ago

brew link openssl --force does not work for me (passenger-install-nginx).

Undefined symbols for architecture x86_64:
  "_SSL_CTX_set_alpn_select_cb", referenced from:
      _ngx_http_ssl_merge_srv_conf in ngx_http_ssl_module.o
  "_SSL_CTX_set_next_protos_advertised_cb", referenced from:
      _ngx_http_ssl_merge_srv_conf in ngx_http_ssl_module.o
  "_SSL_select_next_proto", referenced from:
      _ngx_http_ssl_alpn_select in ngx_http_ssl_module.o
  "_X509_check_host", referenced from:
      _ngx_ssl_check_host in ngx_event_openssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [objs/nginx] Error 1
FooBarWidget commented 9 years ago

What if you run passenger-install-nginx-module with --extra-configure-flags=--with-openssl=/usr/local/opt/openssl ?

zhimin commented 9 years ago

Still no luck, the commands below:

export EXTRA_CFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib passenger-install-nginx-module --extra-configure-flags=--with-openssl=/usr/local/opt/openssl

Configuration summary
  + using system PCRE library
  + using OpenSSL library: /usr/local/opt/openssl
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/opt/nginx-1.8.0.2"
  nginx binary file: "/opt/nginx-1.8.0.2/sbin/nginx"
  nginx configuration prefix: "/opt/nginx-1.8.0.2/conf"
  nginx configuration file: "/opt/nginx-1.8.0.2/conf/nginx.conf"
  nginx pid file: "/opt/nginx-1.8.0.2/logs/nginx.pid"
  nginx error log file: "/opt/nginx-1.8.0.2/logs/error.log"
  nginx http access log file: "/opt/nginx-1.8.0.2/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

# make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f objs/Makefile
cd /usr/local/opt/openssl \
    && if [ -f Makefile ]; then /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; fi \
    && ./config --prefix=/usr/local/opt/openssl/.openssl no-shared  \
    && /Applications/Xcode.app/Contents/Developer/usr/bin/make \
    && /Applications/Xcode.app/Contents/Developer/usr/bin/make install LIBDIR=lib
/bin/sh: ./config: No such file or directory
make[1]: *** [/usr/local/opt/openssl/.openssl/include/openssl/ssl.h] Error 127
make: *** [build] Error 2
PeterMozesMerl commented 9 years ago

What framework are you using Passenger for?

openssl is installed by Macports as a dependency for RVM/Ruby. On my machine the following packages depend on it:

serf1 @1.3.4_0 postgresql94 @9.4.4_0 qt5-mac @5.4.2_1 apache2 @2.2.31_0+preforkmpm python27 @2.7.10_3 kerberos5 @1.13.2_1 cyrus-sasl2 @2.1.26_4+kerberos p5.16-net-ssleay @1.710.0_0 libevent @2.0.22_1 nodejs @0.12.7_0+python27+ssl openvpn2 @2.3.4_0 curl @7.45.0_0+ssl git @2.6.1_0+credential_osxkeychain+doc+pcre+perl5_16+python27

And probably by Ruby too. The RVM dependencies are not on this list.

This covers ruby, python and nodejs. I’m wondering how you can have openssl not installed if you are working with Passenger.

FooBarWidget commented 9 years ago

I think I have fixed this problem in the GH-1630 branch. Passenger will automatically use the OpenSSL installation from Homebrew.

I am not able to upgrade to El Capitain; the El Capitan installer keeps crashing on me. So can anybody verify this for me?

zhimin commented 9 years ago

Yes, I could install Passenger-Nginx on my El Capitan with GH-1630 branch. Thanks!

jensb commented 9 years ago

Seems to work for Macports OpenSSL on El Capitan too.

PikachuEXE commented 9 years ago

Can this be backported to 4.0.*?

FooBarWidget commented 9 years ago

No. Please upgrade to 5.x instead.

eric commented 9 years ago

I would appreciate if it was backported to 4.0.x as well.

damoguyan8844 commented 8 years ago

can you apply this update to 4.0.59 ?

FooBarWidget commented 8 years ago

Sorry, no more updates will be released against 4.x. Why don't you upgrade to 5.x? It has a ton of improvements.

Sent from my Android phone. On Nov 20, 2015 10:20 AM, "Alex" notifications@github.com wrote:

can you apply this update to 4.0.59 ?

— Reply to this email directly or view it on GitHub https://github.com/phusion/passenger/issues/1630#issuecomment-158333802.

damoguyan8844 commented 8 years ago

thanks for your reply, i have to work with both ree-1.8.7 and ruby 2.2.1。 so as you know,i can not upgrade my passenger normally!

发自我的 iPhone

在 2015年11月20日,17:24,Hongli Lai notifications@github.com 写道:

Sorry, no more updates will be released against 4.x. Why don't you upgrade to 5.x? It has a ton of improvements.

Sent from my Android phone. On Nov 20, 2015 10:20 AM, "Alex" notifications@github.com wrote:

can you apply this update to 4.0.59 ?

— Reply to this email directly or view it on GitHub https://github.com/phusion/passenger/issues/1630#issuecomment-158333802.

— Reply to this email directly or view it on GitHub.

FooBarWidget commented 8 years ago

Passenger 5 is compatible with REE 1.8.7 and with Ruby 2.2.1. So what is preventing you from upgrading?

eric commented 8 years ago

The biggest thing preventing me from upgrading is that I'm using 4 in production, so I would like to use it on my development systems too.

If I put a config.ru in my directory for making it work in development with 5, it will break my production environment.

FooBarWidget commented 8 years ago

What's preventing you from upgrading to 5 in production?

eric commented 8 years ago

It isn't a high priority right now because our current situation isn't having any problems. Running things in production is constantly weighing priorities. The reason why I pay for Passenger is because it saves me time I would otherwise need to devote to things that don't help my customers.

Upgrading from 4 to 5 is not going to benefit my customers today, so it hasn't risen to the top of my priority list.

FooBarWidget commented 8 years ago

In that case I suggest a workaround. Try this command on OS X El Capitan with Passenger 4:

env EXTRA_CFLAGS=-I/usr/local/opt/openssl/include \
  EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include \
  EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib \
  ./bin/passenger-install-nginx-module \
    --extra-configure-flags='--with-cc-opt="-Wno-error -I/usr/local/opt/openssl/include" --with-ld-opt=-L/usr/local/opt/openssl/lib'
eric commented 8 years ago

Will those same flags work if I use the apache module?

FooBarWidget commented 8 years ago

There are no known issues with El Capitan and Passenger's Apache module. The El Capitan problems seemed to be limited to the Nginx module and the Standalone mode only.

eric commented 8 years ago

Should I open a separate issue for my OpenSSL issue with Apache and El Capitan?

FooBarWidget commented 8 years ago

Yes please do.

XxUnkn0wnxX commented 8 years ago

Look guys for openSSL and SR itself to have 0 issue this my setup on EL Capitan:

Be sure you are using the Brewed version of python! shut down SickRage before you do any of these steps

to setup brew properly follow these guide lines: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md

be sure that your .bash_profile looks similar to mine:

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/lib:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/local/opt/coreutils/libexec/gnubin export PATH=/usr/local/sbin:$PATH export HOMEBREW_GITHUB_API_TOKEN= export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"export PATH="/usr/local/sbin:$PATH"

for "HOMEBREW_GITHUB_API_TOKEN=" you can get your token here: https://github.com/settings/tokens

the important bit here is to have /usr/local first in all ur path statements

then go to /etc and edit a file called paths or you can via nano if you installed that via brew

sudo nano /etc/paths

make sure it looks like mine: /usr/local/bin /usr/bin /bin /usr/sbin /sbin

/usr/local/bin has to be on top then save Press Control + X Keys and it will ask you if you want to save it Y for yes.

then brew install openssl && brew unlink openssl && brew link openssl --overwrite --force

then quoted from here: http://stackoverflow.com/questions/22774529/what-is-the-safest-way-to-removing-python-framework-files-that-are-located-in-di, i did this:

Step 1: The native Python 2.7.x version lives here /System/Library/Frameworks/Python.framework/Versions/2.7 (or 2.6, etc), so you can remove any Python that got installed elsewhere.

sudo rm -rf /Library/Frameworks/Python.framework/ [safe to delete]

Or, according to this article, you should brew install both python 2.7 and python 3.x, and avoid using system python in Mavericks.

Step 2: Remove python in Applications directory (the one where all your apps are).

cd into folder /Applications and ls | grep Python to see what have.

Then remove: sudo rm -rf "Python 3.3"

Step 3:

brew prune [important you do this last]

sample output:

Pruned 0 dead formula Pruned 46 symbolic links from /usr/local Step 4: Run steps recommended by brew doctor

Then i installed python via brew brew install python or brew reinstall python

same with python3 (not really needed but recommended)

then i did: brew unlink python && brew link python --overwrite --force brew unlink python3 && brew link python3 --overwrite --force

then via pip

pip install setuptools --upgrade pip install Cheetah pip install cryptography pip install pyOpenSSL pip install pycrypto

then i ran pip list -o and did pip install formula --upgrade

where "formula" the names of all the outdated packages listed by the pip list -o command

do: which openssl which python and output should look like mine: XxUnkn0wnxX-iMac:~ Admin$ which openssl /usr/local/bin/openssl XxUnkn0wnxX-iMac:~ Admin$ which python /usr/local/bin/python

after that i ran SR via my App method here: https://gist.github.com/XxUnkn0wnxX/d199daecc5c414174cf9

or just run from Terminal Cd into the Dir where Sickrage is then do python SickBeard.py -d &

now you can close terminal this command makes it run in the background

and from there i just open /SickRage/Logs/sickrage.log file via console and look for error and debug the issue. be sure debugging logging is enabled in SR.

also in General Advanced settings i have "Verify SSL Certs" unticked, save then restart SR

SideNote: if using NZBToMedia With Sab on El Capitan & you have not disabled Rootless then use this: https://gist.github.com/XxUnkn0wnxX/bf3d848232f4a71b6556

XxUnkn0wnxX commented 8 years ago

when you run brew doctor ignore: You may wish to brew unlink these brews:

and for SR Post Processing if you want it to unpack be sure you have installed these via brew: p7zip unzip unrar

also helps NZBtoMedia

Sarcas666 commented 8 years ago

You wrote: brew unlink python3 && brew link python --overwrite --force it errors on me. Did you mean brew unlink python3 && brew link3 python --overwrite --force ? That worked, but since I have almost no idea what I am doing here...

XxUnkn0wnxX commented 8 years ago

ye sorry i made a small mistake.

i meant:

brew unlink python && brew link python --overwrite --force brew unlink python3 && brew link python3 --overwrite --force

but only the 1st one should be fine the normal python python3 is only used if you have python3 installed via brew..

--force simply forces the links incase it fails normally. and --overwrite makes sure that the brewed symlinks overwrite all other python symlinks. so only the brewed version of python is used & if ur /etc/paths & .bash_profile are setup right all should be good.

simply put it you want to use the brewed version of python which you installed all the necessary modules via pip so that sickrage would run without issue. instead of using the sys ver of python that doesnt have the right modules...

youfulife commented 8 years ago
brew install openssl
ln -s /usr/local/Cellar/openssl/1.0.2c/include/openssl /usr/local/include/openssl
tcr-ableton commented 8 years ago
xcode-select --install

Did it for me :-)

derakoola commented 8 years ago
  1. install port: https://guide.macports.org/
  2. install or upgrade openssl package: sudo port install openssl or sudo port upgrade openssl
  3. that's it.
knasim commented 7 years ago

i having the same issue on macOS (Sierra) I compiling NGIN from source and install a 3rd party module

./configure --prefix=/Users/managerd/git/nginx-src/nginx-1.9.13 --with-pcre=/Users/managerd/git/pcre/pcre-8.39 --with-zlib=/Users/managerd/git/zlib/zlib-1.2.8 --with-http_ssl_module --with-openssl=./

/bin/sh: ./config: No such file or directory make[1]: *** [.openssl/include/openssl/ssl.h] Error 127

OnixGH commented 7 years ago

@knasim check the path you are passing to --with-openssl, doesn't look like the same issue.

Please post to our Community support forum for further help, the original issue is solved and closed.

knasim commented 7 years ago

@OnixGH - it doesn't seem to matter what path you pass to it .
For example you give it: --with-openssl=/tmp/foo/openssl after you run make it craps out with an invalid path to the SSL headers. i.e. /tmp/foo/openssl./.openssl/include/openssl/ssl.h

sharkzp commented 7 years ago

Same issue as @knasim on OSX Sierra.

CamJN commented 7 years ago

@sharkzp @knasim please use https://groups.google.com/forum/#!topic/phusion-passenger/feL69qGWFXg for further discussion.

sharkzp commented 7 years ago

@CamJN thank you but I was able to figure out the problem. First is the issue with internal package which is resolved by adding this to ./configure

--with-cc-opt="-I/usr/local/opt/openssl/include" \
--with-ld-opt="-L/usr/local/opt/openssl/lib"

Another one is disabling csrutil for some reason after update it was enabled for me again. But of course I wouldn't recommend anyone to do that if they don't know what they are doing.

knasim commented 7 years ago

@sharkzp can you paste your full command here .

update: resolved it on my end. you have to supply the path to the openssl source code. otherwise when building nginx from source it will continually crap put if you just put it to openssl binaries folder.

moeabdol commented 7 years ago

Try xcode-select --install To install xcode commandline utilities.