chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Static binaries with openssl on MacOS


From: Nicholas Van Horn
Subject: Static binaries with openssl on MacOS
Date: Wed, 29 Sep 2021 20:14:38 +0000

Hi all!

I have a project that uses the OpenSSL egg. The code base historically ran fine. It runs both in interpreted fashion as well as compiled. It runs on both linux and MacOS, and has for several years. However, after updating to Chicken 5+ I am no longer able to build static binaries on MacOS (which I use for distributing the program). On linux I have no issues. The problem clearly arises from Mac's abandonment of OpenSSL for its own tooling. But this has been the case for some time, and I've already overcome this before. The issue appears to be a linker problem during compile time, likely due to how static binaries are handled in v5+. Here's my current setup:

MacOS 11.6 (Big Sur)
Chicken 5.2.0
OpenSSL installed via homebrew

My code runs just fine in interpreted mode (csi -s myprogram.scm). My goal is to compile to static binary. I use the following on linux to successfully achieve this:

csc -static myprogram.scm -L -lssl -L -lcrypto -o myprogram

On my mac I receive the following error:

ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Things I've tried (from the recommendation that homebrew outputs after installing openssl):

export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

I have also followed the advice of a previous mailing list response from 2019 that specified how to get openssl working on MacOS:

brew install openssl
export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"
chicken-install openssl

This has been what I've used to get the openssl egg working on a Mac. However, this doesn't seem to address the static compilation problem I'm encountering.

Any help would be GREATLY appreciated.

Thanks,
Nick


reply via email to

[Prev in Thread] Current Thread [Next in Thread]