编译 cal3d 演示“cally” (带有骨骼动画的 3D 模型库)
我认为这是一个关于automake的问题。
我正在努力处理 cally 演示Cal3D。 我遇到的第一个问题是 Cal3D 代码库缺失 #include
#include
在很多地方。
每次我在 Cal3d 中的任何源文件中出现错误时执行此操作就足以让我编译它。
cally 演示还需要一些 #include
现在我的问题是编译 tick.cpp 时未定义 HAVE_SDL_H 。 配置和 makefile 似乎接受 SDL 安装在我的系统上,但 src/tick.cpp 中的宏不接受。
我猜想configure.in 中存在某种错误或其他错误,但我似乎不知道它是什么。
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -O3 -ffast-math -funroll-all-loops -g -O2 -I/usr/include -I/usr/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT tick.o -MD -MP -MF ".deps/tick.Tpo" -c -o tick.o tick.cpp; \
then mv -f ".deps/tick.Tpo" ".deps/tick.Po"; else rm -f ".deps/tick.Tpo"; exit 1; fi
tick.cpp:144:5: error: #error "no timer implemented for your plateform"
编辑:
我终于编译了演示。
当我编译 cal3d 时,我将 #include
添加到以下文件中:
- src/cal3d/hardwaremodel.cpp
- src/cal3d/platform.cpp
- src/cal3d/renderer.cpp
- src/cal3d/submesh .cpp
- src/cal3d_converter.cpp
当我编译 cally 时,我将 #include
添加到以下文件中:
- src/demo.cpp
- src/model.cpp
在 model.cpp 我将第 640 行更改为
glBindTexture(GL_TEXTURE_2D, (GLuint)pCalRenderer->getMapUserData(0));
到
glBindTexture(GL_TEXTURE_2D, *(GLuint*)pCalRenderer->getMapUserData(0));
我还做了一些更丑陋的更改来编译src/tick.cpp。
在 src/tick.cpp 中,我删除了与 SDL 有关的所有内容。我还删除了检查 __i386__ 或 __ia64__ 的宏 if 子句,以便 Tick::getTime() 也可以编译。
我知道这不是一个正确的解决方案,因此非常欢迎改进。
- 64 位 OpenSuSE,内核为 2.6.27。
- GCC:4.3.2
- GNU Automake:1.10.1
- GNU Autoconf 2.63
- 64 位版本的 SDL 库与 zypper 一起安装(通过 GUI)。
解决方案
在configure.in中更改
AC_CHECK_HEADERS([SDL.h])
为
AC_CHECK_HEADERS([SDL/SDL.h])
(然后运行autoreconf和./configure)
在tick.cpp中更改HAVE_SDL_H<的所有检查/code> 到
HAVE_SDL_SDL_H
这都是由于 sdl 库的重组所致。
I think this is a question about automake.
I'm struggling with the cally demo of Cal3D.
The first problem I ran into was that the Cal3D code base is missing #include <cstring>
and #include <memory>
in a lot of places.
Doing this every time I got an error in any source file in Cal3d was enough to let me compile it.
The cally demo also needed some #include <cstring>
Now my problem is that HAVE_SDL_H is not defined when tick.cpp is compiled.
The configure and makefile seems to accept that SDL is installed on my system, but the macros in src/tick.cpp doesn't.
I guess there is some kind of bug in the configure.in or something, but I don't seem to find out just what it is.
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -O3 -ffast-math -funroll-all-loops -g -O2 -I/usr/include -I/usr/local/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT tick.o -MD -MP -MF ".deps/tick.Tpo" -c -o tick.o tick.cpp; \
then mv -f ".deps/tick.Tpo" ".deps/tick.Po"; else rm -f ".deps/tick.Tpo"; exit 1; fi
tick.cpp:144:5: error: #error "no timer implemented for your plateform"
Edit:
I've finally compiled the demo.
When I compiled cal3d I added #include <cstring>
to the following files:
- src/cal3d/hardwaremodel.cpp
- src/cal3d/platform.cpp
- src/cal3d/renderer.cpp
- src/cal3d/submesh.cpp
- src/cal3d_converter.cpp
When I compiled cally I added #include <cstring>
to the following files:
- src/demo.cpp
- src/model.cpp
In model.cpp I changed line 640 from
glBindTexture(GL_TEXTURE_2D, (GLuint)pCalRenderer->getMapUserData(0));
to
glBindTexture(GL_TEXTURE_2D, *(GLuint*)pCalRenderer->getMapUserData(0));
I also did some uglier changes to get src/tick.cpp to compile.
In src/tick.cpp I removed everything that had anything to do with SDL. I also removed a macro if clause checking for __i386__ or __ia64__, so that Tick::getTime() could also be compiled.
I know that this is not a proper fix, so improvements are very much welcome.
- 64-bit OpenSuSE with a 2.6.27 kernel.
- GCC: 4.3.2
- GNU Automake: 1.10.1
- GNU Autoconf 2.63
- 64-bit versions of the SDL library is installed with zypper (through the GUI).
Solution
In configure.in change
AC_CHECK_HEADERS([SDL.h])
to
AC_CHECK_HEADERS([SDL/SDL.h])
(then run autoreconf and ./configure)
in tick.cpp change all checks for HAVE_SDL_H
to HAVE_SDL_SDL_H
This is all due to a restructuring in the sdl library.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
缺少
#include
和#include
时出现的错误主要是由于 GNU 标头中发生的清理造成的:包含不必要的标头已删除,因此不包含其使用的功能的正确标头的程序会面临编译错误。关于
HAVE_SDL_H
,很可能您的 Linux 发行版缺少软件包。您可能需要安装 SDL 库。一些 Linux 发行版(例如 Ubuntu)将库运行时和开发文件之间的软件包分开,因此您需要安装这两个软件包
sudo apt-get install libsdl1.2-dev
关于:
它确实无法编译,因为
HAVE_SDL_H
未在config.h
中定义。当您查看configure.in
你看到它使用AC_CHECK_HEADERS([SDL.h])
来自 autoconf 手册:
因此,
AC_CHECK_HEADERS([SDL.h])
使配置在/usr/include
中搜索SDL.h
,但没有找到它,因为它的(新的?)路径是/usr/include/SDL/SDL.h
作为解决方法,请在调用配置时使用
CPPFLAGS
添加系统标头搜索路径:./configure CPPFLAGS="-I/usr/include/SDL"
现在您可能想要修复
configure.in
configure.in
使用AM_PATH_SDL (1.2.0)
最终将调用sdl-config --cflags
来定义SDL_CFLAGS
。 (AM_PATH_SDL
的实现通常位于/usr/share/aclocal/sdl.m4
文件中)sdl-config --cflags
返回 < code>-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT 但这些-I
和-D
指令不应以结尾CFLAGS 无论如何,而是在 CPPFLAGS 中(根据 autoconf 手册)。因此我想说“在 SDL 级别”已经出现了问题。
现在看一下
AC_LANG
文档< /a>:将
AC_LANG_CPLUSPLUS
向上移动,使其至少高于AC_CHECK_HEADERS([SDL.h])
应该使其现在使用g++
和CXXFLAGS
尝试编译SDL.h
时应该会成功,因为SDL_CFLAGS
已添加到CXXFLAGS
中。 (再说一遍,它确实应该是SDL_CPPFLAGS
但您不会更改 SDL...)The errors you got with missing
#include <cstring>
and#include <memory>
is mainly du to a cleanup that happened in GNU headers: inclusion of unnecessary headers were removed and consequently programs not including the proper headers for the features they use face compiling errors.About
HAVE_SDL_H
, most likely, your Linux distribution is missing packages.You probably need to install the SDL library. Some Linux distributions like Ubuntu split the packages between the library runtime and the dev files so you need to install both packages
sudo apt-get install libsdl1.2-dev
Regarding:
It indeed fails to compile because
HAVE_SDL_H
is not defined inconfig.h
. When you look atconfigure.in
you see it's usingAC_CHECK_HEADERS([SDL.h])
From the autoconf manual:
So,
AC_CHECK_HEADERS([SDL.h])
makes configure search forSDL.h
in/usr/include
and doesn't find it because its (new?) path is/usr/include/SDL/SDL.h
As a workaround, use
CPPFLAGS
to add system header search paths when invoking configure:./configure CPPFLAGS="-I/usr/include/SDL"
Now you may want to fix
configure.in
configure.in
usesAM_PATH_SDL(1.2.0)
which will end up invokingsdl-config --cflags
to defineSDL_CFLAGS
. (the implementation ofAM_PATH_SDL
typically lies in the/usr/share/aclocal/sdl.m4
file)sdl-config --cflags
returns-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
but those-I
and-D
directives should not end up inCFLAGS
anyway but rather inCPPFLAGS
(as per the autoconf manual). Hence I would say there is already something wrong "at the SDL level".Now take a look at the
AC_LANG
documentation:Moving the
AC_LANG_CPLUSPLUS
up so that it at least aboveAC_CHECK_HEADERS([SDL.h])
should make it now useg++
andCXXFLAGS
when trying to compileSDL.h
which should success sinceSDL_CFLAGS
were added toCXXFLAGS
. (again, it should really beSDL_CPPFLAGS
but you won't change SDL...)