NativeCode给出错误

NativeCode给出错误

本文介绍了OSGI Bundle-NativeCode给出错误“找不到本机代码匹配”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用本机库 librxtxSerial 的OSGI包。
第一次,我不得不在树莓上部署这个包,所以我做了类似的事情:

I'm developing an OSGI bundle which uses the native library librxtxSerial.The first time, I had to deploy this bundle on a raspberry, so I've did something like that:

我把本机库放在:lib下/librxtxSerial.so(注意:在java项目中)。

I put the native library under: lib/librxtxSerial.so (NB: INSIDE the java project).

然后,在MANIFEST中我写道:

Then, in the MANIFEST I've wrote:

Bundle-NativeCode: lib/librxtxSerial.so

一切正常!!!

现在,问题是我要在其他使用不同的嵌入式设备上部署相同的捆绑包处理器架构(x86而不是ARM)。

Now, the problem is that I've to deploy the same bundle on other embedded device which uses a different processor architecture (x86 instead ARM).

所以,我已经下载了librxtxSerial库的x86版本,我修改了我的文件夹结构:

So, I've downloaded the x86 build for the librxtxSerial library and I modified my folder structure in something like that:

 - lib
   - x86
     - librxtxSerial.so
   - arm
     - librxtxSerial.so

我已经用这种方式修改了我的MANIFEST:

And I've modified my MANIFEST in this way:

Bundle-NativeCode: lib/x86/librxtxSerial;processor=x86, lib/arm/librxtxSerial;processor=ARM_le

尝试编译(通过maven tycho插件)我总是得到同样的错误:

Trying to compile (through maven tycho plugin) I always get the same error:

No match found for native code: lib/x86/librxtxSerial; processor=x86, lib/arm/librxtxSerial; processor=ARM_le

我该如何解决这个问题?

How can I solve this?

推荐答案

好的,我已经解决了。不确定为什么,但为了解决这个问题足以在标题的末尾添加'*',所以:

Ok, i've solved. Not sure why but in order to solve this issue is enough to add '*' at the end of the header, so:

Bundle-NativeCode: lib/x86/librxtxSerial;processor=x86, lib/arm/librxtxSerial;processor=ARM_le, *

它现在有效。

这篇关于OSGI Bundle-NativeCode给出错误“找不到本机代码匹配”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:26