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

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

Related

Build in a linux container fails to find gtest (using vcpkg and CMake)

I've tried build a project in a container and have some very (simple?) problem.
I have a couple of unit tests that use gtest and chose to use vcpkg to build it since I aim to target windows/linux machines.
When I build on my or someone else's computer everything seem to work, but when I build the project in the container it fails to find the include files for gtest.
Is there anything I missed in the CMake integration with vcpkg that needs to be done for my project?
My current state is that I start the container and use an interactive shell to manually build everything inside it (so I can try debug the issue).
Here is my Dockerfile:
FROM ubuntu:20.04
# Needed to be set for the cmake package to be installed properly without interactive input
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install gcc-10 -y
RUN apt-get install g++-10 -y
# Set gcc/g++ so they default to the installed versions
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 1
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 1
RUN apt-get install cmake -y
# zip / pkg-config were required for vcpkg to build some dependencies
RUN apt-get install zip -y
RUN apt-get install pkg-config -y
# below are convenience for opening a shell terminal in the docker image
RUN apt-get install vim -y
RUN apt-get install curl -y
# enables tab-completion and some colors
RUN curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
# copy local files to be built
COPY scripts /build/scripts
COPY src /build/src
COPY CMakeLists.txt /build
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg)
message( FATAL_ERROR
"Clone vcpkg at ${CMAKE_CURRENT_SOURCE_DIR}\n"
"cd ${CMAKE_CURRENT_SOURCE_DIR}\n"
"git clone https://github.com/Microsoft/vcpkg.git --depth 1\n"
"cd vcpkg\n"
"./bootstrap-vcpkg.sh"
"./vcpkg install gtest:x64-linux"
)
endif()
if (WIN32)
set(CMAKE_GENERATOR_PLATFORM x64) # Force 64 bits
elseif (LINUX)
set(VCPKG_TARGET_TRIPLET "x64-linux")
endif()
# Setup vcpkg toolchain
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/runtime)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
project(TheProject)
find_package(GTest CONFIG REQUIRED)
include_directories(
"src/cpp"
)
add_subdirectory(src)
EDIT: If I hardcode the include paths / library paths to point to the vcpkg installed directory in the CMakeLists.txt everything works, but I thought it should only be necessary to setup the toolchain file for it to work.
The unmodified toolchain-integration works like a charm outside any container (on a computer).
How can I avoid this hack? It will not scale at all later on.
Below is the hack that make everything work (not needed on a computer):
include_directories(
"src/cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/installed/x64-linux/include"
)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/installed/x64-linux/lib"
)

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

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

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

installing Mod_Mono and Xsp4 on CentOS 6.3

I've gotten Mono 3.0.1 installed, but I'm running into tons of dependency issues trying to install Mod_Mono and Xsp4, Has anyone gotten this to work? If so what were some of the steps you had to take? Is there a central location for this?
Thank you so much for taking the time to read my question and happy coding!
Enviroment:
Centos 6.3 basic install
Apache/2.2.15
Installation steps:
#Install required software
yum -y install httpd httpd-devel make glib2-devel libpng-devel libjpeg-devel
giflib-devel libtiff-devel libX11-devel gcc* fontconfig-devel bison gettext bzip2
libtool automake autoconf wget unzip
directory we will be installing mono in
mkdir -p /opt/mono
cd /tmp
Download & extract source
wget http://download.mono-project.com/sources/mono/mono-2.10.2.tar.bz2
wget http://download.mono-project.com/sources/xsp/xsp-2.10.2.tar.bz2
wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
tar -xjf mono-2.10.2.tar.bz2
tar -xjf xsp-2.10.2.tar.bz2
tar -xjf mod_mono-2.10.tar.bz2
tar -xjf libgdiplus-2.10.tar.bz2
compile and install libgdiplus
cd libgdiplus-2.10
./configure --prefix=/opt/mono
make ; make install
compile and install mono
cd ../mono-2.10.2
./configure --prefix=/opt/mono --with-libgdiplus=/opt/mono
make ; make install
Set enviroment vars(make sure to also modify ~/.bash_profile)
export PATH=$PATH:/opt/mono/bin
export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
compile and install xsp
cd ../xsp-2.10.2
./configure --prefix=/opt/mono
make ; make install
compile and install mod_mono
cd ../mod_mono-2.10
./configure --prefix=/opt/mono --with-mono-prefix=/opt/mono
make ; make install
mv /etc/httpd/conf/mod_mono.conf /etc/httpd/conf.d/
Currently working with mono and xsp4:
[root]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root]# mono --version
Mono JIT compiler version 4.5.0
[root]# xsp4 --version
xsp4.exe 2.10.2.0
Chazt3n solution is ok, except I had to do some changes to make it work:
I changed the mono version from 4.0 to 4.5 in file: /opt/mono/bin/mod-mono-server4
I ran this command: cp /opt/mono/lib/mono/4.0/xsp4.exe /opt/mono/lib/mono/4.5/
Works well now, thanks.

