Apache Httpd Build from source: fatal error: expat.h: No such file or directory - apache

I am trying to build Apache Server v 2.4.38 on RHEL 7.3 and I am using apr 1.6.5, apr-util 1.6.1, and pcre 8.42.
I am running following commands
./configure --with-included-apr --with-pcre=/data/abc/installed/pcre_installed --prefix=/data/abc/installed/httpd_installed
make
While running 'make' I am receiving error
/bin/sh /data/abc/installed/httpd-2.4.38/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/data/abc/installed/httpd-2.4.38/srclib/apr-util/include -I/data/abc/installed/httpd-2.4.38/srclib/apr-util/include/private -I/data/abc/installed/httpd-2.4.38/srclib/apr/include -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
#include <expat.h>

Download expat-2.2.6.tar.bz2 from https://libexpat.github.io/.
Extract expat using following command
tar xvjf expat-2.2.6.tar.bz2 -C /path-to-dir
Change to the extracted expat directory.
Build expat using following commands
./configure --prefix=/path-to-expat-installation-dir
make
make install
While building Apache Httpd from source specify --with-expat
./configure --with-included-apr --prefix=/path-to-apache-installation --with-expat=/path-to-expat-installation-dir

For anyone else coming across this:
OP had to do this because they didn't have sudo access. If you do, usually you don't need to download the source of expat manually; installing via package manager is way easier. Unless the software you are compiling requires a newer version of expat than your RPM repos provide.
So for the RHEL family of OSes you can just do sudo <dnf|yum> install expat expat-devel, then proceed with what you were compiling.

Do you have the expat library installed? (Because that's where the expat.h comes from.)
https://libexpat.github.io/
If you cannot install it globally to the system, I'm sure Apache's ./configure script must have an option to support a custom location for the library as well.

Tried In Ubuntu
apt install libexpat1-dev
For RHEL, I would suggest #cyqsimon's answer

Related

Installing janus-gateway error on CentOS7

I want to install janus-gateway on CentOS7.
I read the following document and tried installation.
https://github.com/meetecho/janus-gateway/blob/master/README.md
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
However, configuring janus-gateway will cause an error. The error is as follows.
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for JANUS... no
configure: error: Package requirements (
glib-2.0 >= 2.34
libconfig
nice
jansson >= 2.5
libssl >= 1.0.1
libcrypto
) were not met:
No package 'nice' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JANUS_CFLAGS
and JANUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I installed libnice(libnice-0.1.3-4.el7.x86_64) in the following way.
yum install libnice
How can I solve it?
Thank you.
try this and rebuild
echo "export PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> ~/.bashrc
source ~/.bashrc
Disclaimer: I am using Ubuntu 18.04 when testing this.
If you are using Ubuntu system and trying to install Janus and running this code
./configure --prefix=/opt/janus
And then getting this error: No package 'nice' found
Make sure you have been installation of the nice from aptitude.
sudo install aptitude
aptitude install libmicrohttpd-dev libjansson-dev \
libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
libconfig-dev pkg-config gengetopt libtool automake
For some reason installation of nice using the answer from Frank, Ahmet or Zallfire doesn't work in Ubuntu. It has to be installed using aptitude.
You should download libnice source code to install.
https://gitlab.freedesktop.org/libnice/libnice
You need the development libnice.
yum install libnice-devel

how to build apache httpd 2.* and beyond on msys2

httpd build on msys2 fails with the following error:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
On real linux distros, installing the expat-devel package seems to solve the problem see here,
more precisely, expat-devel is an apr-util prerequisite
and at least its headers ar missing on msys2.
So how to build httpd with msys since no expat-devel package or headers is available ?
When configuring httpd --with-included-apr, where do apr-utils look for expat headers or how to configure that ?
more precisely the CHANGES-APR-UTIL-1.6 documentation says
Changes with APR-util 1.6.0
*) The expat dependency of apr-util is no longer built with
apr-util.
Install expat (including development headers and libraries) first
before building apr-util.
where should expat headers and libs be installed in httpds build directory tree ?
I finally had to build expat separately,
then other errors arised and found a solution thanks to
this link for missing libtool and to that link for the effective way to build expat without generating export redefinition.
let find the full build script here:
pacman -S make gcc libcrypt perl unzip libtool msys/libcrypt-devel
cd OpenSSL_1_1_1-stable
curl http://mirrors.standaloneinstaller.com/apache/httpd/httpd-2.4.38.tar.gz --output httpd-2.4.38.tar.gz
tar xvf httpd-2.4.38.tar.gz
cd $HOME
git clone --branch OpenSSL_1_1_1-stable https://github.com/openssl/openssl.git
mv openssl OpenSSL_1_1_1-stable
cd OpenSSL_1_1_1-stable
./configure gcc --prefix=$HOME/openssl
make
make install
cd $HOME
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2
tar xjvf expat-2.2.6.tar.bz2
cd $HOME/expat-2.2.6
./configure --prefix=$HOME/httpd --exec-prefix=$HOME/httpd
make
make install
cd $HOME
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-1.6.5.tar.gz --output apr-1.6.5.tar.gz
tar xvf apr-1.6.5.tar.gz
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-util-1.6.1.tar.gz --output apr-util-1.6.1.tar.gz
tar xvf apr-util-1.6.1.tar.gz
cd $HOME/apr-1.6.5
./configure --prefix=$HOME/httpd
make
make install
cd $HOME/apr-util-1.6.1
./configure --prefix=$HOME/httpd --with-apr=$HOME/httpd --with-expat=$HOME/httpd
make
make install
cd $HOME
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar xvf pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=$HOME/pcre
make
make install
cd $HOME
wget https://github.com/nghttp2/nghttp2/releases/download/v1.37.0/nghttp2-1.37.0.tar.gz
tar xvf nghttp2-1.37.0.tar.gz
cd $HOME/nghttp2-1.37.0
./configure --exec-prefix=$HOME/httpd --prefix=$HOME/httpd
make
make install
cd $HOME/httpd-2.4.38
./configure --prefix=$HOME/httpd --with-expat==$HOME/httpd --with-apr-util=$HOME/httpd --with-apr=$HOME/httpd --with-pcre=$HOME/pcre --enable-ssl --enable-ssl-staticlib-deps --with-ssl=$HOME/openssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-balancer --enable-http2 --enable-nghttp2-staticlib-deps --with-nghttp2=$HOME/nghttp2
make
make install
The build process completed successfully,
but usefull to say that the runtime can't be used since httpd is not able to load its dynamic modules as described here

