Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?

From: "Mohan, Ross" <RMohan(at)arbinet(dot)com>
To: <pgsql-ports(at)postgresql(dot)org>
Subject: Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?
Date: 2005-06-10 22:44:42
Message-ID: CC74E7E10A8A054798B6611BD1FEF4D30625DB77@vamail01.thexchange.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


Wayne,

I'd try setting LDFLAGS to ' --verbose --format elf32-i386 '

Let's see results of that. (There are other values of this that
might work; that's my best guess for now)

We also might get there by setting

export GNUTARGET='elf32-i386' in place of, or, in ADDITION to, the above.

Let us know how it works? (or, via --verbose, how it breaks!)

Good Luck!

-----Original Message-----
From: Wayne Schroeder [mailto:schroede(at)zuri(dot)sdsc(dot)edu]
Sent: Fri 10-Jun-05 6:06 PM
To: Mohan, Ross
Cc:
Subject: Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?

I would read the LD man page (don't know on Linux), because
my "-b32" suggestion was for AIX. It would simply have been
lucky if it worked on Linux.

Right, but it was worth a try.

I've looked at the ld man page and ld --help output, and tried a few
things to no avail.

It looks, to me, like the following should work, but it doesn't:
% ld --oformat elf_x86_64 t64.o
ld: target elf_x86_64 not found
cipres0:/users/u4/schroede/c %

I'll send you the ld --help and man page output. Lots of stuff...

it's clear the linker is trying to build 64 bit libraries from
32 bit (compiler-provided) objects. Gotta stop that.

Yes, I agree.

in your second line/failure, you need to show me the
line *IN* the config.log file (and surrounding 10 lines,
above and below) where this failure occurs. that'll be
instructive.

i betcha it's "unrecognized flag" or somesuch.

You're right; I hadn't look far enough up in config.log; it has:
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
configure:1955: $? = 0
configure:1957: gcc -V </dev/null >&5
gcc: `-V' option must have argument
configure:1960: $? = 1
configure:1986: checking for C compiler default output
configure:1989: gcc -m32 -b32 conftest.c >&5
gcc: `-b' must come at the start of the command line
configure:1992: $? = 1

So, yes, it's just that the -b32 is invalid.

also, please type "set" at the command line, while
you are "postgres" (or whichever user you using for PG)
and send/post results.

cipres0:/scratch/slocal/schroede/test3/postgresql-7.4.3 % set
_

addsuffix
argv ()
csubstnonl
cwd /scratch/slocal/schroede/test3/postgresql-7.4.3
dirstack /scratch/slocal/schroede/test3/postgresql-7.4.3
echo_style bsd
edit
filec
gid 200
group sys200
history 150
home /users/u4/schroede
ignoreeof
killring 30
loginsh
noclobber
owd /scratch/slocal/schroede/test3
path (/usr/bin /bin /usr/sbin /sbin /usr/sdsc/bin /users/u4/schroede/bin /usr/sdsc/bin /usr/sdsc/etc /usr/bin/X11 /usr/etc /usr/sbin /usr/local/sdscbin /usr/local/bin . /usr/local/apps/globus-2.0/bin /scratch/slocal/autoconf-2.57/install/bin)
prompt cipres0:/scratch/slocal/schroede/test3/postgresql-7.4.3 %
prompt2 %R?
prompt3 CORRECT>%R (y|n|e|a)?
shell /bin/csh
shlvl 1
status 0
tcsh 6.14.00
term xterm
tty pts/0
uid 122
user schroede
version tcsh 6.14.00 (Astron) 2005-03-25 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,color,filec
cipres0:/scratch/slocal/schroede/test3/postgresql-7.4.3 %

Thanks,

- Wayne -

-----Original Message-----
From: Wayne Schroeder [mailto:schroede(at)zuri(dot)sdsc(dot)edu]
Sent: Fri 10-Jun-05 2:15 PM
To: Mohan, Ross
Cc:
Subject: Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?
Ross,

Thanks for the suggestion, but it didn't work for me. My host is
% uname -a
Linux cipres0 2.6.9-6.37.ELsmp #1 SMP Tue Mar 29 15:46:31 EST 2005 x86_64 x86_64 x86_64 GNU/Linux

Here are three tests for building postgresql:

With CFLAGS="-m32":
configure runs OK but gmake fails with:
mkdir man7
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not supported
gmake[4]: *** [SUBSYS.o] Error 1
gmake[3]: *** [common-recursive] Error 2
gmake[2]: *** [access-recursive] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2

With CFLAGS="-m32" and LDFLAGS="-b32"
configure fails:
/configure --prefix=/scratch/slocal/schroede/test3/pgsql --enable-odbc --without-readline
configure: error: C compiler cannot create executables
(config.log has: configure:2019: error: C compiler cannot create executables)

With CFLAGS="-m32" and LDFLAGS="-m32" (just in case)
Same thing as without LDFLAGS set:
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not supported
gmake[4]: *** [SUBSYS.o] Error 1
gmake[3]: *** [common-recursive] Error 2
gmake[2]: *** [access-recursive] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2

When building SRB/MCAT (my application), our Makefiles are using gcc
to do the linking. So for them, I think passing in "-m32" would work
as it would tell gcc to do 32-bit addressing, and it would then pass
on in the appropriate options. But it looks like postgresql is doing
the linking differently.

Feel free to post this and your reply if you wish; I can't post from
this email account.

Thanks,

- Wayne -

X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0
content-class: urn:content-classes:message
Date: Fri, 10 Jun 2005 15:22:18 -0000
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?
Thread-Index: AcVsgpWiOhQiFBALRceKM0wFGNRoiABTQprA
From: "Mohan, Ross" <RMohan(at)arbinet(dot)com>
X-MIME-Autoconverted: from quoted-printable to 8bit by postal.sdsc.edu id j5AFN6P07534

Wayne,

Comments inlined " || " below.

- Ross

-----Original Message-----
<snip>

When trying to build all 3 as 32-bit, I get this when building postgresql: ./configure --prefix=/scratch/slocal/schroede/test2/pgsql --enable-odbc --without-readline gmake
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386
(heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not supported
gmake[4]: *** [SUBSYS.o] Error 1
gmake[3]: *** [common-recursive] Error 2
gmake[2]: *** [access-recursive] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2

|| I do believe you'll eventually need to tell your linking-loader/ld that you
are trying to do 32-bit as well. For me, the flag is "-b32".

When I try to build postgresql 64-bit and odbc 32-bit, postgresql builds fine, but I get this when trying odbc: ./configure --prefix=/scratch/slocal/schroede/test2/pgsql --enable-static gmake
/usr/bin/ld: warning: i386 architecture of input file `info.lo' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `bind.lo' is incompatible with i386:x86-64 output and the same warning for: columninfo.lo, connection.lo, convert.lo, drvconn.lo, environ.lo, execute.lo, lobj.lo, win_md5.lo, misc.lo options.lo, pgtypes.lo, psqlodbc.lo, qresult.lo, results.lo, socket.lo, parse.lo, statement.lo, tuple.lo, tuplelist.lo, dlg_specific.lo, odbcapi.lo, multibyte.lo, gpps.lo, odbcapi30.lo, pgapi30.lo, and info30.lo. Those are warnings, but apparently it makes the library 64-bit because then when it tries to link my MCAT/SRB app, I get: gmake
/usr/bin/ld: skipping incompatible /scratch/slocal/schroede/test2/pgsql/lib/libpsqlodbc.a when searching for -lpsqlodbc
/usr/bin/ld: cannot find -lpsqlodbc
collect2: ld returned 1 exit status

So is this second mode, 64 bit postgresql and 32 bit odbc, that I should try to get working? Or would the all-32-bit have a better chance?

|| same comment as above. specify in LDFLAGS. configure/gmake should pick it up and pass to ld correctly...

Am I the only one with this 32/64-bit problem?

|| nope.

We will convert our app to 64-bit sometime, but if there is a fairly easy workaround for now, I'd like to make use of it. Otherwise, we'll just continue to say we can't support MCAT on 64-bit linux boxes (for now).

|| The Force has power over weak minds.

- Wayne -

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

p

Browse pgsql-ports by date

  From Date Subject
Next Message Mohan, Ross 2005-06-10 23:20:27 Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?
Previous Message Mag Gam 2005-06-09 08:54:16 Re: AIX binaries