Re: configure.in and setproctitle/optreset problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: configure.in and setproctitle/optreset problem
Дата
Msg-id 26465.1355798654@sss.pgh.pa.us
обсуждение исходный текст
Ответ на configure.in and setproctitle/optreset problem  (Christoph Berg <christoph.berg@credativ.de>)
Ответы Re: configure.in and setproctitle/optreset problem
Re: configure.in and setproctitle/optreset problem
Список pgsql-hackers
Christoph Berg <christoph.berg@credativ.de> writes:
> We are regularly teaching PostgreSQL courses at linuxhotel.de.
> Starting from the course in November, PG doesn't compile anymore on
> their default Debian Squeeze install laptops they hand out to the
> participants. After ./configure && make, the error looks like this:

> postmaster/postmaster.o: In function `PostmasterMain':
> postmaster.c:(.text+0x40e2): undefined reference to `optreset'
> tcop/postgres.o: In function `process_postgres_switches':
> postgres.c:(.text+0x168c): undefined reference to `optreset'
> utils/misc/ps_status.o: In function `set_ps_display':
> ps_status.c:(.text+0xba): undefined reference to `setproctitle'
> collect2: error: ld returned 1 exit status
> make[2]: *** [postgres] Fehler 1
> make[2]: Leaving directory `/home/cbe/projects/postgresql/postgresql/src/backend'

> This is 9.2.2, but I've seen 9.1.6 failing in the same way. The
> package set installed is a desktop install, plus what Debian
> considers to be build dependencies of postgresql-9.2, that is,
> libedit-dev is installed, but libreadline-dev isn't.

I installed Debian for the first time in a long time, and verified that
their version of libedit exposes bogus definitions of setproctitle,
optreset, and god knows what else.

> configure.in already contains a workaround for -ledit containing a
> strlcpy() version, so I'd propose the attached patch to extend that
> workaround to setproctitle. (Patch for 9.2's configure.in, but the
> same moving of the two code blocks should work for head as well.)

I think we should assume that the libedit developers are utterly
clueless about not trampling on application namespace, and just cut
that library out of *all* our link checks except for the symbols we
specifically expect to get from libedit/libreadline.  Hence, I propose
the attached slightly more extensive patch.  I've verified that this
produces a working build with Debian's libedit.

            regards, tom lane

diff --git a/configure.in b/configure.in
index 2dee4b392b18511f18c4e2f49cab482f2ec72dc8..d6968bb9c0a82ab1c509443905fc5f5c1f13deab 100644
*** a/configure.in
--- b/configure.in
*************** PGAC_VAR_INT_TIMEZONE
*** 1202,1207 ****
--- 1202,1214 ----
  AC_FUNC_ACCEPT_ARGTYPES
  PGAC_FUNC_GETTIMEOFDAY_1ARG

+ # Some versions of libedit contain strlcpy(), setproctitle(), and other
+ # symbols that that library has no business exposing to the world.  Pending
+ # acquisition of a clue by those developers, ignore libedit (including its
+ # possible alias of libreadline) while checking for everything else.
+ pgac_save_LIBS="$LIBS"
+ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
+
  AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink
setproctitlesetsid sigprocmask symlink sync_file_range towlower utime utimes wcstombs wcstombs_l]) 

  AC_REPLACE_FUNCS(fseeko)
*************** else
*** 1316,1326 ****
    AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
  fi

- # Some versions of libedit contain strlcpy(); so disregard that library while
- # checking for these standard libc functions.
- pgac_save_LIBS="$LIBS"
- LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
-
  AC_REPLACE_FUNCS([crypt fls getopt getrusage inet_aton random rint srandom strerror strlcat strlcpy])

  case $host_os in
--- 1323,1328 ----
*************** case $host_os in
*** 1338,1346 ****
          ;;
  esac

-
- LIBS="$pgac_save_LIBS"
-
  # System's version of getaddrinfo(), if any, may be used only if we found
  # a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
  # (Note: the AC_REPLACE_FUNCS probe fails on Windows, where the available
--- 1340,1345 ----
*************** else
*** 1394,1406 ****
    AC_SUBST(have_win32_dbghelp,no)
  fi

- if test "$with_readline" = yes; then
-   PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
-   AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
-   AC_CHECK_FUNCS([append_history history_truncate_file])
- fi
-
-
  dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
  dnl (especially on GNU libc)
  dnl See also comments in c.h.
--- 1393,1398 ----
*************** if test x"$pgac_cv_gcc_int_atomics" = x"
*** 1451,1456 ****
--- 1443,1457 ----
    AC_DEFINE(HAVE_GCC_INT_ATOMICS, 1, [Define to 1 if you have __sync_lock_test_and_set(int *) and friends.])
  fi

+ # Lastly, restore full LIBS list and check for readline/libedit symbols
+ LIBS="$pgac_save_LIBS"
+
+ if test "$with_readline" = yes; then
+   PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
+   AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
+   AC_CHECK_FUNCS([append_history history_truncate_file])
+ fi
+

  #
  # Pthreads

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Enabling Checksums
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: configure.in and setproctitle/optreset problem