在Kotlin中使用C函数时的SWIG错误 - 两个不同的错误

发布于 2025-02-10 02:45:16 字数 1437 浏览 1 评论 0原文

我正在使用以下命令使用swig:

swig -java -includeall -package onescream.onescream compute_feature_set.i

接口文件是:

/* compute_feature_set.i */
 %module compute_feature_set
%{
/* Includes the header in the wrapper code */
#include "compute_feature_set.h"
%}

/* Parse the header file to generate wrappers */
%include "compute_feature_set.h"

我会收到以下错误:

compute_feature_set.h:17: Error: Unable to find 'stddef.h'
compute_feature_set.h:18: Error: Unable to find 'stdlib.h'

如果尝试替代swig命令列表:

swig -java compute_feature_set.i
gcc -c compute_feature_set.c compute_feature_set_wrap.c -I/Users/fas/Library/Java/JavaVirtualMachines/openjdk-18.0.1.1/Contents/Home/include -I/Users/fas/Library/Java/JavaVirtualMachines/openjdk-18.0.1.1/Contents/Home/include/darwin
gcc -shared compute_feature_set.o compute_feature_set_wrap.o -o libcompute_feature_set.so

我会收到以下错误:

Undefined symbols for architecture arm64:
  "_b_fft", referenced from:
      _compute_feature_set in compute_feature_set.o
  "_binary_expand_op", referenced from:
      _compute_feature_set in compute_feature_set.o
  "_eml_find", referenced from:
      _compute_feature_set in compute_feature_set.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不确定该怎么办感谢。

I am using the following command using swig:

swig -java -includeall -package onescream.onescream compute_feature_set.i

The interface file is:

/* compute_feature_set.i */
 %module compute_feature_set
%{
/* Includes the header in the wrapper code */
#include "compute_feature_set.h"
%}

/* Parse the header file to generate wrappers */
%include "compute_feature_set.h"

I get the following errors:

compute_feature_set.h:17: Error: Unable to find 'stddef.h'
compute_feature_set.h:18: Error: Unable to find 'stdlib.h'

If I try an alternative swig command list:

swig -java compute_feature_set.i
gcc -c compute_feature_set.c compute_feature_set_wrap.c -I/Users/fas/Library/Java/JavaVirtualMachines/openjdk-18.0.1.1/Contents/Home/include -I/Users/fas/Library/Java/JavaVirtualMachines/openjdk-18.0.1.1/Contents/Home/include/darwin
gcc -shared compute_feature_set.o compute_feature_set_wrap.o -o libcompute_feature_set.so

I get the following error:

Undefined symbols for architecture arm64:
  "_b_fft", referenced from:
      _compute_feature_set in compute_feature_set.o
  "_binary_expand_op", referenced from:
      _compute_feature_set in compute_feature_set.o
  "_eml_find", referenced from:
      _compute_feature_set in compute_feature_set.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am not sure what else to do, any assistance here would be greatly appreciated.

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

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

发布评论

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

评论(1

无边思念无边月 2025-02-17 02:45:17

您通常不需要-includeAll,因为您不太可能想包装Endire stddef.h和stdlib.h库函数(通常它无论如何都无法正常工作)。

使用-i< dir>在搜索路径中包含其他目录。

You don't usually want -includeall, since you are unlikely to want to wrap the endire stddef.h and stdlib.h library functions (and in general it wouldn't work anyway).

Use -I<dir> to include other include directories in the search path.

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