Обсуждение: Is there a way to build 32-bit mode on 64-bit Linux boxes?

Поиск
Список
Период
Сортировка

Is there a way to build 32-bit mode on 64-bit Linux boxes?

От
Wayne Schroeder
Дата:
I'm trying to build postgresql and odbc from source on x86_64 Linux
hosts but I need to run them in 32-bit addressing mode since my app is
not 64-bit ready yet.

Simple test programs can be built as 32-bit apps (if the libraries are
installed) via gcc's -m32 option.

I checked for postgres configure options to do something similar, but
didn't find anything.  I experimented with setting environment
variable CFLAGS to -m32 and it does seem to be picked up by
configure/make, but then 'ld' gets errors:
  /usr/bin/ld -r -o SUBSYS.o heaptuple.o indextuple.o indexvalid.o
  printtup.o scankey.o tupdesc.o
  /usr/bin/ld: Relocatable linking with relocations from format
  elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not
  supported
So ld needs some additional options of some sort, but it looks like
that would involve some complicated specifications of various libraries.

I checked the archives, but didn't see anything about this.

Is there any way to do this?  Any plans to add it?  Any hints on what
I could try?

Thanks much,

 - Wayne -

(This is my home email address as I was unable to post from work
(schroede@sdsc.edu))
http://users.sdsc.edu/~schroede
SDSC Storage Resource Broker group  http://www.sdsc.edu/srb




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

От
"Joshua D. Drake"
Дата:
Wayne Schroeder wrote:
> I'm trying to build postgresql and odbc from source on x86_64 Linux
> hosts but I need to run them in 32-bit addressing mode since my app is
> not 64-bit ready yet.

What does your app care? Unless you are writing the app directly to libpq?

Which version of Linux are you running?

Sincerely,

Joshua D. Drake


>
> Simple test programs can be built as 32-bit apps (if the libraries are
> installed) via gcc's -m32 option.
>
> I checked for postgres configure options to do something similar, but
> didn't find anything.  I experimented with setting environment
> variable CFLAGS to -m32 and it does seem to be picked up by
> configure/make, but then 'ld' gets errors:
>   /usr/bin/ld -r -o SUBSYS.o heaptuple.o indextuple.o indexvalid.o
>   printtup.o scankey.o tupdesc.o
>   /usr/bin/ld: Relocatable linking with relocations from format
>   elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not
>   supported
> So ld needs some additional options of some sort, but it looks like
> that would involve some complicated specifications of various libraries.
>
> I checked the archives, but didn't see anything about this.
>
> Is there any way to do this?  Any plans to add it?  Any hints on what
> I could try?
>
> Thanks much,
>
>  - Wayne -
>
> (This is my home email address as I was unable to post from work
> (schroede@sdsc.edu))
> http://users.sdsc.edu/~schroede
> SDSC Storage Resource Broker group  http://www.sdsc.edu/srb
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq


--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

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

От
"Mohan, Ross"
Дата:
I'm trying to build postgresql and odbc from source on x86_64 Linux hosts but I need to run them in 32-bit addressing
modesince my app is not 64-bit ready yet. 

||  I'm kinda new to this, but...unless your app is compiled and linked into PG shared objects,
   I don't think it'll care whether it's talking to a 32 or 64 bit executable. Now, if 32  and 64
   cannot coexist on your Linux builds, that's a different issue.

Simple test programs can be built as 32-bit apps (if the libraries are
installed) via gcc's -m32 option.

I checked for postgres configure options to do something similar, but didn't find anything.  I experimented with
settingenvironment variable CFLAGS to -m32 and it does seem to be picked up by configure/make, but then 'ld' gets
errors:
  /usr/bin/ld -r -o SUBSYS.o heaptuple.o indextuple.o indexvalid.o
  printtup.o scankey.o tupdesc.o
  /usr/bin/ld: Relocatable linking with relocations from format
  elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not
  supported
So ld needs some additional options of some sort, but it looks like that would involve some complicated specifications
ofvarious libraries. 

I checked the archives, but didn't see anything about this.

Is there any way to do this?  Any plans to add it?  Any hints on what I could try?

||  you need to set the environment in the os/shell. I don't know how to do this
   on your system. on AIX, though, it's "export OBJECT_MODE=64".



Thanks much,

 - Wayne -

(This is my home email address as I was unable to post from work
(schroede@sdsc.edu))
http://users.sdsc.edu/~schroede
SDSC Storage Resource Broker group  http://www.sdsc.edu/srb




---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

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

