How to Compile And Use libtocc¶
libtocc depends on UnQlite. So, first you need to compile and install it on your system.
You need to pay for recent versions of Unqlite. However, older versions were free. You can obtain the free version from the Tocc’s Releases.
Un-compress the package, then run:
$ ./configure $ make $ make install
First step is bootstraping configure scripts. (You only need to do this if you get the latest source from the repository. If you have one of the released source packages, this step is already done for you.)
You need Gnu Auto Tools installed: libtool, autoconf and automake. Then, simply invoke:
$ cd /path/to/libtocc/src/ $ ./bootsrap
It creates configure script.
Now, you need to configure build scripts. Normally, you only need to invoke:
It should be enough for most cases. Here some other common things you may want to do.
Installing Somewhere Else: By default, libtocc will be installed on the
global lib and include directories of your system. (Usually
/usr/local/include.) But if you
want to install it somewhere else, you can pass
--prefix option to the
$ ./configure --prefix=/opt/libtocc/
In the above example, builded libraries will be placed in
and public headers in
Optimized/Debug Build: By default, libtocc mades with
If you want to overwrite these options, you can pass
configure script. For example, to build non-optimized for debuging:
$ ./configure CXXFLAGS="-g -O0"
Or optimized without debug symbols:
$ ./configure CXXFLAGS="-O2"
Now that everything configured, simply invoke:
You can pass
CXXFLAGS in this step, too. But it’s not recommended.
$ make install
builded library and its public headers will be copied to the specified
prefix. For example, if prefix is
/usr/local/, libraries will be copied
/usr/local/lib/ and headers to
libtocc comes with some Unit Tests. They’re placed in
directory. This section explains how to build and run these Unit Tests.
Tests are using Catch library. The Tocc’s source code hadn’t updated and it depends on the version 1 of Catch.
catch.hpp from Catch 1.10.0
and copy it to
/usr/local/include. Or alternatevly, copy it to another directory
and add a
-I flag to the
./configure command below to point to that directory.
Just like the bootstraping step of libtocc itself, you need Gnu Auto Tools. Then invoke:
$ cd /path/to/libtocc/tests $ ./bootstrap
Previous step creates a
configure script. To run it, you need to add
libtocc/src/ directory to the includes path. The following command should
$ ./configure CPPFLAGS="-I../src/" CXXFLAGS="-I../src/"
Also, if you installed libtocc library in a non-standard path (where
can’t find it by default, say
/opt/libtocc/lib/) you need to add that to
the libraries search path:
$ ./configure CPPFLAGS="-I../src/" CXXFLAGS="-I../src/" LDFLAGS="-L/opt/libtocc/lib"
Like it mentioned in libtocc, you can also overwrite optimization flags here. Though the default is OK.
If previous step was OK, you can run:
in order to build unit tests.
Note: You don’t need to install unit tests. You can run it from the same directory.
Invoke unit tests using:
Again, if you installed libtocc somewhere that
ld can’t find it by
default, you need to specify that path:
$ LD_LIBRARY_PATH=/opt/libtocc/lib/ ./libtocctests
5. How to Report a Problem¶
If unit tests failed on you machine, do us a favor and report it. To do so, run libtocctests like this:
$ ./libtocctests 2>&1 > tests.log
tests.log file to firstname.lastname@example.org, and provide your platform
information, such as your OS and its version.