I'm trying connect to PostgreSQL from C-code, and i have to build libpq from source, because i'm on AIX. I followed the steps in this comment Where do i get libpq source? but in result i got a 32-bit version of libpq.a, how build 64-bit version?
Asked
Active
Viewed 1,044 times
2 Answers
0
Compiling on AIX is harder than on other platforms... Always create a script which you gradually improve till you get a working version. Possible start:
#!/bin/sh
#assuming gcc
GCCLIB=$(dirname $(gcc -maix64 -pthread -print-file-name=libgcc_s.a))
export CFLAGS='-maix64 -mtune=native -pthread'
export CPPFLAGS='-D_GNU_SOURCE -D_XOPEN_SOURCE=500 -D_ALL_SOURCE'
export LDFLAGS="-maix64 -Wl,-brtl -Wl,-blibpath:/usr/local/lib64:${GCCLIB}:/usr/lib -L/usr/local/lib64 -pthread"
export OBJECT_MODE=64
./configure --prefix=/usr/local \
--libdir=/usr/local/lib64 \
--enable-shared \
--enable-static \
2>&1 | tee log.configure
make all 2>&1 | tee log.make.all
make install 2>&1 | tee log.make.install

Zsigmond Lőrinczy
- 377
- 1
- 4
- 9
-
Thanks! But what if i want to use xlC, rather than gcc? Or is it impossible? I already know that i can not do without a gnu make. – Александр Меньшиков Jan 20 '16 at 09:34
-
Most certainly it is possible, but you have to search for the suitable options, for example use `-q64` instead of `-maix64`; also you have to remove the "GCCLIB"-parts – Lorinczy Zsigmond Jan 20 '16 at 13:44
-
Perhaps you have to change `-pthread` to `-lpthreads` and explicitly set CC variable: `export CC=xlC_r` – Lorinczy Zsigmond Jan 20 '16 at 13:56
-
Correction: `export CC=xlc_r; export CXX=xlC_r` (the case of letter c/C means C or C++) – Zsigmond Lőrinczy Jan 25 '16 at 05:37
0
The -q64 compiler option enables 64 bit (there is info in the compiler docs)
A quick google search of xlC 64 bit gives this link which you might find helpful.
http://northstar-www.dartmouth.edu/doc/ibmcxx/en_US/doc/complink/tasks/tubld64a.htm

Catherine Morton
- 151
- 5