This wiki is now locked - both user registration and edits (except by admins) are disabled. We're currently migrating all the content to our new wiki. If you have time, please register and help us out!

You can still view the source code of every page. Once a page has been copied over to the new wiki, please add a link to it to MigratedPages (the only page which is still editable), to notify the admins to go and blank it.


Building Freenet 0.7 with free software


Here's a list of steps to build freenet 0.7 completely from source using free software. As you can see it's not trivial since most people just use the binaries that are in SVN. The steps have been tested on debian unstable but if you get the right dependencies they probably work on other free operating systems like fedora too. Please update this entry if you find dependencies that aren't listed above.

Status


Above build instructions were last verified to work on 2006-08-01 on a debian unstable system. Since we use je-2.0.90 the datastore format is older than the one used by the binaries in SVN. New je is at http://downloads.sleepycat.com/je-3.0.12.tar.gz but fails to build with "The import java.util.concurrent cannot be resolved" since generics branch has not yet been merged to gnu classpath. This will hopefully happen within a year.

Build dependencies


  1. sudo apt-get install ecj-bootstrap java-gcj-compat-dev ant unzip gcj
  2. Make sure that the following symlinks are set (use update-alternatives --config java):
lrwxrwxrwx 1 root root 30 Apr  8 00:01 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/bin/java                                                          
lrwxrwxrwx 1 root root 19 Jan 23 19:43 /usr/lib/jvm/java-gcj/bin/javac -> ../../../../bin/ecj                                                            
lrwxrwxrwx 1 root root 22 Apr  8 00:01 /etc/alternatives/ecj -> /usr/bin/ecj-bootstrap

Full list of commands to build it all

svn co https://emu.freenetproject.org/svn/trunk/freenet/
svn co https://emu.freenetproject.org/svn/trunk/contrib/

# For contrib/lib/linux/x86/libfec16.so
wget http://onionnetworks.com/downloads/fec-1.0.3.zip
unzip fec-1.0.3.zip
cd fec-1.0.3 && ant
cd src/csrc && JAVA_HOME=/usr/lib/jvm/java-gcj make && cd ../..
cd ..
cp fec-1.0.3/lib/fec-linux-x86/lib/linux/x86/*.so contrib/lib/linux/x86/

# For contrib/jcpuid/lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so
cd contrib/jcpuid && JAVA_HOME=/usr/lib/jvm/java-gcj ./build.sh && cd ../..

# For contrib/onion-common.jar
cd fec-1.0.3 && unzip common-20020926.zip && cd common-20020926
ant && cd .. && cd ..
cp fec-1.0.3/common-20020926/lib/onion-common.jar contrib/onion-common.jar

# For contrib/je-2.0.90.jar (contrib/je.jar)
wget http://downloads.sleepycat.com/je-2.0.90.tar.gz
tar xzf je-2.0.90.tar.gz
cd je-2.0.90 && ant && cd ..
cp je-2.0.90/build/lib/je.jar contrib/je.jar

# For contrib/NativeBigInteger/lib/net/i2p/util/libjbigi-linux-pentium2.so
cd contrib/NativeBigInteger && sh build.sh && cd ../..

# For freenet/lib/freenet-ext.jar
cd contrib/freenet_ext && ant && cd ../..
mkdir freenet/lib && cp contrib/freenet_ext/freenet-ext.jar freenet/lib

# For freenet/lib/freenet-cvs-snapshot.jar
cd freenet && ant && cd ..

Now everything should be built from source. If you find something that wasn't built from source please update this wiki entry and/or inform lindi-@freenode.

Creating native binary


Now that you have compiled freenet to bytecode you can easily use GCJ to compile that bytecode into a native executable using something like
cd freenet/lib && gcj /usr/share/java/javax-security.jar /usr/share/java/javax-crypto.jar /usr/share/java/gnu-crypto.jar freenet-ext.jar freenet-cvs-snapshot.jar -o freenet --main=freenet.node.Node -g

that can be ran simply with "./freenet". At present this requires that you remove any references to native libraries like fec or jcpuid (it might be possible to work this around somehow. As nextgens pointed out this somehow might be just LD_LIBRARY_PATH, haven't tested this yet). You can apply http://iki.fi/lindi/freenet-native3.diff to remove these dependencies or propose something fancier. Unfortunately conditional compilation in java is not that easy to achieve.

Nextgens suggested on IRC that that not using native FEC routines might be slow but I'm not sure. I'm not even using -O2 and freenet seems to run quite well. This should be tested and benchmarked of course. However, in general pure number crunching tasks can be just as fast in C and java when GCC is used.
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki