下載 mpfr gmp mpcc++
http://ftp.gnu.org/gnu/mpfr/mpfr-3.0.0.tar.gzshell
ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.2.tar.gzbootstrap
ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.0.tar.gzbash
ftp://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.gzui
http://www.skynet.ie/~mel/projects/codeviz/codeviz-1.0.12.tar.gzspa
安裝mpfrcode
./configure --prefix=/usr/local
安裝gmporm
./configure --prefix=/usr/local
安裝mpc圖片
./configure --prefix=/usr/local
導出庫路徑 ci
~/.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/local make sudo 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"