I am sure that, most of you aware of this. But, for me it's the first time, I accomplished it.
As one of my assigned tasks to build a 32-bit instance of postgresql on 64-bit machine, I have followed the below approach. I hope, it will be helpful to others as well, if you got any problems.
As an initial step on this task, I have tried to build a sample "c" program using "gcc -m32". Once, I resolved this, I moved to compile the PostgreSQL 9.0.
Checking for the confirmation from OS, PG.
Thank you for reading, and please comment on this, if you have any questions.
--Dinesh Kumar
As one of my assigned tasks to build a 32-bit instance of postgresql on 64-bit machine, I have followed the below approach. I hope, it will be helpful to others as well, if you got any problems.
As an initial step on this task, I have tried to build a sample "c" program using "gcc -m32". Once, I resolved this, I moved to compile the PostgreSQL 9.0.
[root@localhost Desktop]# gcc -m32 -o test test.c In file included from /usr/include/features.h:385, from /usr/include/stdio.h:28, from test.c:1: /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directoryTo resolve the above issue, I have installed the 32-bit glibc-devel package through yum.
yum -y install glibc-devel.i686 glibc-develAgain, I have tried to run the same command.
[root@localhost Desktop]# gcc -m32 -o test test.c /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit statusNow, I got a different error message, and tried to install the 32-bit libgcc.
[root@localhost Desktop]# yum install libgcc-*.i686 --> Running transaction check ---> Package libgcc.i686 0:4.4.7-4.el6 will be installed --> Finished Dependency Resolution Error: Protected multilib versions: libgcc-4.4.7-4.el6.i686 != libgcc-4.4.6-3.el6.x86_64As it's complaining, we have the old version of x86_64, when compared the new one. Hence, I have tried to update the existing x86_64.
[root@localhost Desktop]# yum update libgcc-4.4.6-3.el6.x86_64 ---> Package libgcc.x86_64 0:4.4.6-3.el6 will be updated ---> Package libgcc.x86_64 0:4.4.7-4.el6 will be an update --> Finished Dependency ResolutionOnce, it's updated the given library, I have again tried to install the libgcc-*.i686.
[root@localhost Desktop]# yum install libgcc-*.i686 Resolving Dependencies --> Running transaction check ---> Package libgcc.i686 0:4.4.7-4.el6 will be installed --> Finished Dependency ResolutionNow, I am trying to run the same "gcc -m32" command to check for any further issues.
[root@localhost Desktop]# gcc -m32 -o test test.c [root@localhost Desktop]# ./test Hello WorldIt looks, the sample "c program" is working fine, as a 32-bit application. Now, i am moving to PostgreSQL 9.0. As per my observation I have updated, installed the below components for the PostgreSQL.
yum update readline-6.0-3.el6.x86_64 yum install *readline*i686 yum update zlib-1.2.3-27.el6.x86_64 yum install *zlib*i686Once, I got the all required 32-bit libraries, I have tried to compile the postgresql as below.
[root@localhost build]# CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix=/opt/PostgreSQL/build [root@localhost build]# make -j 4; make install; .... make[1]: Leaving directory `/root/Downloads/postgresql-9.0.17/config' PostgreSQL installation complete.It seems, postgresql has built successfully on 64-bit machine as a 32-bit application.
Checking for the confirmation from OS, PG.
postgres=# SELECT version(); version ------------------------------------------------------------------------------------------------------------------- PostgreSQL 9.0.17 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3), 32-bit (1 row) [root@localhost build]# file /sbin/init /sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, strippedAnd, at the end, I have the postgresql as 32-bit application in 64-bit machine.
Thank you for reading, and please comment on this, if you have any questions.
--Dinesh Kumar
This is clever and all, but you've left out the part that explains why someone would want to do this in the first place. Any clues?
ReplyDeleteThanks David.
ReplyDeleteBeing frank with you, i do not know, why someone need this to implement in their architecture. I have just tried to accomplish the task, what i got from my higher levels. I thought, this post would be helpful to others if they face the similar kind of situation.
What my assumption is, the end customer is trying their native 32-bit postgresql in a 64-bit machine. May be that's reason, he want all 32-bit libraries of PostgreSQL in 64-bit machine.
ReplyDeleteHey, I want to thank you for posting what you discovered. There's still lots of confusion around 32- versus 64-bit and some vendors still require 32-bit tools. Your post helped me past a major stumbling block with one such vendor. Thanks!
ReplyDeleteThanks David
DeleteDitto. I am working with 32 bit libraries on a 64 bit Centos machine, and this helped me solve my problem. Thanks!
ReplyDeleteYou are welcome.
DeleteMy build of a 32bit app worked nicely on centos5 through centos6.4, then failed on centos6.5. This was the magic trick that got me running again.
ReplyDeleteIt turns out upgrading to centos 6.5 removed the 32 bit gcc from my build machine.
Thanks, Dinesh.
My pleasure to help you.
DeletespecgeoQbuddpo-Albuquerque Jensen Tripp https://marketplace.visualstudio.com/items?itemName=7riomenmesu.Descargar-RollerCoaster-VR-Universe-gratuita-2022
ReplyDeleteblowgareni
WtiobiYoc-i-1987 Antonio Ceo https://www.bralounger.com/profile/wicahpiwicahpiwicahpi/profile
ReplyDeletetiejuncranha
Ainasen_to Antoine Mosley click here
ReplyDeletehttps://colab.research.google.com/drive/1oeDp9u0TplDTcVVnpygO7Fl3Pm9v1xuH
click
click here
mbytpariles
0funlascom-ga1993 Carol Collins click here
ReplyDeleteprogram
tadartestda