Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build on Amazon Linux (CentOS) - Missing lpgport/lpam #7

Closed
armanddp opened this issue May 20, 2013 · 12 comments
Closed

Unable to build on Amazon Linux (CentOS) - Missing lpgport/lpam #7

armanddp opened this issue May 20, 2013 · 12 comments

Comments

@armanddp
Copy link

Hey,

I'm trying to build pg_repack on an Amazon Linux cluster running Postgres 9.2 but getting the following message about missing pgport/pam:

Both -devel and -contrib rpms are installed as well.

Any help would greatly be appreciated.

Armand

[ec2-user@ip-10-166-5-184 pg_repack-1.1.8]$ make
make[1]: Entering directory /home/ec2-user/src/pg_repack-1.1.8/bin' gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard pg_repack.o pgut/pgut.o pgut/pgut-fe.o -L/usr/lib64 -lpq -L/usr/lib64 -Wl,--as-needed -lpgport -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -lreadline -lcrypt -ldl -lm -o pg_repack /usr/bin/ld: cannot find -lpgport /usr/bin/ld: cannot find -lpam collect2: ld returned 1 exit status make[1]: *** [pg_repack] Error 1 make[1]: Leaving directory/home/ec2-user/src/pg_repack-1.1.8/bin'
make: *** [all] Error 2

[ec2-user@ip-10-166-5-184 pg_repack-1.1.8]$ sudo yum list installed | grep postgres
Failed to set locale, defaulting to C
postgresql.noarch 9.2-1.19.amzn1 @amzn-main
postgresql-devel.noarch 9.2-1.19.amzn1 @amzn-updates
postgresql-server.noarch 9.2-1.19.amzn1 @amzn-main
postgresql-upgrade.noarch 9.2-1.19.amzn1 @amzn-main
postgresql9.x86_64 9.2.4-1.35.amzn1 @amzn-updates
postgresql9-contrib.x86_64 9.2.4-1.35.amzn1 @amzn-updates
postgresql9-devel.x86_64 9.2.4-1.35.amzn1 @amzn-updates
postgresql9-libs.x86_64 9.2.4-1.35.amzn1 @amzn-updates
postgresql9-server.x86_64 9.2.4-1.35.amzn1 @amzn-updates
postgresql9-upgrade.x86_64 9.2.4-1.35.amzn1 @amzn-updates

@dvarrazzo
Copy link
Member

I believe this is the same problem for which in pg_reorg's makefile you can find the lines:

# remove dependency to libxml2 and libxslt
LIBS := $(filter-out -lxml2, $(LIBS))
LIBS := $(filter-out -lxslt, $(LIBS))

this approach obviously doesn't scale.

Can anybody ask the -hackers ML or on IRC what's the right approach?

@schmiddy
Copy link
Member

Getting rid of the presumably unneeded linking-in of "-lpam" might help, but this error message:

/usr/bin/ld: cannot find -lpgport

seems important. I see this old complaint about RHEL -devel packaging not including libpgport:

http://people.planetpostgresql.org/andrew/index.php?/archives/235-Cutting-off-your-nose-to-spite-your-face.html

Unfortunately, I think we really need this library to be present, e.g. for get_parent_directory() in pgut.c.

@armanddp
Copy link
Author

Hmm, I saw similar threads yes. I assume I can't find that library somewhere and just dump it on the server? :/

@armanddp
Copy link
Author

I've built pgport from source for my version so that's now available. The rest seems more like build flags just applicable to the original so it's compiling fine. Need to find a similar cluster to test against though.

@schmiddy
Copy link
Member

Thanks for following up. I started doing a bit of testing with CentOS, though the only CentOS instance I had handy was an ancient 4.5 x86_64 one. I was able to get pg_repack to build using the alternate PGDG RPMs, which apparently do include libpgport.a.

I would like to see us be able to build against the default packages, though. I wonder whether the old .spec files under ./SPECS are expecting to be built against the default packages or the PGDG ones...

@armanddp
Copy link
Author

That would be great. I've build it against two different clusters running
Amazon Linux AMI release 2012.09 and the 2013 one with 9.2.3 and 9.2.4
respectively so looks good.

