gpt4 book ai didi

c - ppu-ld 找不到-lspe

转载 作者:行者123 更新时间:2023-11-30 17:32:20 26 4
gpt4 key购买 nike

我正在尝试在 CELL BE Simulator(mambo) 上编译下面的代码。//你好.c

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <libspe.h>
#include <sched.h>

extern spe_program_handle_t hello_spu;
spe_gid_t gid;
speid_t speids[8];
int status[8];

int main(int argc, char *argv[]){
int i;

printf("Hello World!\n");

gid = spe_create_group (SCHED_OTHER, 0, 1);
if (gid == NULL) {
fprintf(stderr, "Failed spe_create_group(errno=%d)\n", errno);
return -1;
}

if (spe_group_max (gid) < 8) {
fprintf(stderr, "System doesn't have eight working SPEs. I'm leaving.\n");
return -1;
}

for (i = 0; i < 8; i++) {
speids[i] = spe_create_thread (gid, &hello_spu,NULL, NULL, -1, 0);
if (speids[i] == NULL) {
fprintf (stderr, "FAILED: spe_create_thread(num=%d, errno=%d)\n",i, errno);
exit (3+i);
}
}

for (i=0; i<8; ++i){
spe_wait(speids[i], &status[i], 0);
}

__asm__ __volatile__ ("sync" : : : "memory");

return 0;

}

//生成文件

########################################################################
# Target
########################################################################

PROGRAM_ppu64 = hello


########################################################################
# Local Defines
########################################################################

IMPORTS = ../spu/hello_spu.a -lspe


########################################################################
# make.footer
########################################################################

include /opt/cell/sdk/buildutils/make.footer

编译后,它提供以下输出。

$make   
/opt/cell/toolchain/bin/ppu-gcc -W -Wall -Winline -I. -I /opt/cell/sysroot usr/include -I /opt/cell/sysroot/opt/cell/sdk/usr/include -mabi=altivec -maltivec -O3 -c

hello.c
hello.c: In function 'main':
hello.c:12: warning: unused parameter 'argc'
hello.c:12: warning: unused parameter 'argv'
/opt/cell/toolchain/bin/ppu-gcc -o hello hello.o -L/opt/cell/sysroot/usr/lib64 -L/opt/cell/sysroot/opt/cell/sdk/usr/lib64 -R/opt/cell/sdk/usr/lib64 ../spu/hello_spu.a -lspe
/opt/cell/toolchain/bin/ppu-ld: cannot find -lspe
collect2: ld returned 1 exit status
make: *** [hello] Error 1

“ld”找不到 -lspe 库。“/opt/cell/sysroot/usr/lib”目录包含以下库和文件,

alf,              libblas.so,          libc_stubs.a,       libieee.a,       libnetpbm.so.10,       libnuma.so.1,            libsimdmath.so.3,
crt1.o, libblas.so.1, libdl.a, libm.a, libnetpbm.so.10.35, libpthread.a, libsimdmath.so.3.0.3,
crti.o, libBrokenLocale.a, libdl.so, libmass.a, libnldbl_nonshared.a, libpthread_nonshared.a, libspe2.so,
crtn.o, libBrokenLocale.so, libg.a, libmassv.a, libnsl.a, libpthread.so, libspe2.so.2,
gconv, libbsd.a, libgmp.a, libmcheck.a, libnsl.so, libresolv.a, libspe2.so.2.2.0,
gcrt1.o, libbsd-compat.a, libgmp.so, libmp.a, libnss_compat.so, libresolv.so, libthread_db.so,
libalf.a, libc.a, libgmp.so.3, libmpfr.a, libnss_dns.so, librpcsvc.a, libutil.a,
libalf.so, libcidn.so, libgmp.so.3.3.3, libmp.so, libnss_files.so, librt.a, libutil.so,
libalf.so.3, libc_nonshared.a, libgmpxx.a, libmp.so.3, libnss_hesiod.so, librtkaio.a, Mcrt1.o,
libalf.so.3.0.0, libcrypt.a, libgmpxx.so, libmp.so.3.1.7, libnss_nisplus.so, librt.so, Scrt1.o,
libanl.a, libcrypt.so, libgmpxx.so.3, libm.so, libnss_nis.so, libsimdmath.a,
libanl.so, libc.so, libgmpxx.so.3.0.5, libnetpbm.so, libnuma.so, libsimdmath.so

如何将 libspe2.so 链接到 libspe.so?请帮忙。

最佳答案

你没有将它们链接在一起。它们是不同的东西。您可以更新 makefile 以使用 -lspe2如果这是您想要的库版本,或者您安装的库版本安装了 libspe.so图书馆。

关于c - ppu-ld 找不到-lspe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24268969/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com