how to use and install SystemC in terminal mac OS X?
I tried the Logic poet application, But i use os x 10.10 so it doesn't work.
so i want to know how can i compile and execute SystemC in terminal.
I could't find the detail of SystemC in terminal.
如何在终端mac OS X中使用和安装SystemC ?我尝试了逻辑诗人的应用程序,但是我使用的是os x 10.10,所以它不起作用。所以我想知道如何在终端编译和执行SystemC。我在终端上找不到SystemC的详细信息。
Thank you
谢谢你!
2 个解决方案
#1
2
The other answer is correct and perfectly fine, however, I thought I'd also answer and provide a little more detail.
另一个答案是正确和完美的,然而,我想我也会回答并提供一些细节。
Install Apple's "Command Line Tools"
安装苹果的“命令行工具”
You have two options: install Xcode (a big download), or just the command line tools (a much smaller download). If your goal is simply building SystemC applications at the command line, then I recommend the latter.
您有两个选项:安装Xcode(一个大的下载),或者仅仅是命令行工具(一个小得多的下载)。如果您的目标只是在命令行构建SystemC应用程序,那么我推荐后者。
Install Apple's "Command Line Tools" by launching Terminal, entering
安装苹果的“命令行工具”,启动终端,进入。
$ xcode-select --install
then clicking Install. After that, you'll have make
, clang
and more available at the command line.
然后点击安装。在此之后,您将在命令行中获得make、clang和更多可用性。
Build and install Accellera's SystemC implementation
建立并安装Accellera的SystemC实现。
Download the latest release from the Accellera Downloads page (annoyingly, you'll have to provide a few personal details) and extract the contents of the .zip file.
从Accellera下载页面下载最新版本(烦人的是,你必须提供一些个人细节),并提取.zip文件的内容。
I like to keep a copy of the SystemC source code available, because it can be useful for debugging or understanding how something works. Therefore, I move the extracted folder (systemc-2.3.1
) into ~/Work/Other
. That's where I keep source code for third party libraries. However, you can put it wherever you like.
我喜欢保留一份SystemC源代码的副本,因为它对调试或理解某些事情的工作原理非常有用。因此,我将提取的文件夹(systemc-2.3.1)移到~/Work/Other中。这就是我为第三方库保存源代码的地方。但是,你可以把它放在你喜欢的地方。
Open Terminal, change into the extracted folder (systemc-2.3.1
), and execute:
打开终端,切换到提取文件夹(systemc-2.3.1),并执行:
$ mkdir build
$ cd build
$ export CXX=clang++
$ ../configure --with-arch-suffix=
$ make install
The --with-arch-suffix=
option prevents a -macosx64
suffix being add to the lib
folder name, allowing your build scripts to be simpler.
with- arch_suffix =选项可防止将-macosx64后缀添加到lib文件夹名称中,从而使构建脚本更简单。
After that process, the salient include
and lib
folders should be available within the systemc-2.3.1
folder.
在此过程之后,显著的include和lib文件夹应该在systemc-2.3.1文件夹中可用。
Configure your build environment
配置您的构建环境
There are many ways you can do this; I have a simple approach that I believe is close to what the SystemC maintainers envisioned. I define two environment variables in my .bash_profile
(which is executed for every new Terminal session on OS X):
有很多方法可以做到这一点;我有一个简单的方法,我相信这接近于系统维护人员的设想。我在.bash_profile中定义了两个环境变量(在OS X上每一个新的终端会话执行):
export CXX="clang++ -fcolor-diagnostics"
export SYSTEMC_HOME=~/Work/Other/systemc-2.3.1
Build a SystemC application
构建一个SystemC应用程序
You could use Make, the quintessential build tool, which you get with Apple's "Command Line Tools", or any one of the plethora of other options. I use SCons with SConstruct
files that look something like this:
您可以使用Make,这是典型的构建工具,您可以使用苹果的“命令行工具”,或者任何其他选项。我使用SCons的SConstruct文件看起来是这样的:
import os
env = Environment(CXX=os.environ["CXX"],
SYSTEMC_HOME=os.environ["SYSTEMC_HOME"],
CPPPATH="$SYSTEMC_HOME/include",
LIBPATH="$SYSTEMC_HOME/lib")
env.Program("main.cpp", LIBS="systemc")
View trace (VCD) files
查看跟踪(VCD)文件
Scansion is a nice tool for this. GTKWave is another option, but it's a bit clunky.
Scansion是一个很好的工具。GTKWave是另一个选择,但它有点笨拙。
#2
0
Install
Go here click the first link and fill in your information to get the source code
点击第一个链接,并填写您的信息以获取源代码。
http://www.accellera.org/downloads/standards/systemc
http://www.accellera.org/downloads/standards/systemc
Then cd
to the folder
然后cd到文件夹。
Then run the following commands
然后运行以下命令。
./configure --with-unix-layout
gmake
sudo gmake install
gmake clean
After you do that it should all be saved in your use/local/(lib&include) directories
在您完成之后,它应该全部保存在您的use/local/(lib&include)目录中。
To Use
In code do this #include "systemc.h"
在代码中,这个#包含“system .h”
I use a single makefile normally. But you could write the following to link the library. Given your cpp file is called main.
我通常使用一个makefile。但是您可以编写以下链接来链接库。给定cpp文件称为main。
g++ -o main main.cpp -I/usr/local/include -L/usr/local/lib -lsystemc
#1
2
The other answer is correct and perfectly fine, however, I thought I'd also answer and provide a little more detail.
另一个答案是正确和完美的,然而,我想我也会回答并提供一些细节。
Install Apple's "Command Line Tools"
安装苹果的“命令行工具”
You have two options: install Xcode (a big download), or just the command line tools (a much smaller download). If your goal is simply building SystemC applications at the command line, then I recommend the latter.
您有两个选项:安装Xcode(一个大的下载),或者仅仅是命令行工具(一个小得多的下载)。如果您的目标只是在命令行构建SystemC应用程序,那么我推荐后者。
Install Apple's "Command Line Tools" by launching Terminal, entering
安装苹果的“命令行工具”,启动终端,进入。
$ xcode-select --install
then clicking Install. After that, you'll have make
, clang
and more available at the command line.
然后点击安装。在此之后,您将在命令行中获得make、clang和更多可用性。
Build and install Accellera's SystemC implementation
建立并安装Accellera的SystemC实现。
Download the latest release from the Accellera Downloads page (annoyingly, you'll have to provide a few personal details) and extract the contents of the .zip file.
从Accellera下载页面下载最新版本(烦人的是,你必须提供一些个人细节),并提取.zip文件的内容。
I like to keep a copy of the SystemC source code available, because it can be useful for debugging or understanding how something works. Therefore, I move the extracted folder (systemc-2.3.1
) into ~/Work/Other
. That's where I keep source code for third party libraries. However, you can put it wherever you like.
我喜欢保留一份SystemC源代码的副本,因为它对调试或理解某些事情的工作原理非常有用。因此,我将提取的文件夹(systemc-2.3.1)移到~/Work/Other中。这就是我为第三方库保存源代码的地方。但是,你可以把它放在你喜欢的地方。
Open Terminal, change into the extracted folder (systemc-2.3.1
), and execute:
打开终端,切换到提取文件夹(systemc-2.3.1),并执行:
$ mkdir build
$ cd build
$ export CXX=clang++
$ ../configure --with-arch-suffix=
$ make install
The --with-arch-suffix=
option prevents a -macosx64
suffix being add to the lib
folder name, allowing your build scripts to be simpler.
with- arch_suffix =选项可防止将-macosx64后缀添加到lib文件夹名称中,从而使构建脚本更简单。
After that process, the salient include
and lib
folders should be available within the systemc-2.3.1
folder.
在此过程之后,显著的include和lib文件夹应该在systemc-2.3.1文件夹中可用。
Configure your build environment
配置您的构建环境
There are many ways you can do this; I have a simple approach that I believe is close to what the SystemC maintainers envisioned. I define two environment variables in my .bash_profile
(which is executed for every new Terminal session on OS X):
有很多方法可以做到这一点;我有一个简单的方法,我相信这接近于系统维护人员的设想。我在.bash_profile中定义了两个环境变量(在OS X上每一个新的终端会话执行):
export CXX="clang++ -fcolor-diagnostics"
export SYSTEMC_HOME=~/Work/Other/systemc-2.3.1
Build a SystemC application
构建一个SystemC应用程序
You could use Make, the quintessential build tool, which you get with Apple's "Command Line Tools", or any one of the plethora of other options. I use SCons with SConstruct
files that look something like this:
您可以使用Make,这是典型的构建工具,您可以使用苹果的“命令行工具”,或者任何其他选项。我使用SCons的SConstruct文件看起来是这样的:
import os
env = Environment(CXX=os.environ["CXX"],
SYSTEMC_HOME=os.environ["SYSTEMC_HOME"],
CPPPATH="$SYSTEMC_HOME/include",
LIBPATH="$SYSTEMC_HOME/lib")
env.Program("main.cpp", LIBS="systemc")
View trace (VCD) files
查看跟踪(VCD)文件
Scansion is a nice tool for this. GTKWave is another option, but it's a bit clunky.
Scansion是一个很好的工具。GTKWave是另一个选择,但它有点笨拙。
#2
0
Install
Go here click the first link and fill in your information to get the source code
点击第一个链接,并填写您的信息以获取源代码。
http://www.accellera.org/downloads/standards/systemc
http://www.accellera.org/downloads/standards/systemc
Then cd
to the folder
然后cd到文件夹。
Then run the following commands
然后运行以下命令。
./configure --with-unix-layout
gmake
sudo gmake install
gmake clean
After you do that it should all be saved in your use/local/(lib&include) directories
在您完成之后,它应该全部保存在您的use/local/(lib&include)目录中。
To Use
In code do this #include "systemc.h"
在代码中,这个#包含“system .h”
I use a single makefile normally. But you could write the following to link the library. Given your cpp file is called main.
我通常使用一个makefile。但是您可以编写以下链接来链接库。给定cpp文件称为main。
g++ -o main main.cpp -I/usr/local/include -L/usr/local/lib -lsystemc