On Wed, May 22, 2013 at 3:59 AM, Josh Kupershmidt
notifications@github.comwrote:

Thanks for following up. I started doing a bit of testing with CentOS,
though the only CentOS instance I had handy was an ancient 4.5 x86_64 one.
I was able to get pg_repack to build using the alternate PGDG RPMshttp://yum.pgrpms.org/,
which apparently do include libpgport.a.

I would like to see us be able to build against the default packages,
though. I wonder whether the old .spec files under ./SPECS are expecting to
be built against the default packages or the PGDG ones...


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-18253210
.

schmiddy added a commit that referenced this issue May 24, 2013
Per Issue #7 from armanddp, it seems the RHEL/CentOS packages
of Postgres are built against libpam, which shows up in
the LIBS reported by pg_config. We don't actually need to
link in libpam for pg_repack, so manually remove it from
our LIBS. This helps a little bit for building on
RHEL/CentOS, though the issue of libpgport.a missing
on that platform still looms.
@skottler
Copy link

I ran across this issue while working on packaging pg_repack for Fedora/EPEL. I'm going to be submitting a patch upstream (https://bugzilla.redhat.com/show_bug.cgi?id=784281) in the next few minutes. The reason the build fails right now against the stock distro packages is that packaging of static (.a) files is discouraged since it makes rebuilding more difficult. Anyhow, this is a case where things are annoying enough without those files that we need to reconsider that position.

@schmiddy
Copy link
Member

Hi Sam,
Thanks for digging into this. It is a shame that no one seems to have followed up on Andrew's suggested patch years ago:
http://www.postgresql.org/message-id/4EE7C3A5.8050908@dunslane.net
to export a libpgport.so, that seems like it would have avoided our current headaches.

@binshi
Copy link

binshi commented Oct 26, 2018

The below command solved it for me.
sudo yum install postgresql-static.x86_64
source: https://forums.aws.amazon.com/thread.jspa?threadID=242418

@BastianM3
Copy link

For anyone else that runs into issues, here was the complete solution for me to get pg_repack downloaded and installed on Amazon Linux:

echo "Installing pg_repack deps"
sudo yum install \
   gcc \
   postgresql-devel \
   openssl-devel \
   postgresql-static.x86_64 \
   readline-devel -y

cd /tmp/
curl -sSL http://api.pgxn.org/dist/pg_repack/1.4.4/pg_repack-1.4.4.zip -o pg_repack.zip
unzip pg_repack.zip
cd ./pg_repack-1.4.4/

echo "Building pg_repack"
sudo make install

@nagaraju11
Copy link

nagaraju11 commented Oct 23, 2019

For anyone else that runs into issues, here was the complete solution for me to get pg_repack downloaded and installed on Amazon Linux:

echo "Installing pg_repack deps"
sudo yum install \
   gcc \
   postgresql-devel \
   openssl-devel \
   postgresql-static.x86_64 \
   readline-devel -y

cd /tmp/
curl -sSL http://api.pgxn.org/dist/pg_repack/1.4.4/pg_repack-1.4.4.zip -o pg_repack.zip
unzip pg_repack.zip
cd ./pg_repack-1.4.4/

echo "Building pg_repack"
sudo make install

Hi, I followed as you mentioned but throwing the same error. Below is the log,

``# make

make[1]: Entering directory /root/pg_repack/bin' gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard pg_repack.o pgut/pgut.o pgut/pgut-fe.o -L/usr/lib64 -lpq -L/usr/lib64/pgsql -L/usr/lib64 -Wl,-z,relro -Wl,--as-needed -lpgport -lssl -lcrypto -lkrb5 -lcom_err -lz -lreadline -lcrypt -ldl -lm -o pg_repack /bin/ld: cannot find -lpgport collect2: error: ld returned 1 exit status make[1]: *** [pg_repack] Error 1 make[1]: Leaving directory /root/pg_repack/bin'
make: *** [all] Error 2
``

@MichaelDBA
Copy link
Collaborator

Solutions provided for old versions of AWS distro, PG, and pg_repack. Closing this since old AWS distro version not available anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants