Can't build latest libcurl on RHEL 7.3 - gcc

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

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.

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.

Related

Download and move file only if it does not exist on destination directory, otherwise do nothing

I am trying to install an executable command (terraform) by downloading the zip file, then extract it to the ~/bin directory using a Makefile.
I would like to do this only if the terraform file is not already there.
According to the GNU Make docs I think I should use an "order-only prerequisite" with a pipe | (https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types) although I don't completely understand that documentation.
I've written the following target rule with the purpose of running it as make install-tf, when the file ~/bin/terraform being already there, then doing nothing and returning. However this does not work as expected and I keep seeing the body of that target rule being executed no matter the file is already there.
What's wrong with the following target?
How could I install terraform only if the command is not already there using a Makefile?
This is the target:
TERRAFORM_VERSION=0.11.11
install-tf: | ~/bin/terraform
echo "Installing terraform version ${TERRAFORM_VERSION}"
mkdir -p ~/tmp/
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P ~/tmp/
mkdir -p ~/bin/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ~/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=~/bin/:$$PATH terraform --version
What's wrong with the following target?
The target is install-tf. make install-tf will always run the recipe to make this
target if no such file as install-tf exists. The recipe never creates
that file. Therefore the recipe will always be run.
You require a recipe to make the file $(HOME)/bin/terraform if and only if it
does not exist. To a first approximation, this will do it:
Makefile (1)
TERRAFORM_VERSION=0.11.11
$(HOME)/bin/terraform:
echo "Installing terraform version ${TERRAFORM_VERSION}"
mkdir -p $(HOME)/tmp/
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P $(HOME)/tmp/
mkdir -p $(HOME)/bin/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d $(HOME)/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=$(HOME)/bin/:$$PATH terraform --version
which runs first time like:
$ make
echo "Installing terraform version 0.11.11"
Installing terraform version 0.11.11
mkdir -p /home/imk/tmp/
wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip -P /home/imk/tmp/
--2019-01-29 11:09:11-- https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.17.183, 2a04:4e42:4::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.17.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20971661 (20M) [application/zip]
Saving to: ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip’
terraform_0.11.11_l 100%[===================>] 20.00M 8.86MB/s in 2.3s
2019-01-29 11:09:14 (8.86 MB/s) - ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip’ saved [20971661/20971661]
mkdir -p /home/imk/bin/
unzip ~/tmp/terraform_0.11.11_linux_amd64.zip -d /home/imk/bin/
Archive: /home/imk/tmp/terraform_0.11.11_linux_amd64.zip
inflating: /home/imk/bin/terraform
echo "Done installing terraform version 0.11.11"
Done installing terraform version 0.11.11
PATH=/home/imk/bin/:$PATH terraform --version
Terraform v0.11.11
and second time like:
$ make
make: '/home/imk/bin/terraform' is up to date.
And with a little improvement:
Makefile (2)
TERRAFORM_VERSION := 0.11.11
.PHONY: all clean
all: $(HOME)/bin/terraform
$(HOME)/bin/terraform: | $(HOME)/tmp/ $(HOME)/bin/
echo "Installing terraform version ${TERRAFORM_VERSION}"
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P $(HOME)/tmp/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d $(HOME)/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=$(HOME)/bin/:$$PATH terraform --version
$(HOME)/tmp/ $(HOME)/bin/:
mkdir -p $#
clean:
$(RM) $(HOME)/bin/terraform
which runs like:
$ make clean
rm -f /home/imk/bin/terraform
$ make
echo "Installing terraform version 0.11.11"
Installing terraform version 0.11.11
wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip -P /home/imk/tmp/
--2019-01-29 11:38:32-- https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.17.183, 2a04:4e42:4::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.17.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20971661 (20M) [application/zip]
Saving to: ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip.1’
terraform_0.11.11_l 100%[===================>] 20.00M 8.88MB/s in 2.3s
2019-01-29 11:38:34 (8.88 MB/s) - ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip.1’ saved [20971661/20971661]
unzip ~/tmp/terraform_0.11.11_linux_amd64.zip -d /home/imk/bin/
Archive: /home/imk/tmp/terraform_0.11.11_linux_amd64.zip
inflating: /home/imk/bin/terraform
echo "Done installing terraform version 0.11.11"
Done installing terraform version 0.11.11
PATH=/home/imk/bin/:$PATH terraform --version
Terraform v0.11.11
$ make
make: Nothing to be done for 'all'.
Note the use of order-only prerequisites in:
$(HOME)/bin/terraform: | $(HOME)/tmp/ $(HOME)/bin/
That says: Before considering whether the target $(HOME)/bin/terraform is out of date, make $(HOME)/tmp/ and $(HOME)/bin.
Then consider whether $(HOME)/bin/terraform is out of date but do not count $(HOME)/tmp/ or $(HOME)/bin as prerequisites.
See also 4.6 Phony Targets

