I downloaded root_v6.26.00.source.tar.gz and attempted to build it on my MacOS Monterey using cmake (cmake version 3.22.2) option:
cmake -DCMAKE_INSTALL_PREFIX=/Users/jade/thirdParty/root-6.26.00/build-artifact -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -Droot7=ON ..
but when attempting to build it, I get this compilation error:
/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,
^
During cmake configuration, it picked up openssl3:
– Found OpenSSL: /opt/local/libexec/openssl3/lib/libcrypto.dylib (found version “3.0.1”)
So I figured that root won’t build with a newer openssl but I can’t downgrade the default version of openssl since other tools are dependent on openssl3. I do still have older openssl (1.1.1m) still present on my system but on a different directory. So I attempted to set the cmake configuration to reference the older openssl (1.1.1m) version instead of the default openssl3:
cmake -DCMAKE_INSTALL_PREFIX=/Users/jade/thirdParty/root-6.26.00/build-artifact -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -Droot7=ON -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl11/include -DOPENSSL_CRYPTO_LIBRARY=/opt/local/libexec/openssl11/lib/libcrypto.dylib -DOPENSSL_SSL_LIBRARY=/opt/local/libexec/openssl11/lib/libssl.dylib ..
But despite using these cmake openssl options, the configuration log noted this:
– Found OpenSSL: /opt/local/libexec/openssl11/lib/libcrypto.dylib (found version “3.0.1”)
It is pointed to the correct and older version of openssl library but notes the wrong version.
So I then tried the other cmake option -DOPENSSL_ROOT_DIR
:
cmake -DCMAKE_INSTALL_PREFIX=/Users/jade/thirdParty/root-6.26.00/build-artifact -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -Droot7=ON -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl11/ ..
With the above cmake option, during its configuration, it finally recognized the correct version of openssl:
– Found OpenSSL: /opt/local/libexec/openssl11/lib/libcrypto.dylib (found version “1.1.1m”)
But when I build it I get the same compilation error:
/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,
^
I don’t know why when it compiles XrdCryptosslRSA.cc
it’s still referencing headers at /opt/local/include/openssl
(which is pointed to openssl3):
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
as I noted earlier, I really don’t want to redirect where /opt/local/include/openssl
points to, since other tools are dependent on it.
I specifically set the cmake configuration to reference openssl root at /opt/local/libexec/openssl11
, which has the include & lib:
jade$ ls -l /opt/local/libexec/openssl11
total 0
drwxr-xr-x 4 root admin 128 Mar 5 18:46 bin
drwxr-xr-x 3 root admin 96 Mar 5 18:46 etc
drwxr-xr-x 3 root admin 96 Mar 5 18:46 include
drwxr-xr-x 10 root admin 320 Mar 5 18:46 lib
drwxr-xr-x 4 root admin 128 Mar 5 18:46 share
I don’t know why during compilation it’s not picking up the specified header version of openssl during cmake’s configuration. What am I doing wrong here? How can I get root source to build against openssl 1.1.1m, while leaving the default openssl in my system pointed to openssl3 (since root fails to compile against openssl3)?
I’ve attached the configuration log from the last cmake options and its compilation error log
myconfig.txt (12.3 KB)
XROOTD-build-err.txt (62.8 KB)
Finally I notice that in the configuration log, it notes (despite finding pthread):
– Threads disabled.
How do I enable this? I tried to look in the root cmake options documented here, but the only options that refers to threading is imt
which by default is on. But even when I added -Dimt=ON
explicitly, doesn’t seem to make a different (Threads still disabled).