От
Wayne Schroeder
Дата:
Subject: Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux
boxes?
Date: Wed, 08 Jun 2005 11:34:42 -0700
From: Wayne Schroeder <waynes@san.rr.com>
To: AgentM <agentm@themactionfaction.com>
References: <42A722C2.E5CDE439@san.rr.com>
<1AF75916-6B2E-4708-ADC2-6599946626EA@themactionfaction.com>

Thanks for responding, everyone (Ross, Joshua, and AgentM), you all have
similar questions so I'll respond to them all here.  (I'm glad this is
finally working, don't know why my work email (linux emacs) didn't get
thru).

My App is the Metadata Catalog (MCAT) of the SDSC Storage Resource
Broker -
(see http://www.sdsc.edu/srb/ ).  The MCAT runs on various OSes (various
versions of Linux, Mac OS X, Solaris, AIX, etc (not Windows yet, but our
client programs do) and can use various RDBMSs (Postgres, Oracle, DB2,
etc).  The SRB provides a distributed file system, datagrid, or digital
library, depending how you look at it (see web site and FAQ); and is
used in
various large-scale scientific (NSF) or archival projects (NARA), etc.
SRB/MCAT is freely available to academic and government sites (altho it
is
not, unfortunately, open source).

Quite a few SRB sites are now using Postgresql, at least for testing and
experimentation, partly because I developed an install script that
configures and builds everything (postgres, odbc, and srb) fairly
easily.
So I know little about configuring and building odbc and postgres, but I
don't know much about them beyond that.

The MCAT code isn't ready for 64-bit addressing yet.  It's on our todo
list,
but it will be a fairly big project and it will be a while before we can
get
to it.

The MCAT process is using ODBC to talk to posgresql.  It sounds like I
could
build MCAT and ODBC in 32-bit mode.  But would ODBC then have any
problem
talking with a 64-bit postgresql server?  You've confirmed that 32-bit
clients can talk to 64-bit postgres, but does that include ODBC too?  I
think I tried to build ODBC in 32-bit mode, ran into some problems, and
wasn't sure this setup would work anyway.  If you'all think that should
work, I'll try it again.

Thanks,

 - Wayne -
http://users.sdsc.edu/~schroede/


AgentM wrote:

> Even if your app isn't 64-bit-ready, what does that have to do with
> postgresql? Not much changes when run as a 64-bit app except maybe
> that it is slower. Is there a specific issue you have come across
> that prevents you from using 64-bit postgresql? You can still use 32-
> bit compiled clients against a 64-bit postgresql server.
>
> On Jun 8, 2005, at 11:54 AM, Wayne Schroeder wrote:
>
> > I'm trying to build postgresql and odbc from source on x86_64 Linux
> > hosts but I need to run them in 32-bit addressing mode since my app is
> > not 64-bit ready yet.
> >
> > Simple test programs can be built as 32-bit apps (if the libraries are
> > installed) via gcc's -m32 option.
> >
> > I checked for postgres configure options to do something similar, but
> > didn't find anything.  I experimented with setting environment
> > variable CFLAGS to -m32 and it does seem to be picked up by
> > configure/make, but then 'ld' gets errors:
> >   /usr/bin/ld -r -o SUBSYS.o heaptuple.o indextuple.o indexvalid.o
> >   printtup.o scankey.o tupdesc.o
> >   /usr/bin/ld: Relocatable linking with relocations from format
> >   elf32-i386 (heaptuple.o) to format elf64-x86-64 (SUBSYS.o) is not
> >   supported
> > So ld needs some additional options of some sort, but it looks like
> > that would involve some complicated specifications of various
> > libraries.
> >
> > I checked the archives, but didn't see anything about this.
> >
> > Is there any way to do this?  Any plans to add it?  Any hints on what
> > I could try?
>
> |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-
> AgentM
> agentm@themactionfaction.com
> |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 6/8/05

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

От
Wayne Schroeder
Дата:
I need to back up a bit and explain why I was hoping there was a better way to
build everything as 32-bit.

On a 64-bit Linux host, if I just try to build as usual, I get errors in my
MCAT app since it is not 64-bit compatible yet. If I try to build everything
(postgresql, odbc, and mcat) 32-bit, I get different errors, starting with
postgresql.  If I try to build postgresql 64-bit and odbc 32-bit I get
different errors.

(To try to build in 32-bit mode, I have my install.pl script set environment
variables CFLAGS and LDFLAGS to -m32.  This may not be all that is needed, but
I figured it was worth a shot.)

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

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?

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

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).

 - Wayne -



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

От
"Mohan, Ross"
Дата:
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
warningfor:  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
apparentlyit 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
havea 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