fatal error: openssl/conf.h: No such file or directory | Home-brew OpenSSL on MacOS
1
vote
0
answers
2123
views
Question
=
It seems like **gcc can't read the headers in the include folder** of OpeenSSL. Shouldn't the flags I added in the
~/.zprofile
help with finding that, though?
What am I missing?
---
Original Task
-
Compile this C program . It will use OpenSSL to encrypt/decrypt using AES-256-GCB.
Issue
-
When I try to run
gcc Evp-gcm-encrypt.c -o Evp-gcm-encrypt
I get
Evp-gcm-encrypt.c:1:10: fatal error: openssl/conf.h: No such file or directory
1 | #include
| ^~~~~~~~~~~~~~~~
compilation terminated.
What I tried
-
1. I **installed OpenSSL** through Home-brew.
brew update
brew install openssl@1.1
2. Added such lines both in my **~/.zprofile** and **~/.zshrc**
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
3. Removed and re-installed the **Xcode command-line-tools**
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
4. Deactivated **Anaconda's OpenSSL** (it was being executed before the home-brew version)
conda deactivate
5. **Linking** OpenSSL
brew link --force openssl
but I get
Error: No such keg: /usr/local/Cellar/openssl
6. **Linking** OpenSSL@1.1
brew link --force openssl@1.1
but I get
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
System info
-
1. MacOS 12.5.1 (Monterey)
2. MacBook Air (Retina, 13-inch, 2018)
3. SIP disabled
4. Security set to none
Asked by FET
(844 rep)
Oct 25, 2022, 12:43 PM