Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3.12k stars 855 forks source link

[BUG] - openssl/evp.h' file not found when compiling on MacBook Pro ARM #3051

Closed jean-michel-gonet closed 1 month ago

jean-michel-gonet commented 1 month ago

Describe the bug I've followed the procedure described here:

But got this error:

In file included from /Users/jmgonet/Documents/Dev/srt/haicrypt/cryspr.c:20:
In file included from /Users/jmgonet/Documents/Dev/srt/haicrypt/hcrypt.h:48:
In file included from /Users/jmgonet/Documents/Dev/srt/haicrypt/cryspr.h:39:
In file included from /Users/jmgonet/Documents/Dev/srt/haicrypt/cryspr-config.h:13:
/Users/jmgonet/Documents/Dev/srt/haicrypt/cryspr-openssl-evp.h:22:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h> /* PKCS5_xxx() */

To Reproduce Steps to reproduce the behavior:

  1. On a MacBook Pro, with ARM architecture (see description below)
  2. Using this installation procesure:
    brew update
    brew upgrade
    brew install srt
    brew install openssl
    brew install cmake
    export OPENSSL_ROOT_DIR=$(brew --prefix openssl)
    export OPENSSL_LIB_DIR=$(brew --prefix openssl)"/lib"
    export OPENSSL_INCLUDE_DIR=$(brew --prefix openssl)"/include"
    git clone https://github.com/Haivision/srt.git
    cd srt
    ./configure
    make
  3. Compilation works until 51% is reached, and then the compilation error described above shows up.

Expected behavior When following the procedure it should compile.

Desktop (please provide the following information):

maxsharabayko commented 1 month ago

Which OpenSSL version get installed (brew info openssl)? Could you check if openssl/evp.h is present in $(brew --prefix openssl)"/include"?

jean-michel-gonet commented 1 month ago

About the version of OpenSSL, it's the 3.3.2:

