Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Fallen-Zen-zz opened this issue Oct 5, 2015 · 53 comments

Comments

@Fallen-Zen-zz
Copy link

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
Copy link
Member

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

@Fallen-Zen-zz
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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

@FooBarWidget
Copy link
Member

So reinstalling the developer tools did not help?

@Fallen-Zen-zz
Copy link
Author

Yes.

@zhimin
Copy link

zhimin commented Oct 8, 2015

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

@gremz
Copy link

gremz commented Oct 9, 2015

@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
Copy link
Author

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

@gremz
Copy link

gremz commented Oct 9, 2015

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

@PeterMozesMerl
Copy link

Setting the EXTRA_XXXLAGS makes the apache2-module compile.

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

@joebrislin
Copy link

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
Copy link

brew install openssl
brew link openssl --force

@zhimin
Copy link

zhimin commented Oct 12, 2015

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
Copy link
Member

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

@zhimin
Copy link

zhimin commented Oct 13, 2015

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
Copy link

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 FooBarWidget added this to the 5.0.21 milestone Oct 13, 2015
@FooBarWidget FooBarWidget changed the title Installing Apache module on Mac OS X El Capitan (fails to find OpenSSL) OpenSSL problems on OS X El Captain Oct 13, 2015
@FooBarWidget FooBarWidget self-assigned this Oct 13, 2015
@FooBarWidget
Copy link
Member

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
Copy link

zhimin commented Oct 19, 2015

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

@jensb
Copy link

jensb commented Oct 22, 2015

Seems to work for Macports OpenSSL on El Capitan too.

@PikachuEXE
Copy link
Contributor

Can this be backported to 4.0.*?

@derakoola
Copy link

  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
Copy link

knasim commented Dec 14, 2016

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 OnixGH changed the title OpenSSL problems on OS X El Captain passenger-install-apache2-module fails with OpenSSL development headers not found on OSX El Capitan Dec 14, 2016
@OnixGH
Copy link
Contributor

OnixGH commented Dec 14, 2016

@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
Copy link

knasim commented Dec 14, 2016

@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
Copy link

sharkzp commented Dec 14, 2016

Same issue as @knasim on OSX Sierra.

@CamJN
Copy link
Contributor

CamJN commented Dec 15, 2016

@sharkzp
Copy link

sharkzp commented Dec 15, 2016

@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
Copy link

knasim commented Dec 15, 2016

@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
Copy link

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

@knasim
Copy link

knasim commented Jun 26, 2017

you should rely on the default system SSL version - compiling you're own version can cause deployment issues with SSL incompatibilities.

daaang - someone need to close this thread .

@moritzmair
Copy link

Amazingly I came across this issue in 2021 still.
I checked where passenger was looking for open ssl by passing the VERBOSE = 1 option
after that I linked openssl to one of the folders listed:
sudo ln -s /opt/homebrew/opt/openssl@1.1/include/openssl /opt/local/include/openssl

@igordelorenzi
Copy link

igordelorenzi commented Feb 19, 2023

On Debian 11, I solved with the following env vars:

export EXTRA_CFLAGS=-I/usr/local/src/openssl-1.1.1c/include && \
export EXTRA_CXXFLAGS=-I/usr/local/src/openssl-1.1.1c/include && \
export EXTRA_LDFLAGS=-L/usr/local/src/openssl-1.1.1c && \
passenger-install-apache2-module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests