在Kotlin中使用C函数时的SWIG错误 - 两个不同的错误
我正在使用以下命令使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您通常不需要
-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.