source: core/c/README @ 916fc96

Last change on this file since 916fc96 was eb696c8, checked in by dev <dev@…>, 5 years ago

Added correct build instructions for jcpuid on windows.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1======
2JCPUID
3======
4
5Windows
6-------
7Install MS Visual Studio (comminity edition 2015 was last used).
8Import a project from the msvc files. And build a binary.
9
10Cross-compilation using mingw has been attempted with version 4.6.3 and 5.2.1 of mingw,
11but the resulting binaries have not been able to execute on 32-bit windows machines.
1264-bit machines work fine though.
13
14FreeBSD
15-------
16Compiled natively, x86 on a 32-bit install and x86_64 on a 64-bit install
17
18To build the 32-bit binaries run something like this:
19    BITS=32 ./build.sh
20
21To build the 64-bit binaries run something like this:
22    BITS=64 ./build.sh
23
24
25Linux
26-----
27Compiled natively x86 and x86_64 on a 64-bit install
28
29To build the 32-bit binaries run something like this:
30    BITS=32 ./build.sh
31
32To build the 64-bit binaries run something like this:
33    BITS=64 ./build.sh
34
35
36OSX
37---
38Compiled natively on OSX machine
39
40To build the 32-bit binaries run something like this:
41    BITS=32 ./build.sh
42
43To build the 64-bit binaries run something like this:
44    BITS=64 ./build.sh
45
46
47=====
48JBIGI
49=====
50
51
52Dynamic library build
53=====================
54
55If you have a libgmp.so installed on your system already
56(check in /usr/lib), you can build a dynamically linked libjbigi.so as follows:
57        cd jbigi
58        build.sh dynamic
59You do, of course, need the gmp headers installed.
60On ubuntu, check for libgmp3 and libgmp3-dev packages.
61This is much easier and faster than building GMP from source.
62       
63
64Static library build
65=====================
66
67Otherwise, the build script build.sh will download the the GMP source,
68unpack and build it. The GMP version and download location are configured
69in jbigi/build.sh, please review it to ensure you download
70and build the desired version.
71
72To build the native jbigi and jcpuid libraries for the current host CPU,
73simply run sh build.sh and the results will be packaged up into jbigi.jar
74and the libjbigi.so library.
75
76To build the native jbigi libraries for all supported CPUs (on the current OS),
77go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/)
78
79
80Build for more than one target at a time
81========================================
82
83jbigi/mbuild-all.sh is used to build a whole set of binaries at a time.
84Each run will build a set of binaries for a specific platform.
85
86Linux -> Windows cross-compilation
87----------------------------------
88Install ming-w64 (on debian or whichever package that provides i686-w64-mingw32 and x86_64_w64_mingw32).
89
90To build the 32-bit binaries run something like this:
91    CC=i686-w64-mingw32-gcc TARGET=windows BITS=32 ./mbuild-all.sh
92
93To build the 64-bit binaries run something like this:
94    CC=x86_64-w64-mingw32-gcc TARGET=windows BITS=64 ./mbuild-all.sh
95
96Linux -> FreeBSD cross-compilation
97----------------------------------
98Install gcc-multilib (on debian or whichever package that provides the C runtime)
99I used clang3.6 as CC, but gcc or most other things should work too.
100
101To build the 32-bit binaries run something like this:
102    TARGET=freebsd BITS=32 ./mbuild-all.sh
103
104To build the 64-bit binaries run something like this:
105    TARGET=freebsd BITS=64 ./mbuild-all.sh
106
107OSX Compilation
108---------------
109No working cross-compilation setup has been found. The gmp6 binaries were produced on an OSX host.
110
111
112Installation and testing
113========================
114
115To test, copy jbigi/lib/libjbigi.so
116and jcpuid/lib/freenet/support/CPUInformation/libjcpuid-*.so
117to your i2p installation directory ($I2P). You may also copy jbigi.jar to the $I2P/lib/ directory;
118it will be used only if the router fails to load the native library
119from the I2P installation directory.
120
121The build.sh script runs two speed tests, one with your existing
122I2P installation and one with the new libjbigi.
123
124Alternatively, after copying the files to the i2p/ directory,
125to run a speed test comparing the native library to the java library,
126run the shell script below. Adjust the I2P= line as necessary.
127
128-----------------
129
130#!/bin/sh
131export I2P=~/i2p
132java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
Note: See TracBrowser for help on using the repository browser.