implement janus gateway for webrtc

I am following janus documentation to build a video mcu system. I installed all the dependencies of it according to the read me file.
http://janus.conf.meetecho.com/docs/
after that when I run the script using sh install.sh I am getting following error
In file included from test.c:1:0:
../websock/src/websock.h:55:26: fatal error: event2/event.h: No such file or directory
#include <event2/event.h>
^
compilation terminated.
make[1]: *** [test.o] Error 1
make[1]: Leaving directory `/home/gayan/MyDetails/MyApplications/virtualClassRoomTest/janus-gateway/wstest'
make: *** [wstest] Error 2
The installer couldn't find the libwebsock lib, which is needed for WebSockets
You can install version 1.0.4 (required!) with the following steps:
wget http://paydensutherland.com/libwebsock-1.0.4.tar.gz
tar xfv libwebsock-1.0.4.tar.gz
cd libwebsock-1.0.4
./configure --prefix=/usr && make && sudo make install
[Note: you may need to pass --libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution]
If you're not interested in WebSockets support, you can disable them passing nowebsockets to the install script:
./install.sh nowebsockets
I also install the libwebsock according to the above steps, but still the error is showing. event2 directory is not in the janus-gateway codes. here is the github link for all the source code. https://github.com/meetecho/janus-gateway.git
Any kind of help would be appreciated.
The full installation steps to have websockets working(Ubuntu 14) are:
mkdir -p ~/build
sudo apt-get install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev libwebsockets-dev pkg-config gengetopt automake libtool doxygen graphviz git cmake
sudo apt-get install libavformat-dev
echo "Start installing libwebsockets"
cd ~/build
git clone git://git.libwebsockets.org/libwebsockets
cd libwebsockets
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT=ON ..
make && sudo make install
echo "Start installing Janus"
cd ~/build
git clone git://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" CFLAGS="-I/usr/local/include"
make && sudo make install
sudo make configs
Make sure to copy certificates if using wss, chrome is really picky about that stuff. If using self signed certificates you have to trust them in chrome(very intuitive procedure:)))
sudo cp mycert.pem /opt/janus/share/janus/certs/
sudo cp mycert.key /opt/janus/share/janus/certs/
I had this problem and solve it after
sudo apt-get install libevent-dev
My system is ubuntu 14.04 64 bit

install mlpy 3.5.0 on mac 10.9 error.Please help me

The following is the error which I am getting. Please help me to fix it.
apple:mlpy-3.5.0 apple$ python setup.py install
running install
running build
running build_py
running build_ext
building 'mlpy.gsl' extension
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.9-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:10: fatal error: 'gsl/gsl_sf.h' file not found
#include "gsl/gsl_sf.h"
^
1 error generated.
MLPy depends on GNU Scientific Library (GSL), which you need to install first.
You can install it either with brew install gsl or manually from source.
For manual installation, instructions can be found here. The relevant steps are as follows:
go to: http://www.gnu.org/prep/ftp.html
click on an ftp link close to your location
find the gsl/ directory and click on it
find the gsl-VERSION.tar.gz file, where version is 1.14 or greater. Click on that file to download it.
In a terminal window extract the tar.gz file using tar -xzf gsl-VERSION.tar.gz and then cd to the ./gsl-VERSION directory
Look at the INSTALL file. It will probably tell you to run ./configure, then make, and then make install (and you might have to
login as the superuser (sudo)
I am actually getting the same issue today while installing mlpy. Based on the mlpy documentation. Here is the method to solve this issue.
According to the installation section in the mlpy documentation:
If the GSL header files or shared library are in non-standard locations on your system, use the --include-dirs
and --rpath options to build_ext:
$ python setup.py build_ext --include-dirs=/path/to/header --rpath=/path/to/lib
$ python setup.py install
We have to assign the header and lib. Based on How to obtain and install GSL,
Under Search Paths/Header Search Paths type /opt/local/include
Under Search Paths/Library Search Paths type /opt/local/lib
The quick answer is running the below command:
sudo python setup.py build_ext --include-dirs=/opt/local/include --rpath=/opt/local/lib
sudo python setup.py install
Hope this will be helpful.

Apache installation; libpcre error

When installing Apache on Ubuntu 11.10, I get the following error:
configure: error: APR not found. Please read the documentation.
I followed the instructions here, then, I get the error below:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
What am I doing wrong and how can I resolve it?
1. Download PCRE from PCRE.org
2. Compile it with a prefix and install it:
./configure --prefix=/usr/local/pcre
make
make install
3. Go back to where your Apache installation is and compile Apache with PCRE:
--with-pcre=/usr/local/pcre
For me (Fedora Linux), it was enough to just install the pcre-devel: yum install -y pcre-devel. Didn't even have to use --with-pcre afterwards.
Debian
In a clean installation of Debian 9.5, during the installation of Apache it is necessary to have some packages and libraries to avoid errors. Next I show the type of error and its respective solution
Configuration
configure: error: no acceptable C compiler found in $PATH
$ sudo apt-get install build-essential
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
$ sudo apt-get install libpcre3-dev
Then I make the configuration indicating that it is installed in the path /usr/local and not in /usr/local/apache2, otherwise I will have library errors. The idea is that the libraries created for httpd end in /usr/local/lib so that the dynamic linker knows them.
$ configure --prefix /usr/local
Compilation
And for the compilation the following the installation of some packages also would avoid us errors in a clean installation of Debian.
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory.
$ sudo apt-get install libexpat1-dev.
It is recommended to use the -j3 parameter to make the compilation faster. Although it could also be ignored.
$ make -j3
I was other problem compiling apache2 in CentOS with pcre. I installed pcre in other location "/custom/location/pcre" and configure command throw the following error
configure: error: Did not find pcre-config script at "/custom/location/pcre"
to solve it changing the flag --with-pcre=/custom/location/pcre to --with-pcre=/custom/location/pcre/bin/pcre2-config
BTW, on CentOS 7.6 before building httpd, please install pcre-devel
`$ sudo yum install pcre-devel`
In RHEL 3 is not necessary setting parameter --with-pcre pointing to pcre-config. Only need pcre path
My configure command:
./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre
This worked for me:
sudo apt-get install libpcre3-dev
In ubuntu
This worked for me
./configure --prefix /u01/apache --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre2-config