Problems with compilation ICU with MinGW-w64 on Windows

I tried to compile ICU 59.1 with MinGW-w64 according to Qt manual (MinGW-64-bit). Unfortunately, I got the following error:
$ make && make install
rebuilding config/icucross.mk
rebuilding config/icucross.inc
cd ./config; \
make -f pkgdataMakefile
make[1]: вход в каталог «/c/Qt-deps/icu-59_1/source/config»
*** ERROR - configure could not detect your platform
*** see the readme.html
*** or, try copying icu/source/config/mh-linux to mh-unknown
*** and editing it.
exit 1
rm -rf pkgdata.inc
make[1]: выход из каталога «/c/Qt-deps/icu-59_1/source/config»
rm -rf config/icu-config
/usr/bin/install -c ./config/icu-config-top config/icu-config
chmod u+w config/icu-config
LC_ALL=C /usr/bin/sed -f ./config/make2sh.sed < ./config/Makefile.inc | grep -v '#M#' | uniq >> config/icu-config
LC_ALL=C /usr/bin/sed -f ./config/make2sh.sed < ./config/mh-unknown | grep -v '#M#' | uniq >> config/icu-config
cat ./config/icu-config-bottom >> config/icu-config
chmod u-w config/icu-config
config/icu-uc.pc updated.
config/icu-i18n.pc updated.
config/icu-io.pc updated.
Note: rebuild with "make VERBOSE=1 " to show all compiler parameters.
/bin/sh ./mkinstalldirs lib
mkdir lib
/bin/sh ./mkinstalldirs bin
mkdir bin
make[0]: Making `all' in `stubdata'
make[1]: вход в каталог «/c/Qt-deps/icu-59_1/source/stubdata»
*** ERROR - configure could not detect your platform
*** see the readme.html
*** or, try copying icu/source/config/mh-linux to mh-unknown
*** and editing it.
exit 1
make[1]: выход из каталога «/c/Qt-deps/icu-59_1/source/stubdata»
make: *** [Makefile:147: all-recursive] Ошибка 2
I have tried to compile it twice on two different computers: the 1st one - Windows 10 Pro, the last one - Windows 7 Ultimate. Results are the same. Used tools: MSYS2 x64 (20161025). So, what am I doing wrong?
The error "configure could not detect your platform" can probably be fixed by passing the arguments --build=$MINGW_CHOST --host=$MINGW_CHOST to the configure script. If you are in the right type of MSYS2 shell, $MINGW_CHOST should be i686-w64-mingw32 or x86_64-w64-mingw32
For more useful tips for building ICU, look at the build script that the MSYS2 developers have crafted:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-icu
I have fixed the same issue (except that used ICU 55.1) replacing ../source/config/mh-unknown with the contents of ../source/config/mh-mingw64
I have build icu with same problem.
I have run this script for correct the problem:
del M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-unknow
copy M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-msys-msvc M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-unknow

During cppunit make install error for task install-m4DATA appeared