configure: error: APR not found. Please read the documentation

I am trying to install apache in my linux machine. But when I tried ./configure --prefix = /usr/local/apache it shows an error configure: error: APR not found. Please read the documentation. I tried to install apr with yum install apr apr-deve and it says
Package apr-1.4.6-1.fc15.x86_64 already installed and latest version
No package apr-deve available.
Nothing to do
What should I do now? Please excuse I am a newbie to LINUX
Actualy I had to install aprutils also... So try using:
sudo apt-get install libapr1-dev libaprutil1-dev
In the directory where you have installed the apache httpd distribution there is a directory that is called /srclib
You cd into that directory cd /srclib.
Make sure you are in that folder. Now open your browser and go to http://apr.apache.org/download.cgi
and download the apr-*.tar.gz files into this directory.
wget <link>
Unzip and extract them into srclib directory
after extracting make sure you rename the apr-* directories to just "apr" and "apr-util", respectively. For example:
mv apr-1.6.5 apr
mv apr-util-1.6.1 apr-util
Now, it should read the .apr files from that folder.
After that it will ask for apr-util too, make sure you follow the same procedure.
Hope this helps!
If your install on apache 2.2 or less than add flag
--with-included-apr
If you are using 2.4 than you can go to https://apr.apache.org/download.cgi and download the latest apr and apr-util. Unpack them and move them into the apache source file into /srclib. Make sure they are named apr and apr-util not apr.x.x.x. Then you can use the --with-included-apr flag
For my linux rig, I got past this by downloading the apr-dev package using the local package manager:
opkg install libapr-1-dev
That was on Angstrom linux, so your command version will likely be different, replacing opkg with apt-get or whatever your distro's package manager is.
There are several ways of doing this
download latest apr and apr-utils from https://apr.apache.org/
tar xzvf apr.XXX.tar.gz
tar xzvf apr-util,XXX.tar.gz
Solution 1
mv apr.XXX httpd.XYZ/srclib/apr
mv apr-util.XXX httpd.XYZ/srclib/apr-util
you should be able to see
ls httpd.XYZ/srclib/apr-util
apr apr-util
now cofigure apache via
./configure --with-included-apr --other-options-that-you-want
Solution 2
mv apr && ./configure && make && make install
mv apr-util && ./configure && make && make install
mv httpd.XYZ/
./configure --with-apr=/usr/local/apr -other-options-that-you-want
NOTE : /usr/local/apr (CENTOS),your Distro might use different one
You have to download APR and APR-UTIL packages.
install the above downloaded packages from source using below commands
./configure -prefix=
make
make install
Then run your above mentioned command as below
./configure -prefix= -with-apr= -with-apr-util=
The following command works on my mac.
Prerequisites:
brew install apr
brew install pcre
In fact, the link is missing, so http can't be found
brew link apr
brew link pcre
Copy the prompt you see
vim ~/.bash_profile
export PATH="/usr/local/opt/apr/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/apr/lib"
export CPPFLAGS="-I/usr/local/opt/apr/include"
export PATH="/usr/local/opt/apr-util/bin:$PATH"
then, try again
source ~/.bash_profile
./configure
sudo apt-get install libapr1-dev libaprutil1-dev use this command in linux