红联Linux门户
Linux帮助

SystemC在ubuntu上的安装

发布时间:2017-05-19 10:44:27来源:linux网站作者:Jeremy_ku
最近在弄SocLib时,要用到SystemC,所以就查阅了一下SystemC的安装,这里做个备注,以免后面忘了。
我的环境是ubuntu 14.04LTS。
 
1.把下载下来的SystemC源程序压缩包(http://www.accellera.org/downloads/standards/systemc/)在用户主目录里使用tar命令解压缩:
tar xvf systemc-2.2.0.tgz
 
2.然后进入解压缩后生成的systemc-2.2.0文件夹,建立一个临时文件夹objdir(名字可以随便起,如tmp什么的也可以):
cd systemc-2.2.0
mkdir objdir
 
3.然后进入这个临时文件夹,运行SystemC的配置程序来生成安装文件:
(Note: "mkdir /usr/local/systemc-2.3.0" and using "echo $CXX" to check whether envirnment variable 'CXX' has been set to g++ before run command "../configure --prefix=/usr/local/systemc-2.3.0".  > export CXX=g++)
cd objdir
../configure -prefix=/home/user/systemc
prefix参数后面这个路径是你希望安装SystemC的目标路径,你也可以改为其他路径的。但是注意不要使用VMware和Windows共享的虚拟分区,我一开始就是安装在虚拟分区里面了,结果总是报错,说属性错误。
 
4.等安装文件生成完毕后,回到上层目录,运行make程序就行安装就可以了:
cd ..(这一句不要)
make
make install
如果一切顺利,在/home/user/systemc下,SystemC的一切文件就都安装好了。从理论上说,你编译链接SystemC源程序的环境已然就绪了。
Note: If "error adding symbols: Bad value collect2: error: ld returned 1 exit status" occurs, please try to run command "sudo make clean" and back to the configure step before recompiling.
运行一个实例后,发现出错:./hello:error while loading shared libraries: libsystemc-2.3.1.so: cannot open shared object file: No such file or directory
解决方法:
把libXXX.so.1.2.3所在的目录加入到 /etc/ld.so.conf中,或者在 /etc/ld.so.conf.d/下新建一文件,如XXX.conf,其内容是libXXX.so.1.2.3所在的目录。
在我的例子中,就是:
sudo touch/etc/ld.so.conf.d/systemc.conf
vi/etc/ld.so.conf.d/systemc.conf
(在systemc.cof文件中加入一行/systemc安装的绝对路径/lib-linux64)
保存退出
sudo ldconfig
大功告成!
 
本文永久更新地址:http://www.linuxdiyf.com/linux/30895.html