Skip site navigation (1) Skip section navigation (2)

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 23:20:27
Message-ID: CC74E7E10A8A054798B6611BD1FEF4D30625DB78@vamail01.thexchange.com (view raw or flat)
Thread:
Lists: pgsql-ports
Yikes -- couple things come to mind

1) your linux (which flavor and version, please, Wayne?) might
    have been installed with "64 bit support only". I am, frankly, 
    pulling that out of my ass..embler, because while it sounds
    reasonable, I don't know if it's possible. Type in "objdump -i"
    and post the results. 


2) your ./configure options look like they are on steroids. 
    did you set them manually? In particular, the "--host"
    and "-fformat". (The latter looking like a stray CF/LDFlag

3)  I would check your environment variables. You can do
    this by typing "set", probably, (think I asked this, did
    I miss your response?)

4)  I would clean out environment, set GNUTARGET=elf32-i386, 
    get rid of host/fformat flags to configure/cflags and
    re-try. 

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

Thanks,

It gives us an error in configure with that.  It looks like it just
doesn't understand the elf32-i386.  Maybe the ld on my system only
handles 64-bit binaries. ?  config.log has:
[...]
configure:1960: $? = 1
configure:1986: checking for C compiler default output
configure:1989: gcc -m32   --verbose --format elf32-i386  conftest.c  >&5
gcc: elf32-i386: No such file or directory
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/us\
r/share/info --enable-shared --enable-threads=posix --disable-checking --with-sys\
tem-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=\
c,c++,objc,java,f77 --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
 /usr/libexec/gcc/x86_64-redhat-linux/3.4.3/cc1 -quiet -v conftest.c -quiet -dump\
base conftest.c -m32 -mtune=k8 -auxbase conftest -version -fformat -o /usr/tmp/cc\
iqVzq0.s
cc1: error: unrecognized command line option "-fformat"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../.\
./x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/3.4.3/include
 /usr/include
End of search list.
[...]

Thanks,

 - Wayne -




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








pgsql-ports by date

Next:From: Ranga NathanDate: 2005-06-12 23:09:46
Subject: Unable to install postgresql 8.0.x
Previous:From: Mohan, RossDate: 2005-06-10 22:44:42
Subject: Re: [ADMIN] Is there a way to build 32-bit mode on 64-bit Linux boxes?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group