Compiling PostgreSQL on macOS via asdf fails with `Undefined symbols for architecture x86_64`
Overview
Attempting to install PostgreSQL on macOS via asdf
fails with:
Undefined symbols for architecture x86_64:
"_ERR_put_error", referenced from:
_be_tls_open_server in be-secure-openssl.o
"_SSL_get_peer_certificate", referenced from:
_be_tls_open_server in be-secure-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[2]: *** [postgres] Error 1
make[1]: *** [all-backend-recurse] Error 2
make: *** [all-src-recurse] Error 2
Solutions
-
If MacPorts is installed (but not used) it should be un-installed - Visit https://guide.macports.org/chunked/installing.macports.uninstalling.html for more detail.
-
Clear out
$TMPDIR/postgres*
directories before re-attempting to runasdf install
by runningsudo rm -rf $TMPDIR/postgres*
-
Run a
gdk doctor
to ensure there are no warnings. -
Once MacPorts is removed, you may discover some gems don't function properly (e.g.
ffi
). The best solution here is to re-install required Rubies:cd <GDK_ROOT> for version in $(grep ^ruby .tool-versions | awk -F 'ruby ' '{ print $2 }'); do echo "asdf uninstall ${version} ; asdf install ${version}"; done
Actions
- Create a
gdk doctor
check to look for MacPorts and warn - #1362 (closed) - Make all
gdk <commands>
work in a more 'clean' environment by prefixing commands withenv -i
where possible to ensure the variables that an individual's machine may have, doesn't impact on operation.
Environment (optional)
- Operating system: macOS