> brew info openssl
==> openssl@3: stable 3.3.2 (bottled)
Cryptography and SSL/TLS Toolkit
https://openssl-library.org
Installed
/opt/homebrew/Cellar/openssl@3/3.3.2 (6,984 files, 32.5MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-10-14 at 18:52:22
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/openssl@3.rb
License: Apache-2.0
==> Dependencies
Required: ca-certificates ✔
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /opt/homebrew/etc/openssl@3/certs

and run
  /opt/homebrew/opt/openssl@3/bin/c_rehash
==> Analytics
install: 416,323 (30 days), 1,225,218 (90 days), 4,977,077 (365 days)
install-on-request: 57,050 (30 days), 151,185 (90 days), 648,139 (365 days)
build-error: 3,554 (30 days)

About the content of the include folder, yes, it contains the header file:

> echo $OPENSSL_INCLUDE_DIR
/opt/homebrew/opt/openssl@3/include
> ls -l /opt/homebrew/opt/openssl@3/include
total 0
drwxr-xr-x  141 myself  admin  4512 Sep  3 14:46 openssl
> ls -l /opt/homebrew/opt/openssl@3/include/openssl
-rw-r--r--  1 myself  admin    3752 Sep  3 14:46 aes.h
-rw-r--r--  1 myself  admin   61109 Sep  3 14:46 asn1.h
-rw-r--r--  1 myself  admin     398 Sep  3 14:46 asn1_mac.h
-rw-r--r--  1 myself  admin    7855 Sep  3 14:46 asn1err.h
-rw-r--r--  1 myself  admin   35937 Sep  3 14:46 asn1t.h
-rw-r--r--  1 myself  admin    3504 Sep  3 14:46 async.h
-rw-r--r--  1 myself  admin     842 Sep  3 14:46 asyncerr.h
-rw-r--r--  1 myself  admin   45605 Sep  3 14:46 bio.h
-rw-r--r--  1 myself  admin    3515 Sep  3 14:46 bioerr.h
-rw-r--r--  1 myself  admin    2693 Sep  3 14:46 blowfish.h
-rw-r--r--  1 myself  admin   24183 Sep  3 14:46 bn.h
-rw-r--r--  1 myself  admin    1949 Sep  3 14:46 bnerr.h
-rw-r--r--  1 myself  admin    1658 Sep  3 14:46 buffer.h
-rw-r--r--  1 myself  admin     594 Sep  3 14:46 buffererr.h
-rw-r--r--  1 myself  admin    5069 Sep  3 14:46 camellia.h
-rw-r--r--  1 myself  admin    2066 Sep  3 14:46 cast.h
-rw-r--r--  1 myself  admin    1608 Sep  3 14:46 cmac.h
-rw-r--r--  1 myself  admin   43939 Sep  3 14:46 cmp.h
-rw-r--r--  1 myself  admin    1742 Sep  3 14:46 cmp_util.h
-rw-r--r--  1 myself  admin    6732 Sep  3 14:46 cmperr.h
-rw-r--r--  1 myself  admin   35067 Sep  3 14:46 cms.h
-rw-r--r--  1 myself  admin    6731 Sep  3 14:46 cmserr.h
-rw-r--r--  1 myself  admin    1674 Sep  3 14:46 comp.h
-rw-r--r--  1 myself  admin    1254 Sep  3 14:46 comperr.h
-rw-r--r--  1 myself  admin   10673 Sep  3 14:46 conf.h
-rw-r--r--  1 myself  admin    1420 Sep  3 14:46 conf_api.h
-rw-r--r--  1 myself  admin    2265 Sep  3 14:46 conferr.h
-rw-r--r--  1 myself  admin    3818 Sep  3 14:46 configuration.h
-rw-r--r--  1 myself  admin    1190 Sep  3 14:46 conftypes.h
-rw-r--r--  1 myself  admin    8177 Sep  3 14:46 core.h
-rw-r--r--  1 myself  admin   50341 Sep  3 14:46 core_dispatch.h
-rw-r--r--  1 myself  admin   23211 Sep  3 14:46 core_names.h
-rw-r--r--  1 myself  admin    1126 Sep  3 14:46 core_object.h
-rw-r--r--  1 myself  admin   14732 Sep  3 14:46 crmf.h
-rw-r--r--  1 myself  admin    2011 Sep  3 14:46 crmferr.h
-rw-r--r--  1 myself  admin   24175 Sep  3 14:46 crypto.h
-rw-r--r--  1 myself  admin    2467 Sep  3 14:46 cryptoerr.h
-rw-r--r--  1 myself  admin   80396 Sep  3 14:46 cryptoerr_legacy.h
-rw-r--r--  1 myself  admin   22710 Sep  3 14:46 ct.h
-rw-r--r--  1 myself  admin    1688 Sep  3 14:46 cterr.h
-rw-r--r--  1 myself  admin    5760 Sep  3 14:46 decoder.h
-rw-r--r--  1 myself  admin     791 Sep  3 14:46 decodererr.h
-rw-r--r--  1 myself  admin    8525 Sep  3 14:46 des.h
-rw-r--r--  1 myself  admin   15475 Sep  3 14:46 dh.h
-rw-r--r--  1 myself  admin    2570 Sep  3 14:46 dherr.h
-rw-r--r--  1 myself  admin   12532 Sep  3 14:46 dsa.h
-rw-r--r--  1 myself  admin    1629 Sep  3 14:46 dsaerr.h
-rw-r--r--  1 myself  admin    1465 Sep  3 14:46 dtls1.h
-rw-r--r--  1 myself  admin    8825 Sep  3 14:46 e_os2.h
-rw-r--r--  1 myself  admin    1188 Sep  3 14:46 e_ostime.h
-rw-r--r--  1 myself  admin    1042 Sep  3 14:46 ebcdic.h
-rw-r--r--  1 myself  admin   68440 Sep  3 14:46 ec.h
-rw-r--r--  1 myself  admin     361 Sep  3 14:46 ecdh.h
-rw-r--r--  1 myself  admin     361 Sep  3 14:46 ecdsa.h
-rw-r--r--  1 myself  admin    5405 Sep  3 14:46 ecerr.h
-rw-r--r--  1 myself  admin    5450 Sep  3 14:46 encoder.h
-rw-r--r--  1 myself  admin     791 Sep  3 14:46 encodererr.h
-rw-r--r--  1 myself  admin   38823 Sep  3 14:46 engine.h
-rw-r--r--  1 myself  admin    2838 Sep  3 14:46 engineerr.h
-rw-r--r--  1 myself  admin   22398 Sep  3 14:46 err.h
-rw-r--r--  1 myself  admin    8968 Sep  3 14:46 ess.h
-rw-r--r--  1 myself  admin    1144 Sep  3 14:46 esserr.h
-rw-r--r--  1 myself  admin  104390 Sep  3 14:46 evp.h
-rw-r--r--  1 myself  admin    7537 Sep  3 14:46 evperr.h
-rw-r--r--  1 myself  admin    2255 Sep  3 14:46 fips_names.h
-rw-r--r--  1 myself  admin    1010 Sep  3 14:46 fipskey.h
-rw-r--r--  1 myself  admin    2141 Sep  3 14:46 hmac.h
-rw-r--r--  1 myself  admin    6983 Sep  3 14:46 hpke.h
-rw-r--r--  1 myself  admin    5543 Sep  3 14:46 http.h
-rw-r--r--  1 myself  admin    2513 Sep  3 14:46 httperr.h
-rw-r--r--  1 myself  admin    3010 Sep  3 14:46 idea.h
-rw-r--r--  1 myself  admin    5619 Sep  3 14:46 kdf.h
-rw-r--r--  1 myself  admin     482 Sep  3 14:46 kdferr.h
-rw-r--r--  1 myself  admin   18441 Sep  3 14:46 lhash.h
-rw-r--r--  1 myself  admin   10738 Sep  3 14:46 macros.h
-rw-r--r--  1 myself  admin    1461 Sep  3 14:46 md2.h
-rw-r--r--  1 myself  admin    1699 Sep  3 14:46 md4.h
-rw-r--r--  1 myself  admin    1696 Sep  3 14:46 md5.h
-rw-r--r--  1 myself  admin    1441 Sep  3 14:46 mdc2.h
-rw-r--r--  1 myself  admin   10786 Sep  3 14:46 modes.h
-rw-r--r--  1 myself  admin  243695 Sep  3 14:46 obj_mac.h
-rw-r--r--  1 myself  admin    6848 Sep  3 14:46 objects.h
-rw-r--r--  1 myself  admin     782 Sep  3 14:46 objectserr.h
-rw-r--r--  1 myself  admin   29352 Sep  3 14:46 ocsp.h
-rw-r--r--  1 myself  admin    2200 Sep  3 14:46 ocsperr.h
-rw-r--r--  1 myself  admin     515 Sep  3 14:46 opensslconf.h
-rw-r--r--  1 myself  admin    3184 Sep  3 14:46 opensslv.h
-rw-r--r--  1 myself  admin     562 Sep  3 14:46 ossl_typ.h
-rw-r--r--  1 myself  admin    2809 Sep  3 14:46 param_build.h
-rw-r--r--  1 myself  admin    7328 Sep  3 14:46 params.h
-rw-r--r--  1 myself  admin   25870 Sep  3 14:46 pem.h
-rw-r--r--  1 myself  admin     531 Sep  3 14:46 pem2.h
-rw-r--r--  1 myself  admin    2634 Sep  3 14:46 pemerr.h
-rw-r--r--  1 myself  admin   20172 Sep  3 14:46 pkcs12.h
-rw-r--r--  1 myself  admin    1899 Sep  3 14:46 pkcs12err.h
-rw-r--r--  1 myself  admin   22659 Sep  3 14:46 pkcs7.h
-rw-r--r--  1 myself  admin    2952 Sep  3 14:46 pkcs7err.h
-rw-r--r--  1 myself  admin    1139 Sep  3 14:46 prov_ssl.h
-rw-r--r--  1 myself  admin    8527 Sep  3 14:46 proverr.h
-rw-r--r--  1 myself  admin    2733 Sep  3 14:46 provider.h
-rw-r--r--  1 myself  admin    2205 Sep  3 14:46 quic.h
-rw-r--r--  1 myself  admin    3983 Sep  3 14:46 rand.h
-rw-r--r--  1 myself  admin    3319 Sep  3 14:46 randerr.h
-rw-r--r--  1 myself  admin    2382 Sep  3 14:46 rc2.h
-rw-r--r--  1 myself  admin    1194 Sep  3 14:46 rc4.h
-rw-r--r--  1 myself  admin    2861 Sep  3 14:46 rc5.h
-rw-r--r--  1 myself  admin    1717 Sep  3 14:46 ripemd.h
-rw-r--r--  1 myself  admin   28478 Sep  3 14:46 rsa.h
-rw-r--r--  1 myself  admin    5681 Sep  3 14:46 rsaerr.h
-rw-r--r--  1 myself  admin   18439 Sep  3 14:46 safestack.h
-rw-r--r--  1 myself  admin    3964 Sep  3 14:46 seed.h
-rw-r--r--  1 myself  admin    4254 Sep  3 14:46 self_test.h
-rw-r--r--  1 myself  admin    4695 Sep  3 14:46 sha.h
-rw-r--r--  1 myself  admin   15487 Sep  3 14:46 srp.h
-rw-r--r--  1 myself  admin    2180 Sep  3 14:46 srtp.h
-rw-r--r--  1 myself  admin  138458 Sep  3 14:46 ssl.h
-rw-r--r--  1 myself  admin     658 Sep  3 14:46 ssl2.h
-rw-r--r--  1 myself  admin   15159 Sep  3 14:46 ssl3.h
-rw-r--r--  1 myself  admin   22449 Sep  3 14:46 sslerr.h
-rw-r--r--  1 myself  admin   26944 Sep  3 14:46 sslerr_legacy.h
-rw-r--r--  1 myself  admin    3284 Sep  3 14:46 stack.h
-rw-r--r--  1 myself  admin   15461 Sep  3 14:46 store.h
-rw-r--r--  1 myself  admin    2092 Sep  3 14:46 storeerr.h
-rw-r--r--  1 myself  admin    1290 Sep  3 14:46 symhacks.h
-rw-r--r--  1 myself  admin     871 Sep  3 14:46 thread.h
-rw-r--r--  1 myself  admin   72694 Sep  3 14:46 tls1.h
-rw-r--r--  1 myself  admin   10737 Sep  3 14:46 trace.h
-rw-r--r--  1 myself  admin   19760 Sep  3 14:46 ts.h
-rw-r--r--  1 myself  admin    3074 Sep  3 14:46 tserr.h
-rw-r--r--  1 myself  admin    1784 Sep  3 14:46 txt_db.h
-rw-r--r--  1 myself  admin    7316 Sep  3 14:46 types.h
-rw-r--r--  1 myself  admin   19251 Sep  3 14:46 ui.h
-rw-r--r--  1 myself  admin    1391 Sep  3 14:46 uierr.h
-rw-r--r--  1 myself  admin    1853 Sep  3 14:46 whrlpool.h
-rw-r--r--  1 myself  admin   72027 Sep  3 14:46 x509.h
-rw-r--r--  1 myself  admin   52515 Sep  3 14:46 x509_vfy.h
-rw-r--r--  1 myself  admin    3319 Sep  3 14:46 x509err.h
-rw-r--r--  1 myself  admin   94066 Sep  3 14:46 x509v3.h
-rw-r--r--  1 myself  admin    5005 Sep  3 14:46 x509v3err.h
jean-michel-gonet commented 1 month ago

When I execute the ./configure command, I get 1 warning, 0 errors:

CMake Warning (dev) at CMakeLists.txt:659 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "GNU" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

Not sure if it is related.

ethouris commented 1 month ago

No, this is irrelevant. Important is rather what cmake reports about detecting OpenSSL. Not sure what it is doing right now, but if you find the fragment from the configure log that refers to OpenSSL, might shed more light on it.

jean-michel-gonet commented 1 month ago

I checked what cmake was reporting related to openssl, and I saw the following section:

...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- BUILD TYPE: Release
...
-- SSL via find_package(OpenSSL): -I /usr/local/opt/openssl/include -l;/opt/homebrew/opt/openssl@3/lib/libssl.dylib;/opt/homebrew/opt/openssl@3/lib/libcrypto.dylib
-- ENCRYPTION: ENABLED, using: openssl libcrypto
-- SSL libraries: /opt/homebrew/opt/openssl@3/lib/libssl.dylib;/opt/homebrew/opt/openssl@3/lib/libcrypto.dylib
-- ENCRYPTION AEAD API: DISABLED
...

Although it didn't look like an error, the warning about PkgConfig was bothering me. I installed it via brew:

> brew install pkgconfig
> ./configure
> make

And this was a success! \(^o^)/

If I were paying more attention, I may have been able to spot the problem all by myself. However, I believe that the installation procedure could explicitly mention to install PkgConfig. I'm going to create a merge request about it.