% gcc --versionIf you want to use g++ or g77, you need to recompile gcc-2.95.2 with a pacthed contained in patch/gcc2952.diffs. See other languages.
% ./configureIf you want to compile in a different directory from the one containing the source code, '
cd
' to the directory and run
`configure
' with the option '--srcdir=DIR
',
where DIR is the directory that contains the source code.
% gmake
% gmake check
% suNOTE: you don't need to be root to install checker if you have the rights. However, you should certainly use '--prefix' at step 1 to install in a directory where you can write.
% gmake install
% gmake check-install
% checkergcc -c *.c $(CFLAGS) % checkergcc -o my_prg *.oIn other words, replace 'cc' or 'gcc' with 'checkergcc'
--disable-check-usage
'.
The result of make is an object, gccchecker.o
, which can
be linked with your binary.
Note: You can try with an other version, but you could encounter problems while patching gcc sources. Furthermore, since while compiling with checker, standard headers are used, you need to get the sources of your libstdc++ libraries.
So, get gcc-2.95.2.tar.gz
. Untar it, and apply patches:
gcc-2.95.2> patch -p1 < XXX/Checker/patch/gcc2952.diffsConfigure it (do not forget to enable C++ with `
--enable-languages=c++
') and install it.
At this stage you should have a working gcc/g++ compiler with libstdc++, the standard c++ library.
Then, you can configure checker as decribe above and install it. Do not
forget to add option --enable-cxx
to activate c++ stubs
generation.
You should then compile libio
and libstdc++
with checker. First go to the libio directory and clean the files:
> cd i686-pc-linux-gnu/libio > make cleanYou have to suppress the following lines from Makefile, since the
libio
used does not call libc
:
# We have those in libc.a. IO_OBJECTS= iogetline.o STDIO_WRAP_OBJECTS= OSPRIM_OBJECTS= STDIO_OBJECTS=Then you can recompile
libio
and libstdc++
:
> make CC=checkergcc CXX=checkerg++ MT_CFLAGS= > cd ../libstdc++ > make clean > make CC=checkergcc CXX=checkerg++ MT_CFLAGS=Note: this
libstdc++
library is not thread safe, since checker
itself is not thread safe.
You are now ready to install libstdc++
in the checker
library directory:
> cp libstdc++ CHECKER_PREFIX_DIR/lib/checker/i686-pc-linux-gnu