Print

Print


@simonmichal, I don't know if you've read the details I already provided on that root forum post, but I encourage you to read it because I have done all that you are suggesting here and it's still failing to compile.  I really don't want to repeat all that I have posted there (as @axel suggested to just refer you guys to what has already been posted there). 
 I understand it's a long post, but I provided above specified links where I have done what you've suggested, [like here](https://root-forum.cern.ch/t/building-from-source-root-v6-26-00-failing-with-openssl-on-macos-monterey/49078/9).  I also [provided root cause here](https://root-forum.cern.ch/t/building-from-source-root-v6-26-00-failing-with-openssl-on-macos-monterey/49078/10).

[As I noted here](https://root-forum.cern.ch/t/building-from-source-root-v6-26-00-failing-with-openssl-on-macos-monterey/49078/12), I did manually build xrootd from the version that root downloaded, where I just triggered the cmake command using the same cmake options that root was passing to xrootd (via `ExternalProject_Add`), from the location root downloaded xrootd.  The xrootd version that root downloaded was:
```
jade$ cat VERSION_INFO 
RefNames:  (tag: v5.4.1)
ShortHash: d21f09ce911
Date: 2022-02-21 11:10:10 +0100
```

That cmake command that was manually passed to xrootd (and the same command that root was passing after @axel suggested the addition of cmake's openssl options to point xrootd to an older version of openssl -- the same options you suggested) was:
```
cmake -DCMAKE_INSTALL_PREFIX=/Users/jade/thirdParty/root-6.26.00/build-dir/builtins/xrootd/XROOTD-prefix -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl11/include -DOPENSSL_SSL_LIBRARY=/opt/local/libexec/openssl11/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARY=/opt/local/libexec/openssl11/lib/libcrypto.dylib -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DCMAKE_C_FLAGS="-m64 -pipe -W -Wall -fsigned-char -fno-common -Qunused-arguments -pthread" -DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCMAKE_CXX_FLAGS="-std=c++17 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++" -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -DENABLE_PYTHON=OFF -DENABLE_CEPH=OFF -DCMAKE_INSTALL_RPATH:STRING=/Users/jade/thirdParty/root-6.26.00/build-dir/builtins/xrootd/XROOTD-prefix/lib ../XROOTD
```
where I have noted at the root forum post that that command does recognize the openssl version 1.1.1m:

> -- Found OpenSSL: /opt/local/libexec/openssl11/lib/libssl.dylib;/opt/local/libexec/openssl11/lib/libcrypto.dylib  

And yet despite having provided `-DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl11/include` in that cmake command, when compiling, it's still picking up openssl headers at the wrong location:
```
/Users/jade/thirdParty/root-6.26.00/build-dir/builtins/xrootd/XROOTD-prefix/src/XROOTD/src/XrdCrypto/XrdCryptosslRSA.cc:504:19: error: no matching function for call to 'RSA_private_encrypt'
      if ((lout = RSA_private_encrypt(lc, (unsigned char *)&in[kk],
                  ^~~~~~~~~~~~~~~~~~~
/opt/local/include/openssl/rsa.h:285:5: note: candidate function not viable: 4th argument ('const struct rsa_st *') would lose const qualifier
int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
    ^
```
As noted above it's picking up openssl headers at `/opt/local/include` instead of `/opt/local/libexec/openssl11/include`, because when it compiles, **it orders the includes putting `/opt/local/include` first before `/opt/local/libexec/openssl11/include`** and so picks up the openssl3 headers located at `/opt/local/include`.

When you say that you've tested with older versions of openssl, did you test it with **having multiple versions of openssl installed on your system**, where the default version is openssl3, and not the version you specifically specified to cmake?  Because that's the circumstances that I'm in, where I need the default openssl version to be openssl3 since I have other tools dependent on it.


Now I wish I can get this building against openssl3, but even after not specifying any openssl version in the cmake commands (just remove  `-DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl11/include -DOPENSSL_SSL_LIBRARY=/opt/local/libexec/openssl11/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARY=/opt/local/libexec/openssl11/lib/libcrypto.dylib` from the cmake command I provided above and **add `-DWITH_OPENSSL3=TRUE`**), even though during its configuration, it recognizes the openssl3 version:

> -- Found OpenSSL: /opt/local/lib/libssl.dylib;/opt/local/lib/libcrypto.dylib  

where the default openssl version on my system is:
```
jade$ openssl version
OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)
jade$ which openssl
/opt/local/bin/openssl
jade$ otool -L /opt/local/bin/openssl
/opt/local/bin/openssl:
	/opt/local/libexec/openssl3/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/libexec/openssl3/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

jade$ ls -l /opt/local/lib/libssl.dylib;
lrwxr-xr-x  1 root  admin  14 Dec 20 00:57 /opt/local/lib/libssl.dylib -> libssl.3.dylib
jade$ ls -l /opt/local/lib/libssl.3.dylib
lrwxr-xr-x  1 root  admin  46 Dec 20 00:57 /opt/local/lib/libssl.3.dylib -> /opt/local/libexec/openssl3/lib/libssl.3.dylib

jade$ ls -l /opt/local/lib/libcrypto.dylib
lrwxr-xr-x  1 root  admin  17 Dec 20 00:57 /opt/local/lib/libcrypto.dylib -> libcrypto.3.dylib
jade$ ls -l /opt/local/lib/libcrypto.3.dylib
lrwxr-xr-x  1 root  admin  49 Dec 20 00:57 /opt/local/lib/libcrypto.3.dylib -> /opt/local/libexec/openssl3/lib/libcrypto.3.dylib

jade$ ls -l /opt/local/include/openssl
lrwxr-xr-x  1 root  admin  43 Dec 20 00:57 /opt/local/include/openssl -> /opt/local/libexec/openssl3/include/openssl
```

It still fails to compile:
```
/Users/jade/thirdParty/root-6.26.00/build-dir/builtins/xrootd/XROOTD-prefix/src/XROOTD/src/XrdSec/openssl3/XrdSecProtect.cc:57:8: error: unknown type name 'EVP_MD_CTX'
static EVP_MD_CTX* EVP_MD_CTX_new() {
       ^
/Users/jade/thirdParty/root-6.26.00/build-dir/builtins/xrootd/XROOTD-prefix/src/XROOTD/src/XrdSec/openssl3/XrdSecProtect.cc:58:3: error: unknown type name 'EVP_MD_CTX'
  EVP_MD_CTX *ctx = (EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX));
  ...
  ```

BTW if I don't add `-DWITH_OPENSSL3=TRUE` (e.g. zero hints of openssl version passed to cmake) even though the default version of openssl is openssl3, I'd get the same error when specifying the older version of openssl in the cmake command.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/issues/1649#issuecomment-1068302397
You are receiving this because you are subscribed to this thread.

Message ID: <[log in to unmask]>
########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1