下载 mpfr gmp mpc
安装mpfr
./configure --prefix=/usr/local
安装gmp
./configure --prefix=/usr/local
安装mpc
./configure --prefix=/usr/local
导出库路径
~/.bashrc修改库加载路径
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
在 /etc/ld.so.conf里添加库路径/usr/local/lib,保存退出后执行命令
sudo ldconfg
退出终端重进
安装 glibc.i686 glibc-devel.i686 (64位机器上没有32位glibc库和头文件,会报找不到头文件gnu/stubs-32.h的错误)
sudo yum install glibc.i686 glibc-devel.i686
上面这些都做好了登出重新登录一下
把gcc-4.6.2.tar.gz 移动到 codeviz-1.0.12/compilers 目录下
把 codeviz-1.0.12/compilers/install_gcc-4.6.2.sh 这几行修改一下就能让这里构建通过,主要是添加 --disable-bootstrap
-INSTALL_PATH=$HOME/gcc-graph
+INSTALL_PATH=/usr/local/gcc-graph
-../gcc-4.6.2/configure --prefix=$INSTALL_PATH --enable-shared --enable-languages=c,c++ || exit
-make bootstrap+CFLAGS="-O2 -fPIC" ../gcc-4.6.2/configure --prefix=$INSTALL_PATH --disable-bootstrap --enable-shared --enable-languages=c,c++ || exit+make -j 4回到目录 codeviz-1.0.12 执行命令
./configure --gccgraph=/usr/localmakesudo make install
安装成功:
*** CodeViz is now installed to and testsuites passed ***
Patched gcc is installed to /usr/local. To compile a project
for use with CodeViz, genearlly the following will work
make CC=/usr/local/bin/gcc or g++
To generate a full.graph file for C, use
genfull
For C++, make sure you use the cppdepn method with
genfull -g cppdepn
or the results will not be what you expect.
编译生成 *.cdepn文件
make
生成full.graph文件
genfull -g cppdepn
生成图片
gengraph --output-type "png" --output-layout "LR" -d "10" -f "main"