Building bullet-native on Windows – oh, no!

Cool, you mean in the ant script? That’d be awesome!

If you just post the dll I will quick test it.

@normen yes, the ant script needs changing, maybe even the properties file as well …have to see how it goes :slight_smile:



@EmpirePhoenix thanks for the offer, however there’s an additional complication, being the copy of the trunk I’m doing this work on is a few weeks old, so unsure if that’ll cause problems - besides I’ll have to setup both the Java versions for local testing, appreciate the offer tho!

1 Like

Update,



Currently loathing Oracle, why is Firefox with NoScript prevented from downloading the JDK? …anyway, after finally installing the latest version for 32 and 64 bit JDKs - tried out the 64bit bullet dll



Outcome:

22-Apr-2012 23:15:52 com.jme3.scene.Node attachChild

INFO: Child (Statistics View) attached to this node (Gui Node)

22-Apr-2012 23:15:52 com.jme3.bullet.BulletAppState startPhysicsOnExecutor

SEVERE: null

java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: com/bulletphysics/dynamics/DynamicsWorld

at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)

at java.util.concurrent.FutureTask.get(Unknown Source)

at com.jme3.bullet.BulletAppState.startPhysicsOnExecutor(BulletAppState.java:86)

at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:126)

at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:158)

at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:127)

at jme3test.bullet.TestBrickWall.simpleInitApp(TestBrickWall.java:88)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:231)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: com/bulletphysics/dynamics/DynamicsWorld



Yes, so need to do some further investigation is needed by me here.

The previous problem was caused by deleting the jbullet.jar but forgetting to delete the JME3-jbullet.jar!



Now there’s a completely different error:

[java]02-May-2012 18:59:39 com.jme3.bullet.BulletAppState startPhysicsOnExecutor

SEVERE: null

java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: com.jme3.bullet.PhysicsSpace.createPhysicsSpace(FFFFFFIZ)J

at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)

at java.util.concurrent.FutureTask.get(FutureTask.java:83)

at com.jme3.bullet.BulletAppState.startPhysicsOnExecutor(BulletAppState.java:86)

at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:126)

at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:158)

at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:127)

at jme3test.bullet.TestBrickWall.simpleInitApp(TestBrickWall.java:88)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:231)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)

at java.lang.Thread.run(Thread.java:662)

Caused by: java.lang.UnsatisfiedLinkError: com.jme3.bullet.PhysicsSpace.createPhysicsSpace(FFFFFFIZ)J

at com.jme3.bullet.PhysicsSpace.createPhysicsSpace(Native Method)

at com.jme3.bullet.PhysicsSpace.create(PhysicsSpace.java:146)[/java]



Thought that this kind of problem would be picked up during the c compile stage …hmmm.:frowning:

Okay, question: how does JME3 pickup the dll? Does the filename need a suffix of 64?



Basically the dll is in the correct location within the JME3-bullet-natives.jar, when Java 32bit is used there’s the error:

[java]bulletjme.dll: Can’t load AMD 64-bit .dll on a IA 32-bit platform[/java]

When using Java 64bit:

[java]java.lang.UnsatisfiedLinkError: com.jme3.bullet.PhysicsSpace.createPhysicsSpace(FFFFFFIZ)J[/java]

Looking at the code, and dll using dependancy walker the method is there, however what I am noticing is that unlike the lwjg64l.dll and OpenAL64.dll the bullet.dll is not being copied to the working directory …this suggests that the dll is not being found, so maybe because of the filename?



Thoughts?

NB Eventually I’ll get around to trying this theory out, but it’ll be more expedient if I could avoid trial and error where possible;)

The 64bit version would have to be named “bulletjme64.dll”: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/desktop/com/jme3/system/Natives.java

Quick update



Right, got around to sorting the build script to create a dll with the correct name and the bullet 64 bit works when the dll is correctly named 8).



As mentioned I’ve started altering the build-bullet-natives.xml to compile both a 32bit & 64 version of the dll’s.

Currently though the same dll is being built under both names (as I’ve not tied in mingw paths as variables in the properties, so the same one is used both times).



This still worth pursing?

1 Like
@monkey_scratches_head said:
This still worth pursing?

definitely, another solution involved changing the bullet sources.. what build are you talking about exactly? The cross platform one on linux or the one on windows? For the former it should already separate the filenames correctly, for the latter it should best just create the one thats needed for the current platform as that is whats being used to test native bullet changes during development on windows.
@normen said:
what build are you talking about exactly? The cross platform one on linux or the one on windows?

Windows

@normen said:
another solution involved changing the bullet sources

