The simple answer, as usual is ./configure; make; make install
…
… Well not in this case: it will break in some environments (mine is x86_64-linux with gcc 4.4.5 and fcgi >= 2.4.0).
During the make command, you will likely fall into the following errors. Here is how to get rid of them:
- First error: a missing object file to be moved
make all-recursive make[1]: Entering directory `/homez.160/ultimact/jicmail1/fcgi-2.4.0' Making all in libfcgi make[2]: Entering directory `/homez.160/ultimact/jicmail1/fcgi-2.4.0/libfcgi' source='fcgiapp.c' object='libfcgi_la-fcgiapp.lo' libtool=yes \ depfile='.deps/libfcgi_la-fcgiapp.Plo' tmpdepfile='.deps/libfcgi_la-fcgiapp.TPlo' \ depmode=gcc3 /bin/sh ../depcomp \ /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -pthread -g -O2 -Wall -c -o libfcgi_la-fcgiapp.lo `test -f fcgiapp.c || echo './'`fcgiapp.c rm -f .libs/libfcgi_la-fcgiapp.lo gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -pthread -g -O2 -Wall -c fcgiapp.c -MT libfcgi_la-fcgiapp.lo -MD -MP -MF .deps/libfcgi_la-fcgiapp.TPlo -fPIC -DPIC fcgiapp.c: In function 'ProcessManagementRecord': fcgiapp.c:1490: warning: dereferencing type-punned pointer will break strict-aliasing rules fcgiapp.c:1495: warning: dereferencing type-punned pointer will break strict-aliasing rules fcgiapp.c:1498: warning: dereferencing type-punned pointer will break strict-aliasing rules mv -f libfcgi_la-fcgiapp.o .libs/libfcgi_la-fcgiapp.lo mv: cannot stat `libfcgi_la-fcgiapp.o': No such file or directory make[2]: *** [libfcgi_la-fcgiapp.lo] Error 1 make[2]: Leaving directory `/homez.160/ultimact/jicmail1/fcgi-2.4.0/libfcgi' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/homez.160/ultimact/jicmail1/fcgi-2.4.0' make: *** [all] Error 2
This may be due to a buggy version of libtool shipped with FastCGI.
I don’t have a clean fix for this, but I have a very simple (yet dirty) work-around. Just have to add a make command at line 867 of the libtool file:# Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then make $output_obj $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi
- Second error: an undeclared symbol
fcgio.cpp: In destructor 'virtual fcgi_streambuf::~fcgi_streambuf()': fcgio.cpp:50: error: 'EOF' was not declared in this scope fcgio.cpp: In member function 'virtual int fcgi_streambuf::overflow(int)': fcgio.cpp:70: error: 'EOF' was not declared in this scope fcgio.cpp:75: error: 'EOF' was not declared in this scope fcgio.cpp: In member function 'virtual int fcgi_streambuf::sync()': fcgio.cpp:86: error: 'EOF' was not declared in this scope fcgio.cpp:87: error: 'EOF' was not declared in this scope fcgio.cpp: In member function 'virtual int fcgi_streambuf::underflow()': fcgio.cpp:107: error: 'EOF' was not declared in this scope make[2]: *** [fcgio.lo] Error 1 make[2]: Leaving directory `/somepath/fcgi-2.4.0/libfcgi' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/somepath/fcgi-2.4.0' make: *** [all] Error 2
This is due to a missing stdio.h include in the file libfcgi/fcgio.cpp. Just add it yourself.
#ifdef _WIN32 #define DLLAPI __declspec(dllexport) #endif #include <stdio.h> #include <limits.h> #include "fcgio.h" using std::streambuf; using std::istream; using std::ostream; using std::streamsize;
These are the 2 errors that prevented me from compiling and linking FastCGI on my Linux system.
Hope it will avoid headaches to others.