Re: Compile errors when building 32-bit on 64-bit system

From: Andy Shellam <andy-lists(at)networkmail(dot)eu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Compile errors when building 32-bit on 64-bit system
Date: 2009-07-06 18:36:40
Message-ID: 4A524438.9040309@networkmail.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> That sounds like you hadn't yet figured out to set CFLAGS too.
>
> Google or no Google, you're setting the wrong variable.
>

I had to install PG 8.3.7 on another couple of machines today, and got
exactly the same issue (setting all 3 variables) again on the SPI
module. Please see as follows:

Configure line: CFLAGS="-m32" LD="ld -melf_i386" LDFLAGS="-m32"
./configure .... etc ....

"make" fails with the error:

gcc -shared -o refint.so refint.o
/usr/bin/ld: warning: i386 architecture of input file `refint.o' is
incompatible with i386:x86-64 output
refint.o: In function `check_primary_key':
refint.c:(.text+0x8f): undefined reference to `elog_start'
refint.c:(.text+0xa5): undefined reference to `elog_finish'
... etc ...

Running the following commands manually allows the install to continue -
notice how I have to add "-m32" to the second gcc command:

# cd contrib/spi
# gcc -m32 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
-fwrapv -fpic -DREFINT_VERBOSE -I. -I../../src/include -D_GNU_SOURCE
-I/opt/nmail32/libxml2/include/libxml2
-I/opt/nmail32/libxml2/include/libxml2 -I/opt/nmail32/zlib/include
-I/opt/nmail32/readline/include -I/opt/nmail32/openssl/include
-I/opt/nmail32/ncurses/include -c -o refint.o refint.c
# gcc -m32 -shared -o refint.so refint.o

And the same for "autoinc.o":

# gcc -m32 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
-fwrapv -fpic -DREFINT_VERBOSE -I. -I../../src/include -D_GNU_SOURCE
-I/opt/nmail32/libxml2/include/libxml2
-I/opt/nmail32/libxml2/include/libxml2 -I/opt/nmail32/zlib/include
-I/opt/nmail32/readline/include -I/opt/nmail32/openssl/include
-I/opt/nmail32/ncurses/include -c -o autoinc.o autoinc.c
# gcc -m32 -shared -o autoinc.so autoinc.o

# make
........
All of PostgreSQL successfully made. Ready to install.

So it appears the SPI module is respecting CFLAGS, but ignoring LDFLAGS.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2009-07-06 18:47:54 Re: Compile errors when building 32-bit on 64-bit system
Previous Message Michael Gould 2009-07-06 18:20:29 Re: Questions on setup and usage