No, no altering of bullet sources required for 64bit on Windows


@normen said:
for the latter it should best just create the one thats needed for the current platform as that is whats being used to test native bullet changes during development on windows.

Ah, right. Much simpler then. I was aiming for getting both the 32 & 64 dlls built on a 64bit Window box!
I'll correct the ant script so it only builds the appropriate target (32 or 64) using the environment variables for the mingw and cmake, then post the diffs :o

Okay, it’s done!



With Windows7 (64 bit) using the process outlined below and the diff’d script both 32bit and 64bit JME bullet natives can be produced :smiley:



Change the PATH environement to include 32bit Java and 32bit MinGW (reboot Windows)

(JDK: 1.6_31, MinGW: mingw-w32-bin_i686-mingw_20111219.zip)



%PATH%=%PATH%;C:DataDevelopmentCMake 2.8bin;C:DataDevelopmentmingw32_4.7.0bin;C:Program Files (x86)Javajdk1.6.0_31bin



Make sure the build/bullet-native is deleted



Then…



ant clean

ant build-bullet-natives

ant run-bullet-native



Run test com.jme.bullet.TestBrickWall







Change the PATH environement to include 64bit Java and 64bit MinGW (reboot Windows)

(JDK: 1.6_31, MinGW: mingw-w64-bin_i686-mingw_20111220.zip)



%PATH%=%PATH%;C:DataDevelopmentCMake 2.8bin;C:DataDevelopmentmingw64_4.7.0bin;C:Program FilesJavajdk1.6.0_31bin



Then…



ant clean

ant build-bullet-natives

ant run-bullet-native



Run test com.jme.bullet.TestBrickWall







[patch]Index: build-bullet-natives.xml

===================================================================

— build-bullet-natives.xml (revision 9112)

+++ build-bullet-natives.xml (working copy)

@@ -106,6 +106,12 @@

<isfalse value="${haveBulletLibrary}"/>

</and>

</condition>

  •    &lt;condition property=&quot;doBuildWindowsBase64&quot;&gt;<br />
    
  •        &lt;and&gt;<br />
    
  •   		&lt;istrue value=&quot;${isWindows}&quot;/&gt;<br />
    
  •            &lt;isfalse value=&quot;${haveBulletLibrary64}&quot;/&gt;<br />
    
  •        &lt;/and&gt;<br />
    
  •    &lt;/condition&gt;<br />
    

<condition property="doBuildSolarisBase">

<and>

<istrue value="${isSolaris}"/>

@@ -162,15 +168,24 @@

<condition property="doBuildWindowsBinary">

<and>

<istrue value="${isWindows}"/>

  •            &lt;istrue value=&quot;${haveBuiltBulletLibrary}&quot;/&gt;<br />
    
  •            &lt;istrue value=&quot;${haveBuiltBulletLibrary}&quot;/&gt;<br />
    
  •            &lt;isfalse value=&quot;${is64bit}&quot;/&gt;<br />
    

</and>

</condition>

  •    &lt;condition property=&quot;doBuildWindowsBinary64&quot;&gt;<br />
    
  •        &lt;and&gt;<br />
    
  •            &lt;istrue value=&quot;${isWindows}&quot;/&gt;<br />
    
  •            &lt;istrue value=&quot;${haveBuiltBulletLibrary64}&quot;/&gt;<br />
    
  •            &lt;istrue value=&quot;${is64bit}&quot;/&gt;<br />
    
  •   	&lt;/and&gt;<br />
    
  •    &lt;/condition&gt;<br />
    

<condition property="doBuildSolarisBinary">

<and>

<istrue value="${isSolaris}"/>

<istrue value="${haveBuiltBulletLibrary}"/>

  •        &lt;/and&gt;<br />
    
  •    &lt;/condition&gt;<br />
    
  •            &lt;isfalse value=&quot;${is64bit}&quot;/&gt;<br />
    
  •   	&lt;/and&gt;<br />
    
  •    &lt;/condition&gt;<br />
    

</target>



<target name="build-bullet-natives" description="builds the native bullet library for the platform being run on and for android if NDK available" depends="create-native-headers, compile-bullet-sources, compile-native-library, compile-android">

@@ -255,7 +270,7 @@

<delete file="bullet-api-diff.xml"/>

