EnterpriseDB/repmgr

Error compiling on FreeBSD (ld: error: undefined symbol: libintl_gettext)

Closed this issue · 7 comments

Hello,

I get this error when trying to compile on FreeBSD against PostgreSQL 14. I have gettext installed on the system.

[root@staging-db-01 /tmp/repmgr]# nm --dynamic /usr/local/lib/libintl.so | grep libintl_gettext
0000000000004e50 T libintl_gettext

[root@staging-db-01 /tmp/repmgr]# pkg info|grep gettext
gettext-0.21 GNU gettext meta package
gettext-runtime-0.21 GNU gettext runtime libraries and programs
gettext-tools-0.21_1 GNU gettext development and translation tools

[root@staging-db-01 /tmp/repmgr]# ./configure
checking for a sed that does not truncate output... /usr/bin/sed
checking for pg_config... /usr/local/bin/pg_config
test: PostgreSQL 14.3: bad number
configure: building against PostgreSQL PostgreSQL 14.3
checking for gnused... no
checking for gsed... no
checking for sed... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Makefile.global
config.status: creating config.h
[root@staging-db-01 /tmp/repmgr]# gmake
Building against PostgreSQL 14

...

cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -fPIC -DPIC repmgr-client.o repmgr-action-primary.o repmgr-action-standby.o repmgr-action-witness.o repmgr-action-cluster.o repmgr-action-node.o repmgr-action-service.o repmgr-action-daemon.o configdata.o configfile.o configfile-scan.o log.o strutil.o controldata.o dirutil.o compat.o dbutils.o sysutils.o -L/usr/local/lib -lpgcommon -lpgport -L/usr/local/lib -lpq -L/usr/local/lib   -L/usr/local/lib -lpthread -L/usr/local/lib  -fstack-protector-strong   -L/usr/local/lib -Wl,--as-needed -Wl,-R'/usr/local/lib'  -o repmgr
ld: error: undefined symbol: libintl_gettext
>>> referenced by repmgr-client.c
>>>               repmgr-client.o:(main)
>>> referenced by repmgr-client.c
>>>               repmgr-client.o:(main)
>>> referenced by repmgr-client.c
>>>               repmgr-client.o:(main)
>>> referenced 1457 more times

ld: error: undefined symbol: libintl_bindtextdomain
>>> referenced by exec.c
>>>               exec.o:(set_pglocale_pgservice) in archive /usr/local/lib/libpgcommon.a

ld: error: undefined symbol: libintl_textdomain
>>> referenced by exec.c
>>>               exec.o:(set_pglocale_pgservice) in archive /usr/local/lib/libpgcommon.a
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:84: repmgr] Error 1

I got some more information from the port maintainer of an older version of repmgr (5.2), apparently, an old version of gettext is required. If so, which one does this need?

Hi.

Yes I have also tried this with the same result. Unfortunately looks like it requires an older gettext library which is not possible to achieve right now. So we will have to wait a bit.

Kind Regards,
Moin (bofh)

Hi

AFAICS this is not a repmgr issue; the call is coming from PostgreSQL's NLS handling in the function set_pglocale_pgservice() in src/common/exec.c, and the function is not called by repmgr at all. If PostgreSQL itself is installed correctly, then theoretically any external code should build against it as well, so not sure what's going on there. How was PostgreSQL installed? What does pg_config output?

Hi,

It was installed using FreeBSD packages. Postgres itself is running and working just fine.

[root@staging-db-01 /]# pkg info|grep postgres
postgresql14-client-14.3 PostgreSQL database (client)
postgresql14-contrib-14.3 The contrib utilities from the PostgreSQL distribution
postgresql14-server-14.3 PostgreSQL is the most advanced open-source database available anywhere

[root@staging-db-01 /]# pg_config
BINDIR = /usr/local/bin
DOCDIR = /usr/local/share/doc/postgresql
HTMLDIR = /usr/local/share/doc/postgresql
INCLUDEDIR = /usr/local/include
PKGINCLUDEDIR = /usr/local/include/postgresql
INCLUDEDIR-SERVER = /usr/local/include/postgresql/server
LIBDIR = /usr/local/lib
PKGLIBDIR = /usr/local/lib/postgresql
LOCALEDIR = /usr/local/share/locale
MANDIR = /usr/local/man
SHAREDIR = /usr/local/share/postgresql
SYSCONFDIR = /usr/local/etc/postgresql
PGXS = /usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-libraries=/usr/local/lib' '--with-includes=/usr/local/include' '--enable-thread-safety' '--disable-debug' '--without-gssapi' '--enable-nls' '--without-pam' '--with-openssl' '--prefix=/usr/local' '--localstatedir=/var' '--mandir=/usr/local/man' '--infodir=/usr/local/share/info/' '--build=amd64-portbld-freebsd13.0' 'build_alias=amd64-portbld-freebsd13.0' 'CC=cc' 'CFLAGS=-O2 -pipe -fstack-protector-strong -fno-strict-aliasing ' 'LDFLAGS= -L/usr/local/lib -lpthread -L/usr/local/lib -fstack-protector-strong ' 'LIBS=' 'CPPFLAGS=-I/usr/local/include' 'CXX=c++' 'CXXFLAGS=-O2 -pipe -fstack-protector-strong -fno-strict-aliasing ' 'CPP=cpp' 'PKG_CONFIG=pkgconf' 'LDFLAGS_SL='
CC = cc
CPPFLAGS = -I/usr/local/include -I/usr/local/include -I/usr/local/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -pipe -fstack-protector-strong -fno-strict-aliasing
CFLAGS_SL = -fPIC -DPIC
LDFLAGS = -L/usr/local/lib -lpthread -L/usr/local/lib -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed -Wl,-R'/usr/local/lib'
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lintl -lssl -lcrypto -lz -lreadline -lexecinfo -lm
VERSION = PostgreSQL 14.3

Also, just FYI, postgresql-repmgr-5.2.0 compiles just fine on the same system.

Looks like this is the time when the problem started for FreeBSD.

9d7eebe

Looks like this is the time when the problem started for FreeBSD.

9d7eebe

Hey, you are correct sir! Manually adding $(LIBS) to Makefile fixes the compile issue.

We have re-added the missing $(LIBS), as its presence is evidently not always superfluous (unfortunately we don't regularly test on FreeBSD).

Thanks for the report.