Next: Quick start, Previous: Overview, Up: Preface
The G2HEC library is dependent of V. Shoup’s NTL library, which can be found at NTL: A Library for doing Number Theory.
The following procedure should work on Unix and Unix-like platforms. The installation has been tested on Linux and Solaris, and in Cygwin on Windows.
To obtain the source code and documentation for G2HEC, download https://github.com/syncom/libg2hec/tarball/vX.Y.Z. Here “X.Y.Z” denotes the current version number, i.e., 1.0.0.
If the NTL library is installed in a standard system directory, then do the following:
% git clone https://github.com/syncom/libg2hec.git % cd ligb2hec % autoreconf -vi % ./configure --prefix=$HOME/nssw % make % make check % make install
This will build, test and install G2HEC in $HOME/nssw
. You can change
to a different location by specifying it with the --prefix=
option (the
default is /usr/local
). After installation, you will find the G2HEC
header files in
$HOME/nssw/include
and the compiled static library libg2hec.a
in
$HOME/nssw/lib/
.
If you have installed the NTL/GMP libraries into locations which require
special include or library paths, you can pass them to LDFLAGS
and
CXXFLAGS
variables for the configure script.
For example (for bash)
% env LDFLAGS=-L$HOME/nssw/lib CXXFLAGS=-I$HOME/nssw/include ./configure --prefix=$HOME/nssw
Depending on whether GMP is found in the search path or not, the G2HEC library is configured to build with or without GMP.
After the library is built, executing make check
runs some test
programs.
It is highly recommended to do this to make sure things went well.
Executing make install
copies a number of files to a directory
<prefix>
that you specify by passing --prefix=<prefix>
as an argument
to configure
at configuration time, or as an argument to
make install
at installation time. Recall that the default is
/usr/local
.
To uninstall the library, execute make uninstall
.
To remove object files, execute make clean
.
Note that this installation process is almost standard.
Assuming you have installed G2HEC as above, to compile program myprog.C
that uses G2HEc, do
% g++ -I<prefix>/include -I<ntl_prefix>/include -L<prefix>/lib \ -L<ntl_prefix>/lib myprog.c -o myprog -lg2hec -lntl -lm
The binary file myprog
is created.
If you built NTL using GMP, do
% g++ -I<prefix>/include -I<ntl_prefix>/include -L<prefix>/lib \ -L<ntl_prefix>/lib -L<gmp_prefix>/lib myprog.c -o myprog -lg2hec \ -lntl -lgmp -lm
Of course, there is no need to duplicate the flags if some of the locations are the same, and you may leave out the corresponding flags if the locations are standard directories.
Next: Quick start, Previous: Overview, Up: Preface