西尔克++ cilkexample.c = stderr 中的 200 行

发布于 2024-12-20 10:42:18 字数 1906 浏览 6 评论 0原文

我在我的家用计算机上成功安装了 Cilk,这是一台运行 Ubuntu 的 32 位计算机。我在我的 64 位 Ubuntu 上网本上尽我所知复制了该过程,当然,除了我下载的是 64 位版本而不是 32 位版本。然而,当尝试运行下面复制的非常简单的 cilkexample.c 时,我收到非常非常多的错误,所有错误似乎都与它无法访问库文件有关:

In file included from /usr/include/stdio.h:28,
                 from cilkexample.c:1:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or director\
y
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
In file included from cilkexample.c:1:
/usr/include/stdio.h:36:25: error: bits/types.h: No such file or directory
/usr/include/stdio.h:161:28: error: bits/stdio_lim.h: No such file or directory
/usr/include/stdio.h:846:30: error: bits/sys_errlist.h: No such file or directo\
ry
In file included from /usr/include/stdio.h:34,
                 from cilkexample.c:1:
/usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/include/stddef.h:\
214: error: expected constructor, destructor, or type conversion before ‘typede\
f’
In file included from cilkexample.c:1:
/usr/include/stdio.h:49: error: expected constructor, destructor, or type conve\
rsion before ‘typedef’

等等,等等,等等。

这是我尝试使用命令 cilk++ -o cilkexample cilkexample.c 编译的文件:

#include <stdio.h>
#include <cilk.h>

int foo() {
    return 100;
}

int bar() {
    return 50;
}

int cilk_main(int argc, char **argv) {
    int x, y;

    x = cilk_spawn foo();
    y = cilk_spawn bar();
    cilk_sync;

    printf("Got %d %d, expecting %d %d\n", x, y, 100, 50);
    return 0;
}

同样,我认为这一定是配置问题。该代码未对我们教授分发的工作版本进行修改,我在一台单独的机器上测试了该版本。

我能想到的最后一点信息是 PATH。

******@********:~/Path/To/Cilk$ echo $PATH
/usr/local/cilk/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

感谢您的帮助!

I installed Cilk successfully on my home computer, a 32-bit machine running Ubuntu. I replicated the process to the best of my knowledge on my 64-bit Ubuntu netbook, excepting, of course, that I downloaded the 64-bit version instead of the 32-bit version. When attempting to run the very simple cilkexample.c copied below, however, I get very very many errors, all seeming related to it not having access to library files:

In file included from /usr/include/stdio.h:28,
                 from cilkexample.c:1:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or director\
y
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
In file included from cilkexample.c:1:
/usr/include/stdio.h:36:25: error: bits/types.h: No such file or directory
/usr/include/stdio.h:161:28: error: bits/stdio_lim.h: No such file or directory
/usr/include/stdio.h:846:30: error: bits/sys_errlist.h: No such file or directo\
ry
In file included from /usr/include/stdio.h:34,
                 from cilkexample.c:1:
/usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/include/stddef.h:\
214: error: expected constructor, destructor, or type conversion before ‘typede\
f’
In file included from cilkexample.c:1:
/usr/include/stdio.h:49: error: expected constructor, destructor, or type conve\
rsion before ‘typedef’

et cetera, et cetera, et cetera.

Here is the file I attempted to compile with the command cilk++ -o cilkexample cilkexample.c:

#include <stdio.h>
#include <cilk.h>

int foo() {
    return 100;
}

int bar() {
    return 50;
}

int cilk_main(int argc, char **argv) {
    int x, y;

    x = cilk_spawn foo();
    y = cilk_spawn bar();
    cilk_sync;

    printf("Got %d %d, expecting %d %d\n", x, y, 100, 50);
    return 0;
}

Again, I think this has to be a configuration problem. The code is unmodified from the working version our professor distributed, which I tested on a separate machine.

Last bit of information I can think of is the PATH.

******@********:~/Path/To/Cilk$ echo $PATH
/usr/local/cilk/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾家有女初长成 2024-12-27 10:42:18

看起来您缺少一些标头。您说您使用的是 Ubuntu,其中标头分布在 xxx-dev 包中。

谷歌搜索错误中的一些标头,我发现 bits/types.h 是 Debian 上 libc6-dev 的一部分,您应该检查您是否至少拥有该软件包。

您应该检查您的发行版中的文件出现在哪个包中,我现在没有可供检查的 Debian 或 Ubuntu 计算机。

编辑:我发现自己有一个 Ubuntu 盒子,它看起来像 libc6-dev 至少包含列出的所有文件。 dpkg-query -S [file] 为您提供包名称

Looks like you are missing some headers. You say you are on Ubuntu in which headers are distributed in xxx-dev packages.

Googling for some of the headers in your error I found that bits/types.h are part of libc6-dev on Debian, you should check that you have that package at least.

You should check with your distro in what package the files appear, I don't have a Debian or Ubuntu machine available to check on right now.

Edit: I found myself an Ubuntu box and it looks like libc6-dev contains all the files listed at least. dpkg-query -S [file] gives you package name

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文