bengreen.eu Circle Device

 

Quick Reference

Compiling FMS from Source

A while ago I got interested in the Freenet project, I still read and post from time to time on the forums but to use the active Freenet Messaging System (FMS) you must complie FMS which is written in C++ and uses the poco library.

So, download Poco, extract it and compile it. Download and compile FreeImage (if you want the new captchas). FreeImage is available at http://freeimage.sourceforge.net/download.html. Once you have compiled all the libraries execute cmake like this (change the paths to the libraries and header files as required):

The commands below below assumes that you have a directory (call it fms) and in that directory you have the POCODIR directory, the FreeImage directory and one with FMS itself:

fms/poco-1.6.0
fms/FreeImage
fms/fms-src-0.3.75

If not, or you are reading this and versions have changed (very likely) please change them accordingly. POCODIR is the directory that POCO is in, and POCOVER is the version in the shared object filenames:

~ $ ls poco-1.6.0/lib/Linux/x86_64/
libCppUnit.so             libPocoJSON.so      libPocoUtil.so
libCppUnit.so.1           libPocoJSON.so.30   libPocoUtil.so.30
libCppUnitd.so            libPocoJSONd.so     libPocoUtild.so
libCppUnitd.so.1          libPocoJSONd.so.30  libPocoUtild.so.30
libPocoFoundation.so      libPocoNet.so       libPocoXML.so
libPocoFoundation.so.30   libPocoNet.so.30    libPocoXML.so.30
libPocoFoundationd.so     libPocoNetd.so      libPocoXMLd.so
libPocoFoundationd.so.30  libPocoNetd.so.30   libPocoXMLd.so.30

As you can see here, I have used 30 as my version number...

export POCODIR=../poco-1.6.0
export POCOVER=30
cmake -D I_HAVE_READ_THE_README=ON \
  -D POCO_STATIC=ON \
  -D POCO_FOUNDATION_LIBRARY=$POCODIR/lib/Linux/x86_64/libPocoFoundation.so.$POCOVER \
  -D POCO_UTIL_LIBRARY=$POCODIR/lib/Linux/x86_64/libPocoUtil.so.$POCOVER \
  -D POCO_XML_LIBRARY=$POCODIR/lib/Linux/x86_64/libPocoXML.so.$POCOVER \
  -D POCO_NET_LIBRARY=$POCODIR/lib/Linux/x86_64/libPocoNet.so.$POCOVER \
  -D POCO_BASE_DIR=$POCODIR/ \
  -D ALTERNATE_CAPTCHA=ON \
  -D AUDIO_CAPTCHA=ON \
  -D FREEIMAGE_LIBRARY=../FreeImage/libfreeimage-3.17.0.so \
  -D FREEIMAGE_INCLUDE_PATH=../FreeImage/Dist/ .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ben/fms

Then type make and you should be ready to go... I did however find that my C compiler complained about std::cerr:

In file included from /home/ben/fms/src/../include/fmsapp.h:8:0,
                 from /home/ben/fms/src/main.cpp:1:
/home/ben/fms/src/main.cpp: In function 'int main(int, char**)':
/home/ben/fms/../poco-1.6.0/Util/include/Poco/Util/ServerApplication.h:281:4: 
error: 'cerr' is not a member of 'std'
    std::cerr << exc.displayText() << std::endl; \
    ^
/home/ben/fms/src/main.cpp:4:1: note: in expansion of macro 'POCO_SERVER_MAIN'
 POCO_SERVER_MAIN(FMSApp);
 ^
CMakeFiles/fms.dir/build.make:353: recipe for target 'CMakeFiles/fms.dir/src/main.o' failed
make[2]: *** [CMakeFiles/fms.dir/src/main.o] Error 1
CMakeFiles/Makefile2:62: recipe for target 'CMakeFiles/fms.dir/all' failed
make[1]: *** [CMakeFiles/fms.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

This was easily fixed by including iostream in src/main.cpp:

#include <iostream> // I added this line...
#include "../include/fmsapp.h"
#include <Poco/Util/ServerApplication.h>

POCO_SERVER_MAIN(FMSApp);

If you don't want to install the libraries (I did not) you will have to make a minor adjustment so that ./fms will word properly. For those who dont know LD_LIBRARY_PATH allows for you to include a set of directories that will be searched for shared libraries, we will make use of this useful environment variable now:

cp FreeImage/libfreeimage-3.17.0.so libfreeimage.so.3
LD_LIBRARY_PATH=../poco-1.6.0/lib/Linux/x86_64/:. ./fms

Yay, you are running your own compiled version of FMS ;-) please chat with me on the forums.

Quick Links: Techie Stuff | General | Personal | Quick Reference