c - 'c interfaces and implementations' (David Hanson) 代码安装

标签 c linux gcc ubuntu-11.04

我正在尝试安装本书附带的代码:https://sites.google.com/site/cinterfacesimplementations/

按照作者在此处给出的说明进行操作:http://cii.googlecode.com/svn/trunk/install.html

我的电脑在 32 位 i686 架构上安装了 ubuntu 11.04。按照作者对我尝试的 32 位 linux 的说明进行操作:

make CC='cc -DMAXALIGN=4' AS='cc -c -x assembler-with-cpp -traditional'

其中cc是gcc版本4.5.2 其中给出了以下警告和错误:

makefile:138: warning: overriding commands for target `maxalign'
makefile:135: warning: ignoring old    cc -DMAXALIGN=4 -g -Iinclude -c -o ap.o src/ap.c

In file included from src/thread.c:100:0:
/usr/include/i386-linux-gnu/asm/sigcontext.h:56:8: error: redefinition of ‘struct _fpreg’
/usr/include/bits/sigcontext.h:28:8: note: originally defined here
/usr/include/i386-linux-gnu/asm/sigcontext.h:61:8: error: redefinition of ‘struct _fpxreg’
/usr/include/bits/sigcontext.h:34:8: note: originally defined here
/usr/include/i386-linux-gnu/asm/sigcontext.h:67:8: error: redefinition of ‘struct _xmmreg’
/usr/include/bits/sigcontext.h:41:8: note: originally defined here
/usr/include/i386-linux-gnu/asm/sigcontext.h:71:8: error: redefinition of ‘struct _fpstate’
/usr/include/bits/sigcontext.h:50:8: note: originally defined here
/usr/include/i386-linux-gnu/asm/sigcontext.h:104:8: error: redefinition of ‘struct sigcontext’
/usr/include/bits/sigcontext.h:81:8: note: originally defined here
src/thread.c: In function ‘interrupt’:
src/thread.c:108:2: warning: ‘sigsetmask’ is deprecated (declared at /usr/include/signal.h:199)
make: *** [thread.o] Error 1

不确定在这里做什么。 同样令人费解的是/usr/include/i386-linux-gnu。因为如果我这样做

uname -m

它打印 i686 而不是 i363。 有什么想法吗?

干杯, 吉姆

最佳答案

在 thread.c 的第 100 行——删除 #include <asm/sigcontext.h> (或将其注释掉)。那应该删除“重复声明”。它不会修复不推荐使用的接口(interface)的使用(十年前写的书和 5 年前更新的代码的问题),如果您尝试在 64 位处理器上运行它,则会出现其他我没有尝试修复的问题.

关于c - 'c interfaces and implementations' (David Hanson) 代码安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14533191/

相关文章:

c++ - 在构建我的 C++ 可执行文件 (gcc) 时,我可以获得所有链接库的报告吗? (包括静态链接)

c++ - 当派生类的析构函数是虚拟的而基类的 dtor 不是时代码崩溃

C 代码在 archlinux 上运行,但不能在 ubuntu 10.04 上运行

c - 尝试初始化成员时出现 Typedef 结构错误

linux - 具有多个 ip 的单站故障安全 ssh

c - 如何根据 C11 使用二进制前缀?

linux - 如何在 shell 脚本中运行 shell/python 脚本?

linux - 为什么我的手册页只有在用 man 查看时格式不正确?

c - MPI分配奇数个处理器核时如何分配数据?

c - 如何向从 shell 脚本启动的所有进程发送 SIGSTOP