</target>


  • <target name="compile-native-library" description="compiles the native libbulletjme binary for the current platform" depends="-check-conditions-post, -create-folders, -nativelib-osx, -nativelib-windows, -nativelib-linux, -nativelib-linux-64, -nativelib-linux-mingw, -nativelib-linux-mingw-64, -nativelib-solaris"/>
  • <target name="compile-native-library" description="compiles the native libbulletjme binary for the current platform" depends="-check-conditions-post, -create-folders, -nativelib-osx, -nativelib-windows, -nativelib-windows-64, -nativelib-linux, -nativelib-linux-64, -nativelib-linux-mingw, -nativelib-linux-mingw-64, -nativelib-solaris"/>



    <target name="-create-folders" description="creates the needed folders">

    <mkdir dir="${bullet.source.dir}"/>

    @@ -415,10 +430,11 @@

    </target>



    <target name="-nativelib-windows" if="doBuildWindowsBinary">
  •    &lt;echo message=&quot;Building Windows version of native bullet&quot;/&gt;<br />
    
  •    &lt;echo message=&quot;Building Windows 32bit version of native bullet&quot;/&gt;<br />
    

<mkdir dir="${bullet.output.dir}/windows"/>

<cc multithreaded="" name="${bullet.windows.compiler}" warnings="none" debug="${bullet.compile.debug}" outtype="shared" outfile="${bullet.output.dir}/windows/${bullet.library.name}" objdir="build/bullet-native">

  •        &lt;fileset dir=&quot;${bullet.source.dir}&quot;&gt;<br />
    

+

  •   &lt;fileset dir=&quot;${bullet.source.dir}&quot;&gt;<br />
    

<include name="*.cpp">

</include>

</fileset>

@@ -435,7 +451,31 @@

</cc>

<delete file="${bullet.output.dir}/windows/history.xml"/>

</target>

+

  • <target name="-nativelib-windows-64" if="doBuildWindowsBinary64">
  •    &lt;echo message=&quot;Building Windows 64bit version of native bullet&quot;/&gt;<br />
    
  •    &lt;mkdir dir=&quot;${bullet.output.dir}/windows&quot;/&gt;<br />
    
  •    &lt;cc multithreaded=&quot;&quot; name=&quot;${bullet.windows.compiler}&quot; warnings=&quot;none&quot; debug=&quot;${bullet.compile.debug}&quot; outtype=&quot;shared&quot; outfile=&quot;${bullet.output.dir}/windows/${bullet.library.name}64&quot; objdir=&quot;build/bullet-native&quot;&gt;<br />
    

+ <compilerarg value="-fpermissive"/>
+ <fileset dir="${bullet.source.dir}">
+ <include name="*.cpp">
+ </include>
+ </fileset>
+ <includepath path="${bullet.java.include}"/>
+ <includepath path="${bullet.java.include}/win32"/>
+ <includepath path="${bullet.bullet.include}"/>
+ <!--compilerarg value="-m32"/-->
+ <linker name="${bullet.windows.compiler}" debug="${bullet.compile.debug}" >
+ <linkerarg value="-o${bullet.library.name}64.dll" />
+ <linkerarg value="--kill-at" />
+ <linkerarg value="-static"/>
+ <libset dir="build/bullet-base" libs="BulletMultiThreaded,BulletDynamics,BulletCollision,LinearMath"/>
+ </linker>
+ </cc>
+ <delete file="${bullet.output.dir}/windows/history.xml"/>
+ </target>
+
<target name="compile-android" description="compiles libbulletjme using the Android NDK" depends="-check-android-ndk" if="haveAndoidNdk">
<!-- create the android subdirectory in jarcontent for the libbulletjme.so shared library -->
<mkdir dir="${bullet.output.base}/android"/>
@@ -501,6 +541,8 @@
<arg value="-DBUILD_EXTRAS:BOOL=OFF"/>
<arg value="-DBUILD_DEMOS:BOOL=OFF"/>
<arg value="-DCMAKE_BUILD_TYPE=Release"/>
+ <arg value="-DCMAKE_CXX_FLAGS=-fpermissive"/>
+
<arg value="."/>
<arg value="-G"/>
<arg value="MinGW Makefiles"/>
[/patch]

Easy eh?
1 Like

cool, so it seems to be mainly the -fpermissive flag eh? Gonna see if I can get that to work in the linux-mingw target so it gets built on the nightly/stable hudson server…

Edit: Narf, thats the android target? oO Whats different? The mingw setup?

Edit2: nvm, I’m retarded ^^

1 Like

Wee, it did build on linux and produced this: http://hub.jmonkeyengine.org/bulletjme64.dll If anyone could try this dll I’d be most grateful.



Edit: Also updated the build script so all OS users should now be able to compile and run native bullet for jme3 directly from the ant script / netbeans project. (CMake and MinGW needed on windows, see the trunk/engine/bullet-native-build.txt file for more infos)

2 Likes