2016-01-26 00:06:05 +00:00
|
|
|
======
|
|
|
|
JCPUID
|
|
|
|
======
|
|
|
|
|
2016-02-03 18:31:18 +00:00
|
|
|
Windows
|
|
|
|
-------
|
|
|
|
Install MS Visual Studio (comminity edition 2015 was last used).
|
|
|
|
Import a project from the msvc files. And build a binary.
|
2016-01-26 00:06:05 +00:00
|
|
|
|
2016-02-03 18:31:18 +00:00
|
|
|
Cross-compilation using mingw has been attempted with version 4.6.3 and 5.2.1 of mingw,
|
|
|
|
but the resulting binaries have not been able to execute on 32-bit windows machines.
|
|
|
|
64-bit machines work fine though.
|
2016-01-26 00:06:05 +00:00
|
|
|
|
|
|
|
FreeBSD
|
|
|
|
-------
|
|
|
|
Compiled natively, x86 on a 32-bit install and x86_64 on a 64-bit install
|
|
|
|
|
|
|
|
To build the 32-bit binaries run something like this:
|
|
|
|
BITS=32 ./build.sh
|
|
|
|
|
|
|
|
To build the 64-bit binaries run something like this:
|
|
|
|
BITS=64 ./build.sh
|
|
|
|
|
|
|
|
|
|
|
|
Linux
|
|
|
|
-----
|
|
|
|
Compiled natively x86 and x86_64 on a 64-bit install
|
|
|
|
|
|
|
|
To build the 32-bit binaries run something like this:
|
|
|
|
BITS=32 ./build.sh
|
|
|
|
|
|
|
|
To build the 64-bit binaries run something like this:
|
|
|
|
BITS=64 ./build.sh
|
|
|
|
|
|
|
|
|
|
|
|
OSX
|
|
|
|
---
|
|
|
|
Compiled natively on OSX machine
|
|
|
|
|
|
|
|
To build the 32-bit binaries run something like this:
|
|
|
|
BITS=32 ./build.sh
|
|
|
|
|
|
|
|
To build the 64-bit binaries run something like this:
|
|
|
|
BITS=64 ./build.sh
|
|
|
|
|
|
|
|
|
|
|
|
=====
|
|
|
|
JBIGI
|
|
|
|
=====
|
|
|
|
|
2011-06-05 13:52:43 +00:00
|
|
|
|
|
|
|
Dynamic library build
|
|
|
|
=====================
|
|
|
|
|
2008-05-12 13:47:15 +00:00
|
|
|
If you have a libgmp.so installed on your system already
|
|
|
|
(check in /usr/lib), you can build a dynamically linked libjbigi.so as follows:
|
|
|
|
cd jbigi
|
|
|
|
build.sh dynamic
|
2011-06-05 13:52:43 +00:00
|
|
|
You do, of course, need the gmp headers installed.
|
|
|
|
On ubuntu, check for libgmp3 and libgmp3-dev packages.
|
|
|
|
This is much easier and faster than building GMP from source.
|
2008-05-12 13:47:15 +00:00
|
|
|
|
2004-08-21 07:56:53 +00:00
|
|
|
|
2011-06-05 13:52:43 +00:00
|
|
|
Static library build
|
|
|
|
=====================
|
|
|
|
|
|
|
|
Otherwise, the build script build.sh will download the the GMP source,
|
|
|
|
unpack and build it. The GMP version and download location are configured
|
|
|
|
in jbigi/build.sh, please review it to ensure you download
|
|
|
|
and build the desired version.
|
2008-02-27 15:18:32 +00:00
|
|
|
|
2004-08-21 07:56:53 +00:00
|
|
|
To build the native jbigi and jcpuid libraries for the current host CPU,
|
|
|
|
simply run sh build.sh and the results will be packaged up into jbigi.jar
|
2011-06-05 13:52:43 +00:00
|
|
|
and the libjbigi.so library.
|
2004-08-21 07:56:53 +00:00
|
|
|
|
|
|
|
To build the native jbigi libraries for all supported CPUs (on the current OS),
|
|
|
|
go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/)
|
2008-02-27 15:18:32 +00:00
|
|
|
|
2011-06-05 13:52:43 +00:00
|
|
|
|
2015-09-29 15:31:42 +00:00
|
|
|
Build for more than one target at a time
|
|
|
|
========================================
|
|
|
|
|
2015-09-30 15:07:09 +00:00
|
|
|
jbigi/mbuild-all.sh is used to build a whole set of binaries at a time.
|
2015-09-29 15:31:42 +00:00
|
|
|
Each run will build a set of binaries for a specific platform.
|
|
|
|
|
2015-09-30 15:07:09 +00:00
|
|
|
Linux -> Windows cross-compilation
|
|
|
|
----------------------------------
|
2015-09-29 15:31:42 +00:00
|
|
|
Install ming-w64 (on debian or whichever package that provides i686-w64-mingw32 and x86_64_w64_mingw32).
|
|
|
|
|
|
|
|
To build the 32-bit binaries run something like this:
|
|
|
|
CC=i686-w64-mingw32-gcc TARGET=windows BITS=32 ./mbuild-all.sh
|
|
|
|
|
|
|
|
To build the 64-bit binaries run something like this:
|
|
|
|
CC=x86_64-w64-mingw32-gcc TARGET=windows BITS=64 ./mbuild-all.sh
|
|
|
|
|
2015-09-30 15:07:09 +00:00
|
|
|
Linux -> FreeBSD cross-compilation
|
|
|
|
----------------------------------
|
|
|
|
Install gcc-multilib (on debian or whichever package that provides the C runtime)
|
|
|
|
I used clang3.6 as CC, but gcc or most other things should work too.
|
|
|
|
|
|
|
|
To build the 32-bit binaries run something like this:
|
|
|
|
TARGET=freebsd BITS=32 ./mbuild-all.sh
|
|
|
|
|
|
|
|
To build the 64-bit binaries run something like this:
|
|
|
|
TARGET=freebsd BITS=64 ./mbuild-all.sh
|
|
|
|
|
2015-09-30 16:17:09 +00:00
|
|
|
OSX Compilation
|
|
|
|
---------------
|
|
|
|
No working cross-compilation setup has been found. The gmp6 binaries were produced on an OSX host.
|
2016-10-28 17:10:22 +00:00
|
|
|
For more information on OSX compilation, see http://trac.i2p2.i2p/ticket/1865 or
|
|
|
|
https://trac.i2p2.de/ticket/1865
|
|
|
|
|
|
|
|
There is no /usr/local/lib/libgmp.so dynamic library for macOS.
|
|
|
|
The easiest way to get this is with Macports.
|
|
|
|
These commands download, compile, and set Macports gcc as the default compiler
|
|
|
|
if you put /opt/local/bin first in the PATH environment variable.
|
|
|
|
|
|
|
|
sudo port install gmp
|
|
|
|
sudo port select --list gcc
|
|
|
|
sudo port select --set gcc mp-gcc6
|
|
|
|
export PATH=/opt/local/bin:$PATH
|
|
|
|
gcc --version
|
|
|
|
|
|
|
|
Now replace /usr/local/lib with /opt/local/lib in the file core/c/jbigi/build_jbigi.sh.
|
|
|
|
|
|
|
|
$ diff build_jbigi.sh build_jbigi.sh.orig
|
|
|
|
81c81
|
|
|
|
< LIBPATH="-L.libs -L/opt/local/lib"
|
|
|
|
---
|
|
|
|
> LIBPATH="-L.libs -L/usr/local/lib"
|
|
|
|
|
2015-09-30 16:17:09 +00:00
|
|
|
|
2015-09-29 15:31:42 +00:00
|
|
|
|
2011-06-05 13:52:43 +00:00
|
|
|
Installation and testing
|
|
|
|
========================
|
|
|
|
|
2016-10-28 17:10:22 +00:00
|
|
|
To test, copy jbigi/lib/libjbigi.so (Windows: jbigi.dll; Mac: libjbigi.jnilib)
|
|
|
|
to your i2p installation directory ($I2P).
|
|
|
|
Copy jcpuid/lib/freenet/support/CPUInformation/libjcpuid-*.so (Windows: jcpuid-*.dll; Mac: libjcpuid-*.jnilib)
|
|
|
|
to your i2p installation directory ($I2P) as libjcpuid.so (Windows: jcpuid.dll; Mac: libjcpuid.jnilib)
|
|
|
|
You may also copy jbigi.jar to the $I2P/lib/ directory;
|
2011-06-05 13:52:43 +00:00
|
|
|
it will be used only if the router fails to load the native library
|
|
|
|
from the I2P installation directory.
|
|
|
|
|
2008-05-12 13:47:15 +00:00
|
|
|
The build.sh script runs two speed tests, one with your existing
|
|
|
|
I2P installation and one with the new libjbigi.
|
|
|
|
|
|
|
|
Alternatively, after copying the files to the i2p/ directory,
|
2008-02-27 15:18:32 +00:00
|
|
|
to run a speed test comparing the native library to the java library,
|
2008-05-12 13:47:15 +00:00
|
|
|
run the shell script below. Adjust the I2P= line as necessary.
|
2008-02-27 15:18:32 +00:00
|
|
|
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
export I2P=~/i2p
|
|
|
|
java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
|