4 messages in net.java.dev.jna.usersRe: [jna-users] Building 32-bit JNA o...
FromSent OnAttachments
Albert StrasheimMay 19, 2008 2:53 pm 
Timothy WallMay 19, 2008 3:22 pm 
Albert StrasheimMay 19, 2008 9:20 pm 
Wayne MeissnerMay 19, 2008 11:18 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Building 32-bit JNA on 64-bit LinuxActions...
From:Wayne Meissner (wmei@gmail.com)
Date:May 19, 2008 11:18:55 pm
List:net.java.dev.jna.users

First, make sure building 32bit executables works - e.g. have you tried building a simple 32bit "Hello, World" C program using gcc -m32 ?

Then, I'd suggest just trying to get libffi building by itself - just to take ant out of the equation.

Something like: CC="gcc -m32" LD="gcc -m32" ./configure --disable-static --with-pic=yes

You might need a few more flags to be tweaked in there - its been a while since I mucked with libffi.

If that works, then have a look at native/Makefile. It will need to be tweaked to explicitly supply the -m32 args. e.g.

# Enable 32-bit builds on 64bit machines ifeq ($(ARCH),i386) CC += -m32 LD += -m32 endif

On linux and solaris, you can build both 32bit and 64bit binaries, it would be nice to have these built all in one hit and bundled up into their respective jar files without having to explicitly build for each arch.

Side note: the ANT_OPTS flags are only useful on platforms where both 32bit and 64bit jvms can be invoked from the common java command. e.g. on MacOS or Solaris to invoke the 32bit jvm, you do

java -d32

and to invoke the 64bit, you do

java -d64

Unless its changed recently, on linux you normally only get one arch of java installed and callable by the default java path - i.e. either 32bit _or_ 64bit.

2008/5/20 Albert Strasheim <full@gmail.com>:

Hello,

On Tue, May 20, 2008 at 12:23 AM, Timothy Wall <twal@dev.java.net> wrote:

ANT_OPTS=-d32 ant test

Basically you need to point ant to a 32-bit JVM.

I'm running ant using a 32-bit JVM and did a "clean, test", but libffi still seems to be building 64-bit libraries.

If I try to force gcc to make 32-bit binaries, using

CC="gcc -m32" ANT_OPTS="-d32 -DCC='gcc -m32'" ant clean default

I get

[exec] Configuring libffi (i386) ... [exec] true "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=" "CXXFLAGS=" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/bin/sh /export/home/albert/work/jnalib/native/libffi/missing --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/sh" "exec_prefix=/usr/local" "infodir=/usr/local/info" "libdir=/usr/local/lib" "prefix=/usr/local" "AR=ar" "AS=as" "CC=gcc -m32" "CXX=g++" "LD=/usr/x86_64-suse-linux/bin/ld -m elf_i386" "NM=/usr/bin/nm -B" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do # make ... [exec]
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file `/export/home/albert/work/jnalib/build/native/dispatch.o' is incompatible with i386:x86-64 output

and other errors and then it fails.

I guess some other flag still needs tweaking?

Regards,