I'm trying to install C++ web framework, drogon
, which requires following steps to install.
cd $WORK_PATH
git clone https://github.com/drogonframework/drogon
cd drogon
git submodule update --init
mkdir build
cd build
cmake ..
make && sudo make install
To install locally, I added the following command option,
cmake --install-prefix=$HOME/local
.
However, the make
process ended up like this,
/bin/ld: ../trantor/libtrantor.a(OpenSSLProvider.cc.o): in function `OpenSSLProvider::processHandshake()':
OpenSSLProvider.cc:(.text._ZN15OpenSSLProvider16processHandshakeEv[_ZN15OpenSSLProvider16processHandshakeEv]+0x504): undefined reference to `SSL_get1_peer_certificate'
/bin/ld: ../trantor/libtrantor.a(openssl.cc.o): in function `trantor::utils::md5(void const*, unsigned long)':
openssl.cc:(.text+0x35): undefined reference to `EVP_MD_fetch'
/bin/ld: openssl.cc:(.text+0xa1): undefined reference to `EVP_MD_free'
/bin/ld: ../trantor/libtrantor.a(openssl.cc.o): in function `trantor::utils::sha1(void const*, unsigned long)':
openssl.cc:(.text+0xfc): undefined reference to `EVP_MD_fetch'
/bin/ld: openssl.cc:(.text+0x168): undefined reference to `EVP_MD_free'
/bin/ld: ../trantor/libtrantor.a(openssl.cc.o): in function `trantor::utils::sha256(void const*, unsigned long)':
openssl.cc:(.text+0x1c0): undefined reference to `EVP_MD_fetch'
/bin/ld: openssl.cc:(.text+0x22c): undefined reference to `EVP_MD_free'
/bin/ld: ../trantor/libtrantor.a(openssl.cc.o): in function `trantor::utils::sha3(void const*, unsigned long)':
openssl.cc:(.text+0x284): undefined reference to `EVP_MD_fetch'
/bin/ld: openssl.cc:(.text+0x2f0): undefined reference to `EVP_MD_free'
/bin/ld: ../trantor/libtrantor.a(openssl.cc.o): in function `trantor::utils::blake2b(void const*, unsigned long)':
openssl.cc:(.text+0x348): undefined reference to `EVP_MD_fetch'
/bin/ld: openssl.cc:(.text+0x3b4): undefined reference to `EVP_MD_free'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/client.dir/build.make:105: examples/client] Error 1
make[1]: *** [CMakeFiles/Makefile2:293: examples/CMakeFiles/client.dir/all] Error 2
That error is because of the older OpenSSL version the system has, according to cmake
output.
Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
So I installed newest version (https://www.openssl.org/source/) local ($HOEM/.local
) as well.
The OpenSSL
installation was successful but when I tried the drogon
installation again, I got bounced off at the same step make
with same error.
Even cmake
produced the same output as above for the OpenSSL
path and its version.
My question is how do you make cmake
look for stuff locally ?
Like other installation process like ./configure
, you can add CFLAGS="-I/usr/local/include
option.
Is there similar method to cmake
?
In general it depends on how the CMake projects is searching for its dependencies. If the project uses find_package(<Package>)
, in many cases you can set a variable <Package>_ROOT
to point to the installation prefix of the package. In the case of OpenSSL you'll need to use OPENSSL_ROOT_DIR
as documented here.
So you need to configure the project with
cmake -DOPENSSL_ROOT_DIR=${HOME}/.local ..
after deleting the build directory.