John Kaster
John Kaster

Reputation: 2607

Can't build latest libcurl on RHEL 7.3

What's the proper way to fix this compilation error so I can install the latest libcurl on RHEL 7.3?

I've been able to get the latest openssl, build, and install it. OpenSSL 1.1.1-dev xx XXX xxxx is reported by openssl version now. Latest curl is cloned/pulled from https://github.com/curl/curl.git. Here's the bash script fragment I'm using:

CD=$(pwd)
CPPFLAGS="-I$CD/zlib -I$CD/openssl -I$CD/openssl/include" 
LDFLAGS="-L$CD/zlib -L$CD/openssl" 
LIBS="-ldl" 
cd curl
./buildconf
./configure --disable-shared --with-zlib --with-ssl
make
make install

Running the batch with sudo, make completes without errors. make install produces this:

  CC       libcurl_la-openssl.lo
vtls/openssl.c: In function 'Curl_ossl_seed':
vtls/openssl.c:279:5: error: implicit declaration of function 'RAND_egd' [-
Werror=implicit-function-declaration]
   int ret = RAND_egd(data->set.str[STRING_SSL_EGDSOCKET]?
   ^
cc1: some warnings being treated as errors
make[2]: *** [libcurl_la-openssl.lo] Error 1
make[2]: Leaving directory `/home/john/curl/lib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/john/curl/lib'
make: *** [all-recursive] Error 1

Upvotes: 1

Views: 2194

Answers (2)

Jerry
Jerry

Reputation: 3586

RAND_egd() is no longer part of the default OpenSSL install. See this git commit. You can fix the problem by adding enable-egd in the configure command.

Upvotes: 4

John Kaster
John Kaster

Reputation: 2607

Edit: Updated with cleaner version Here's steps for building curl with the latest openssl

CD=$(pwd)
echo Setting up openssl
if [ ! -d openssl ]; then
    git clone https://github.com/openssl/openssl.git
    cd openssl
else
    cd openssl
    git pull
fi
# you may not need -Wl,--enable-new-dtags but it works for me
./config -Wl,--enable-new-dtags --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make depend
make 
sudo make install
cd ..

lib=zlib-1.2.11
echo Setting up zlib
if [ ! -d zlib ]; then
    wget http://zlib.net/$lib.tar.gz
    tar xzvf $lib.tar.gz
    mv $lib zlib
fi
cd zlib
./configure
make
cd ..

echo Setting up curl ...
CD=$(pwd)

if [ ! -d curl ]; then
    git clone https://github.com/curl/curl.git
    cd curl
else
    cd curl
    git pull
fi

cd curl
./buildconf
PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig LIBS="-ldl" ./configure --with-
zlib=$CD/zlib --disable-shared
make
# I use local curl build without installing it
# make install
cd ..

I sincerely hope this helps someone else.

Upvotes: 3

Related Questions