Building Libmcrypt on Linux/UNIX without a C++ compiler.

aRoot etc

EDpCloud’s Cross paltform file replication web based GUI uses NGINX. To build NGINX we needed to build libmcrypt (required by PHP).

While trying to build libmcrypt I run into a few errors as shown below:

eh@u32:~/sandbox/trunk/tamda/src/edpwebgui/unix$ cd libmcrypt-2.5.8/
eh@u32:~/sandbox/trunk/tamda/src/edpwebgui/unix/libmcrypt-2.5.8$ ./configure --prefix=/tmp/x1
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make sets $(MAKE)... (cached) yes
checking for g++... g++
checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
See `config.log' for more details.

The problem was that we were looking for a C++ compiler even if the entire library is written in C (** AND
I did not want to install g++ on our dev machines and make all of our dev team do the same!)

The solution was to change configure and replace the cc extension with c as shown in the following spinet from my projects Makefile.

You may also need to create a symlink for g++ under /usr/bin using  ln -s /usr/bin/gccxx /usr/bin/g++ where xx may be your gcc version; check using ‘ which gcc’ )

tar xvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
mv configure configure.endura
sed ‘s@ac_ext=cc@ac_ext=c@’ configure.endura >configure && chmod +rx configure
./configure –prefix=/usr/local/libmcrypt
# OR: ./configure –prefix=/usr/local/libmcrypt –disable-cpp –enable-static=y –enable-shared=no
make install

This should work on Linux and other Unix flavors.


Building Libmcrypt on Linux/UNIX without a C++ compiler. was last modified: April 2nd, 2018 by aRoot

Share this Post