简体   繁体   English

无法为Windows x86构建JAssimp.dll

[英]Can't build JAssimp.dll for Windows x86

So, I'm trying to get into LWJGL, and part of this is loading 3D models, and I thought I'd use JAssimp for this. 因此,我试图进入LWJGL,其中一部分是加载3D模型,并且我想为此使用JAssimp。 The readme specifies two steps, building a native component, and a .jar component. 自述文件指定了两个步骤,分别是构建本机组件和.jar组件。 The jar was just an ant build, and so it happened without incident. 罐子只是一只蚂蚁,所以它发生时没有发生任何事故。 The part that's difficult is the native library. 困难的部分是本机库。 I've been trying to link it, without success. 我一直在尝试将其链接,但没有成功。 I've included the assimp include directories, included Java's headers, and linked to JAssimp's assimp.lib. 我已经包含了assimp包含目录,包含了Java的标头,并链接到JAssimp的assimp.lib。 However, I still get these errors: 但是,我仍然收到以下错误:

jassimp.obj : error LNK2019: unresolved external symbol _aiImportFile referenced in function _Java_jassimp_Jassimp_aiImportFile@20
jassimp.obj : error LNK2019: unresolved external symbol _aiReleaseImport referenced in function _Java_jassimp_Jassimp_aiImportFile@20
jassimp.obj : error LNK2019: unresolved external symbol _aiGetErrorString referenced in function _Java_jassimp_Jassimp_aiImportFile@20
C:\Users\Kevin\Downloads\assimp-3.1.1-win-binaries\port\jassimp\jassimp-native\src\Release\Jassimp.dll : fatal error LNK1120: 3 unresolved externals

Googling around leads to mostly the same question, but with no answers, and one guy on facepunch that apparently found a solution, but pulled an https://xkcd.com/979/ and never mentioned how. 谷歌搜索导致几乎相同的问题,但没有答案,一个人在面部打孔显然找到了解决方案,但拉了一个https://xkcd.com/979/ ,却从未提及过如何解决。 Obviously, I've missed linking to some library, but I'm not sure what else to link to, Assimp only provided me one, and I'm not sure what else I need. 显然,我错过了链接到某些库的信息,但是我不确定要链接的其他东西,Assimp只为我提供了一个,而且我不确定我还需要什么。 Am I installing it wrong? 我安装错了吗?

For anyone else who stumbles across this with the same problem, the answer is to do it the old-fashioned way and compile the C++ Assimp yourself. 对于任何其他遇到相同问题的人,答案是采用老式方法,自己编译C ++ Assimp。 This will give you, (among other things) a new assimp.lib. 这将给您(其中包括)一个新的assimp.lib。 Link with this instead of the one provided, and the error will go away. 与此链接而不是所提供的链接,该错误将消失。

How To Build 如何建造

I) buiid the primary shared object libassimp.so: issue these commands in AssImp/assimp-3.2 a. I)建立主要共享对象libassimp.so:在AssImp / assimp-3.2 a中发出以下命令。 cmake CMakeLists.txt -G 'Unix Makefiles' b. cmake CMakeLists.txt -G'Unix Makefiles'b。 make c. 使c。 results in AssImp/assimp-3.2/lib 结果在AssImp / assimp-3.2 / lib中

II) build the native library by issuing this command in jassimp-native/src: a. II)通过在jassimp-native / src中发出以下命令来构建本地库: $ gcc jassimp.cpp -I/usr/lib/jvm/java-7-openjdk-amd64/include/ \\ -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux \\ -I/$HOME/AssImp/assimp-3.2/include \\ -L/$HOME/AssImp/assimp-3.2/lib/libassimp.so -shared -fPIC -o libjassimp.so $ gcc jassimp.cpp -I / usr / lib / jvm / java-7-openjdk-amd64 / include / \\ -I / usr / lib / jvm / java-7-openjdk-amd64 / include / linux \\ -I / $ HOME / AssImp / assimp-3.2 / include \\ -L / $ HOME / AssImp / assimp-3.2 / lib / libassimp.so -shared -fPIC -o libjassimp.so

libjassimp.so is required at runtime and must be located in java.library.path:
b. sudo cp /$HOME/AssImp/assimp-3.2/port/jassimp/jassimp-native/src/libjassimp.so   /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/

III) Java binding The java library is built using ant. III)Java绑定Java库是使用ant构建的。 Executing "ant" in the port/jassimp directory should be sufficient to build the library including the docs. 在port / jassimp目录中执行“ ant”应该足以构建包含文档的库。 The java build is configured to create java 1.6 classes 将Java构建配置为创建Java 1.6类

The Jassimp.jar file generated by the "ant" call has to be incorporated
in your build.xml file:

<target name="init">
   <property name="imports"      value="${libs}/jogl-all.jar:${libs}/gluegen-rt.jar:${libs}/jassimp.jar" />

<target name="compile" depends="prepare">
   <compilerarg line="-Xlint -cp ${imports}" />

All of the above is the good news; 以上都是好消息; I successfully built my code. 我成功构建了代码。

The bad news is that upon execution I received the following error: java: symbol lookup error: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/libjassimp.so: undefined symbol: aiImportFile 坏消息是在执行时我收到以下错误:java:符号查找错误:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/libjassimp.so:未定义的符号:aiImportFile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UnsatisfiedLinkError:C:\\ Program Files(x86)\\ Sikuli X \\ libs \\ VisionProxy.dll:找不到依赖的库 - UnsatisfiedLinkError: C:\Program Files (x86)\Sikuli X\libs\VisionProxy.dll: Can't find dependent libraries 在哪里可以下载java-x86-windows.dll - Where I can download java-x86-windows.dll JAssimp-找不到依赖库 - JAssimp - Can't find dependent libraries 为什么JVM不在Windows x86上发出预取指令 - Why doesn't the JVM emit prefetch instructions on Windows x86 无法获取 win32-x86-64/xpde.dll 的 InputStream - Can't obtain InputStream for win32-x86-64/xpde.dll Windows 7 x64上的Eclipse Helios x86问题,即使在干净的系统上 - Eclipse Helios x86 issues on Windows 7 x64, even on clean system Java-Mac和Windows x86和x64的网络摄像头拍摄/视频 - Java - Webcam shot/video with Mac and Windows x86 & x64 Windows AMD的jdk / jre 5.0 64位下载是否可与Windows x86一起使用? - Will jdk/jre 5.0 64 bit download for windows AMD work with Windows x86? Java Windows x64 中的串行 I/O 使用 JRE x86 - Java Serial I/O in Windows x64 using JRE x86 为什么我的 JRE 位于 C:\Program Files (x86) 虽然它是 64 位版本? - Why my JRE is in C:\Program Files (x86) although it's a 64-Bit build?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM