Skip to content

Instantly share code, notes, and snippets.

@jay-ouellette
Last active May 16, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jay-ouellette/d51337fdd22954eaf4193f9ecbb8215b to your computer and use it in GitHub Desktop.
Save jay-ouellette/d51337fdd22954eaf4193f9ecbb8215b to your computer and use it in GitHub Desktop.
Build Nginx with OpenSSL from source
#!/usr/bin/env bash
openssl_version='1.1.1b'
openssl_tgz="openssl-${openssl_version}.tar.gz"
openssl_src_dir="openssl-${openssl_version}/"
nginx_version='1.15.12'
nginx_tgz="nginx-${nginx_version}.tar.gz"
nginx_src_dir="nginx-${nginx_version}/"
echo "Mac OS $(sw_vers -productVersion)"
xcodebuild -version | grep Xcode
echo "Nginx $nginx_version"
echo "OpenSSL $openssl_version"
echo ""
set -x
mkdir nginx
pushd nginx
curl -sO "https://www.openssl.org/source/${openssl_tgz}" &
curl -sO "https://nginx.org/download/${nginx_tgz}" &
wait
tar -xzf "${openssl_tgz}"
tar -xzf "${nginx_tgz}"
pushd "${nginx_src_dir}"
./configure \
--with-http_ssl_module \
--with-openssl="$(pwd)/../${openssl_src_dir}" \
--prefix="$(pwd)/../nginx-build"
make && make install
set +x
popd
popd
@jay-ouellette
Copy link
Author

build fails on
Mac OS 10.11.6
Xcode 7.3.1

with:

Undefined symbols for architecture x86_64:
  "_CRYPTO_add_lock", referenced from:
      _ngx_ssl_stapling in ngx_event_openssl_stapling.o
  "_ENGINE_cleanup", referenced from:
      _ngx_openssl_exit in ngx_event_openssl.o
  "_EVP_MD_CTX_create", referenced from:
      _ngx_ssl_session_cache in ngx_event_openssl.o
  "_EVP_MD_CTX_destroy", referenced from:
      _ngx_ssl_session_cache in ngx_event_openssl.o
  "_EVP_cleanup", referenced from:
      _ngx_openssl_exit in ngx_event_openssl.o
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_SSL_CTX_get_ex_new_index", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_SSL_CTX_set_tmp_rsa_callback", referenced from:
      _ngx_ssl_ciphers in ngx_event_openssl.o
  "_SSL_get_ex_new_index", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_SSL_library_init", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_SSL_load_error_strings", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_SSL_state", referenced from:
      _ngx_ssl_shutdown in ngx_event_openssl.o
     (maybe you meant: _SSL_stateless)
  "_SSLeay_version", referenced from:
      _main in nginx.o
  "_SSLv23_method", referenced from:
      _ngx_ssl_create in ngx_event_openssl.o
  "_X509_get_ex_new_index", referenced from:
      _ngx_ssl_init in ngx_event_openssl.o
  "_sk_new_null", referenced from:
      _ngx_ssl_load_certificate in ngx_event_openssl.o
     (maybe you meant: _OPENSSL_sk_new_null)
  "_sk_num", referenced from:
      _ngx_ssl_session_cache in ngx_event_openssl.o
      _ngx_ssl_stapling in ngx_event_openssl_stapling.o
     (maybe you meant: _OPENSSL_sk_num)
  "_sk_pop_free", referenced from:
      _ngx_ssl_certificate in ngx_event_openssl.o
      _ngx_ssl_load_certificate in ngx_event_openssl.o
      _ngx_ssl_connection_certificate in ngx_event_openssl.o
     (maybe you meant: _OPENSSL_sk_pop_free)
  "_sk_push", referenced from:
      _ngx_ssl_load_certificate in ngx_event_openssl.o
     (maybe you meant: _OPENSSL_sk_push)
  "_sk_value", referenced from:
      _ngx_ssl_session_cache in ngx_event_openssl.o
      _ngx_ssl_stapling in ngx_event_openssl_stapling.o
     (maybe you meant: _OPENSSL_sk_value)
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
make: *** [build] Error 2

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