D3DX81ab.dll: Can't load IA 32-bit .dll on a AMD 64-bit ...

Discussion about Irrlicht's Java wrapper
Post Reply
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

D3DX81ab.dll: Can't load IA 32-bit .dll on a AMD 64-bit ...

Post by Josh1billion »

Hello all,

I'm trying to set up an environment in Eclipse where I can develop a game utilizing Jirr.

I've been following along with this helpful tutorial:
http://www.brighthub.com/internet/web-d ... 15493.aspx

I copied the source code from that tutorial (from the "Getting Started" section's example in particular). I then set up Eclipse to link to the Jirr JARs and set the library build path to the folder where the DLL's are located. Compilation went fine, but running the application resulted in this exception being thrown:

Code: Select all

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Josh\Documents\Eclipse projects\client\jirrtest\lib\D3DX81ab.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(Unknown Source)
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
	at Start.main(Start.java:6)
The line of code in question is the line which loads the Direct3D8 DLL, as you might imagine:
[code System.loadLibrary("D3DX81ab");[/code]

The meaning of the exception seems obvious: my system is a 64-bit machine, and the DLL was compiled for 32-bit machines. I'd have imagined it to run fine regardless as the majority of 32-bit applications do, but as we see here, that's not the case.

The only solution I see right now would be to compile 64-bit versions of the DLL's myself. Two concerns arise there, however:

1. I'm not entirely sure about how to go about doing that, but more importantly..
2. I want to ensure that my users (on both 32-bit and 64-bit machines) can run my application fine. Will this be an issue?

I realize Jirr's hasn't seen much life lately (unfortunately), but if someone could help me get past this hurdle, I would very greatly appreciate it. :)
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I'd suggest to skip the DX8 lib all together. Makes things much simpler nowadays.
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Post by Josh1billion »

Thanks for the reply, hybrid.

I've tried commenting out the line:
System.loadLibrary("D3DX81ab");

however, the next two libraries loaded (irrlicht.dll and irrlicht_wrap.dll) then result in the same error-- cannot load a 32-bit IA DLL on a 64-bit AMD machine.

Commenting out all three, of course, results in link errors as you'd expect:

Code: Select all

Exception in thread "main" java.lang.UnsatisfiedLinkError: net.sf.jirr.JirrJNI.swig_module_init()V
	at net.sf.jirr.JirrJNI.swig_module_init(Native Method)
	at net.sf.jirr.JirrJNI.<clinit>(JirrJNI.java:3537)
	at net.sf.jirr.dimension2di.<init>(dimension2di.java:41)
	at EngineManager.startupEngineManager(EngineManager.java:52)
	at Start.main(Start.java:11)
Are there any other possible solutions? Or is it going to be virtually impossible for anyone running a 64-bit machine to use Jirr?
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, but those two dlls can be recompiled by you. That would be at least feasible. Maybe there's also a way to access the 32bit dlls from within Java, but that's probably rather off-topic for a jirr forum.
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Post by Josh1billion »

Hmm, so I would check (in Java) whether the user's system is 32- or 64-bit and then load the appropriate DLL accordingly? Sounds like that could work.. I wonder if I'd have to account for Intel vs AMD as well (I'd think not, but the exception mentions IA vs AMD). I'll try it when I get home today.

Thanks again, Hybrid. :)
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Post by Josh1billion »

After compiling a 64-bit version of Irrlicht 1.4.2 (which didn't solve the issue :evil: unless I compiled it wrong), I did some more googling and found that the issue has occurred with other libraries as well. It seems it's related to the JDK and/or JVM being 64-bit. The proposed solution is to uninstall my JDK, which is 64-bit (and possibly my JRE as well), and install the 32-bit equivalent.

I'm downloading the 32-bit version of the latest JDK right now. I'll post again with results soon.

EDIT: Got it to work! The steps I took are as follows:

1. Uninstalled my JRE and JDK, then installed their 32-bit equivalents.

2. At this point, my Eclipse installation no longer started up properly, so I re-downloaded it, making sure to download the 32-bit version this time (not sure what I had before, but it was probably 64-bit).

3. Upon compiling & running the sample code again, I received another error message, which unfortunately I don't remember off-hand. Something about Irrlicht.dll. So I replaced the Irrlicht.dll with which the Jirr download provided me with the Irrlicht.dll from the win32-gcc folder of my own irrlicht 1.4.2 installation that I had laying around from two years ago.

4. The application finally started, but it exited with an error message describing how Direct3D9 was not compiled into the DLL or something. So I went into the sample code and told it to render using OpenGL instead of Direct3D (replaced EDT_DIRECT3D9 with EDT_OPENGL).

Everything seems to work properly now. :)
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
LizardGamer
Posts: 83
Joined: Fri May 28, 2010 8:59 am
Location: Perth, Australia

Post by LizardGamer »

When I have the 32bit installed instead of the 64-bit one, CMD brings up the error of 'Java is not recognised as an internal or external command'.

But when I have the 64-bit one installed I have the error 'IA 32-bit doesn't work on AMD 64-bit" etc.

Anyone know what to do to fix it?
Post Reply