How to compile JInput on 64-bit for 32-bit

I would like to build a 32-bit version of JInput for GNU/Linux. The problem is, I only have 64-bit systems. Is it possible to build a 32-bit version from the 64-bit version? Or will I need to result to using a 32-bit VM?

The changes that I have made for GNU/Linux are:

  • Added grab feature
  • Added detecting if controllers have disconnected or connected

Hi

The way the os arch is detected is by whatever the JVM tells it, so on windows, I build both on a 64 bit box by running 1 ant script in a 32 bit jdk and then again in a 64 bit, which spits out both. It can do this because 64 bit visual studio has both 32 and 64 bit compilers and libraries. If you 64 bit linux system has 32 bit libs for linking and can compile 32 bit code, then I see no reason that the same trick shouldn’t work.

HTH

Endolf

Thanks endolf. I tried setting a 32-bit jvm that but it doesn’t seem to work.

I suspect it has to do with the following condition.

   <target name="compileNativeJinputLib">
                <exec executable="uname" outputproperty="hwplatform">
                        <arg value="-m"/>
                </exec>

uname -m reports a 64-bit kernel. Maybe I’ll just install a 32-bit VM for the time being …

What happens if you frig it?, force it to do 32 bit and see if it compiles or not :slight_smile:

Endolf

It seems that your suggestion works. At least it compiles. I’ll have to check it in a VM to see that it indeed compiled a 32-bit version and not a 64-bit.
Thanks for your help!!!

Cool, if it works, I might try and find a way to switch it based on the jdk used to compile, that way a 64 bit machine can compile both based on the jdk used to run the ant task.

Endolf

Something like this


<condition property="libname" value="${libname64}" else="${libname32}">
    <equals arg1="${os.arch}" arg2="amd64"/>
</condition>

Where on 32-bit jvms os.arch = i386 and on 64-bit jvms os.arch = amd64

So it ended up not working. It produced a 64-bit .so :frowning:
I’m going to compile it on a 32-bit system now …