使用 agg (antigrain) 库并让 gsl shell 工作
我的主要目标是让 GSL Shell 在我的 OSX 10.7 系统上运行。到目前为止,我已经有了正确版本的 lua,并且运行了正确的补丁。我还有一个 GSL 的工作版本,可以编译并运行示例程序。我可以完美地构建 agg,还可以通过在 macosx_sdl 文件夹中运行 make 来运行他们的示例程序。
我的第一个问题是我到底如何使用 agg 创建自己的项目?我知道您应该简单地将文件添加到项目文件中然后继续,但这似乎不想为我编译。是否只是添加 include 目录和 libagg.a 的情况?
最后,如何构建 gsl shell?目前它经常抱怨 agg-plot 文件夹,所以我应该在哪里放置 agg 文件来进行此构建,那么当我完成后,我应该在哪里放置 agg 文件以便 lua 脚本可以访问它们?
希望有人可以帮忙!
My main aim is to get the GSL Shell working on my OSX 10.7 system. So far I have the correct version of lua with the correct patches running. I also have a working version of GSL which compiles and runs example programs. I can build agg perfectly and also run their example programs by running make in the macosx_sdl folder.
My first question is how on earth do I create my own project with agg? I know that you are supposed to simply add the files to your project file and go, but this does not seem to want to compile for me. Is it simply a case of adding the include directory and the libagg.a?
Finally, how do I build gsl shell? Currently it complains about the agg-plot folder a lot, so where do I put the agg files to make this build, then when i've done it where do I place the agg files so that the lua scripts can get to them?!
Hope someone can help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,要使用 AGG 库,您需要确保编译器能够找到头文件,并在链接过程中找到库,无论是静态库还是动态库。
为了使头文件和库可用,您需要考虑用于构建软件的系统。如果使用传统的 makefile 系统,您需要添加一些标志以确保可以找到头文件。这可以通过在 makefile 中添加如下内容来实现:
CFLAGS += -I/path/to/agg/headers
以及链接器:
LIBS += -L/path/to/agg/library -lagg -lm
在具体中对于 GSL Shell 1.1,Makefile 中使用文件“make-packages”来配置所需的包。您可以在此处添加定位 AGG 库所需的标志:
AGG_INCLUDES = -I/usr/include/agg2
AGG_LIBS = -lagg -lX11 -lpthread -lsupc++
您应该只修改“-I”选项提供的路径,并在 AGG_LIBS 中添加选项“-L/path/to/agg/library”以指定AGG 库位于。
另请注意,agg 库依赖于其他库。例如,在 Linux 上,它至少需要 X11 库。如果通过调用 gcc 而不是 g++ 进行链接,则可能需要 supc++ 库,因为如果使用 gcc,则不包括 C++ 运行时库。
In general to use the AGG library you need to make sure that the compiler is able to find the headers files and, during the linking, the libraries, either in form of a static or dynamic libraries.
To make the headers files and the libraries available you need to take into account the system that is used to build the software. If a traditional makefile sistem is used you need to add some flags to make sure that the headers file can be found. This can be achieved by adding into the makefile something like:
CFLAGS += -I/path/to/agg/headers
and for the linker:
LIBS += -L/path/to/agg/library -lagg -lm
In the specific case of GSL Shell 1.1 the file "make-packages" is used in the Makefile to configure the required packages. You can add here the flags required to locate the AGG library:
AGG_INCLUDES = -I/usr/include/agg2
AGG_LIBS = -lagg -lX11 -lpthread -lsupc++
you should just modify the path provided with the "-I" option and, in AGG_LIBS, add an option "-L/path/to/agg/library" to specify the path where the AGG libraries are located.
Please note also that the agg libraries depends on other libraries. For example on linux it needs at least the X11 library. The libraries supc++ may be needed if the linking is made by invoking gcc instead of g++ because if gcc is used the C++ runtime libraries are not included.