I've been building freedesktop cppunit with mingw
https://www.freedesktop.org/wiki/Software/cppunit/
I've made some fixes to source files and makefiles and been able to
successfully execute commmands:
./autogen.sh
./configure
make
without any errors.
There was a need to set
m4_DATA = m4
instead of value "cppunit.m4" in Makefile.am(there was no such dir in build and it looks like such dir is "m4" dir).
After successful make execution doing
make --debug install
failed with error:
File install-m4DATA not found
from Makefile.am:
m4dir = $(datadir)/aclocal //what is datadir btw?
automake generated Makefile task:
install-m4DATA: $(m4_DATA)
#$(NORMAL_INSTALL) // fails at this line
test -z "$(m4dir)" || $(MKDIR_P) "$(DESTDIR)$(m4dir)"
#list='$(m4_DATA)'; test -n "$(m4dir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(m4dir)" || exit $$?; \
done
before that task NORMAL_INSTALL is set to:
NORMAL_INSTALL = :
How to fix "make install" execution.
Will it work if i have only mingw envieronment on my PC?
Version is 1.13.2 fresh from git repo.
I also post lines from "make --debug install" output
File 'install-m4DATA' does not exist.
Must remake target 'install-m4DATA'.
test -z "/usr/local/share/aclocal" || /usr/bin/mkdir -p "/usr/local/share/aclocal"
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Makefile:432: recipe for target 'install-m4DATA' failed
make[2]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:799: recipe for target 'install-am' failed
make[1]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:479: recipe for target 'install-recursive' failed
It also prints that that script omits directory at line
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Possibly here must go files from directory but not directory itself.
How to fix it to do that(i'm not familiar with Makefiles and bash)?

libtoolize: error: cannot list files

I was installing libtool 2.4.6 and ran into the following problem:
libtool: Version mismatch error. This is libtool 2.4.6, revision 2.4.6,
libtool: but the definition of this LT_INIT comes from revision .
libtool: You should recreate aclocal.m4 with macros from revision 2.4.6
libtool: of libtool 2.4.6 and run autoconf again.
Makefile:1261: recipe for target 'libltdl/loaders/libltdl_libltdl_la-preopen.lo' failed
In an effort to fix this issue and after looking around on google, I executed the following command to recreate aclocal.m4. however, I got "cannot list files" error:
[server]# autoreconf --install
libtoolize: error: cannot list files: '/var/tmp/work/libtool-2.4.6.i386/share/libtool/build-aux'
autoreconf: libtoolize failed with exit status: 1
the directory was there and can be listed with ls command:
[server]# ls -l /var/tmp/work/libtool-2.4.6.i386/share/libtool/build-aux
total 0
Any idea?
this was cause by the line in libtoolize script:
test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
|| func_fatal_error "cannot list files: '$my_dir'"
I don't know why it interpret a empty directory as "cannot list files"
the issue can be overcome by replacing the above line with:
cd $my_dir && ls || func_fatal_error "cannot list files: '$my_dir'"

pkg-config: PKG_PROG_PKG_CONFIG: command not found

I get the following error
./configure: line 11162: PKG_PROG_PKG_CONFIG: command not found
when this is code is executed in (kivy-ios/tools-build-sdlmixer.sh)
if [ ! -f libtremor/tremor/.libs/libvorbisidec.a ]; then
try cd libtremor/tremor
echo > asm_arm.h
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS" \
OGG_CFLAGS="-I../../libogg/include" \
OGG_LDFLAGS="-L../../libogg/src/.libs" \
PKG_CONFIG_LIBDIR="../../libogg" \
ACLOCAL_FLAGS="-I $DESTROOT/share/aclocal -I `aclocal --print-ac-dir`" ./autogen.sh \
--prefix=$DESTROOT \
--disable-shared \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no
try make
try make install
try cd ../..
fi
My pkg-config application is in my PATH (/usr/local/bin). I've also tried exporting PKG_CONFIG_PATH on my command line to /usr/local/bin/pkg-config and /usr/local/lib/pkgconfig. I've tried exporting LD_LIBRARY_PATH to various paths as well (not sure where it should point to tbh), and that doesn't seem to help either.
I read something about multiple aclocal directories on my system, which could be problematic, but its not clear to me how to resolve that or determine its the issue.
This linux build newbie (on OSX) appreciates any help.
When that script calls autogen.sh, aclocal is failing to find pkg.m4, an M4 macro package that comes with pkg-config and provides the PKG_PROG_PKG_CONFIG macro. Where is pkg-config installed, and what directories is aclocal searching?
Had the same issue with linux Alpine for an DockerImage.
Solved it by installing autoconf, automake and pkgconf:
apk --update add autoconf automake build-base libtool nasm pkgconf

Resources