【问题标题】:'c interfaces and implementations' (David Hanson) code install'c 接口和实现' (David Hanson) 代码安装
【发布时间】:2013-01-26 02:20:39
【问题描述】:

我正在尝试安装本书附带的代码: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”包含哪些文件?是的,i386 是正确的——构建 linux 内核时架构的区别是 i386 或 x86-64(或 powerpc、arm、mips 等)。 “uname -m”显示了内核的构建风格——这与“通用 pentium pro generation”类似。 [在最新的 i386 内核中,您实际上不能再选择 i386 作为架构,因为不再支持 1990-ish 处理器]

标签: c linux gcc ubuntu-11.04


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-12-03
    • 1970-01-01
    • 2011-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多