JPaulMora / Pyrit

The famous WPA precomputed cracker, Migrated from Google.
GNU General Public License v3.0
1.04k stars 271 forks source link

fatal error: 'openssl/hmac.h' file not found #640

Closed Tagz133 closed 1 year ago

Tagz133 commented 1 year ago

I've been at this for a few days now and I still can't find any solutions. I've tried the solutions provided in similar issues posted but nothing has worked so far. When I execute the command sudo python2 setup.py build I get the error message:

1 error generated.
Failed to build; Compiling without AES-NI
building 'cpyrit._cpyrit_cpu' extension
clang -fno-strict-aliasing -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/{myuser}/.pyenv/versions/2.7.18/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.macosx-13.0-arm64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION="0.5.0"
cpyrit/_cpyrit_cpu.c:35:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1

I am using an M2 Macbook Pro 2022 13-inch model on MacOS Ventura 13.0.1 (22A400) in case that helps.

vido89 commented 1 year ago

https://github.com/servo/servo/issues/15293

Tagz133 commented 1 year ago

servo/servo#15293

I used the commands

export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include"
export OPENSSL_LIB_DIR="$(brew --prefix openssl)/lib"

But when trying to build Pyrit (using sudo python2 setup.py build), I receive the same error.

vido89 commented 1 year ago

do you have installed libpcap-dev and libssl-dev not sure is that correct name form MacOS

Tagz133 commented 1 year ago

On MacOS I'm sure libpcap-dev is acutally libpcap but I'm unsure of what the MacOS alternative of libssl-dev is. I have openssl which seems to contain libssl so in the end I do have both libpcap-dev and libssl-dev but the MacOS versions.

Tagz133 commented 1 year ago

I found the solution. When I ran brew info openssl I got my answer:

openssl@3 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.

If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@3 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"

For pkg-config to find openssl@3 you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"

So I ran the commands for compilers to find openssl@3 and it worked!