'Cabal: Missing (or bad) C libraries: ssl, crypto
When I do cabal v2-build on macOS Monterey 12.3.1, I get the following error:
Failed to build hlibgit2-0.18.0.14. The failure occurred during the configure
step.
Build log ( /Users/user/.cabal/logs/ghc-8.10.7/hlbgt2-0.18.0.14-40f04fe4.log
):
Configuring library for hlibgit2-0.18.0.14..
cabal: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: ssl, crypto
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.If
the library files do exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
cabal: Failed to build hlibgit2-0.18.0.14 (which is required by
exe:app from app-0.0.0). See the build log above
for details.
What I tried so far:
All to no avail. Any help is appreciated.
Solution 1:[1]
Type which python3 to uncover where you have your python executable. In my case it is /usr/local/bin/python3 directory.
Your python file should contain a shebang referencing the executable as the first line in the file. So, for example:
#!/usr/local/bin/python3
Next, you must make sure that the file itself is executable.
Some files have different permissions (files can be read / write / execute and by different groups user / group / everyone). Execute on the terminal sudo chmod +x your_python_file.py.
Finally, you should add the directory where your file script is saved to your system $PATH.
In your terminal execute:
cd $HOME && mkdir bin
Put your python script in this bin directory. Then add the bin directory to your system $PATH by running:
export PATH="$HOME/bin:$PATH"
Solution 2:[2]
To make it executable without saying python first, put
#!/usr/bin/env python
as the first line and make the file executable.
To make it executable from any location, put the script in a directory that's in your $PATH environment variable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Barmar |
