savonet/ocaml-ssl

SSL-related error when building ocsigenserver on MacOS

Closed this issue · 1 comments

I've submitted an issue to the ocsigenserver repo, but this seems to be related to SSL, so I'm posting here as well. The package ssl builds fine, but building ocsigenserver results in the following error:

#=== ERROR while compiling ocsigenserver.2.15.0 ===============================#
# context     2.0.5 | macos/x86_64 | ocaml-base-compiler.4.07.1 | https://opam.ocaml.org#6f498bfa
# path        ~/.opam/ocaml-base-compiler.4.07.1/.opam-switch/build/ocsigenserver.2.15.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code   2
# env-file    ~/.opam/log/ocsigenserver-76396-e7966f.env
# output-file ~/.opam/log/ocsigenserver-76396-e7966f.out
### output ###
# Undefined symbols for architecture x86_64:
# [...]
#   "_SSLv23_method", referenced from:
#       _ocaml_ssl_create_context in libssl_stubs.a(ssl_stubs.o)
#   "_SSLv23_server_method", referenced from:
#       _ocaml_ssl_create_context in libssl_stubs.a(ssl_stubs.o)
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# File "caml_startup", line 1:
# Error: Error during linking
# make[2]: *** [ocsigenserver.opt] Error 2
# make[1]: *** [all] Error 2
# make: *** [all] Error 2

My system is MacOS 10.13.6.
Any suggestions?

The issue was that on MacOS, config/discover.ml chooses the Homebrew installation of openssl, which is at version 1.0.2, instead of the MacPorts installation, which is 1.1.1. Uninstalling the Homebrew version resolved the issue for me.