patches/glibc/2.9/360-2.8-nscd-one-fork.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
parent 1201 c9967a6e3b25
permissions -rw-r--r--
complibs/cloog: fix linking with libm

In Ubuntu 11.04 and 11.10, the default options for ld have changed.
--no-copy-dt-needed-entries and --as-needed are now enabled by default, which
causes errors like:

[EXTRA] Checking CLooG/ppl
[DEBUG] ==> Executing: 'make' '-j3' '-s' 'check'
[ALL ] Making check in .
[ALL ] config.status: creating include/cloog/cloog-config.h
[ALL ] config.status: include/cloog/cloog-config.h is unchanged
[ALL ] libtool: link: i686-build_pc-linux-gnu-gcc -Wall -fomit-frame-pointer
-pipe -o cloog cloog.o -L/<snip>/build/static/lib ./.libs/libcloog.a -lm
/<snip>/build/static/lib/libppl_c.a /<snip>/build/static/lib/libpwl.a
/<snip>/build/static/lib/libppl.a /<snip>/build/static/lib/libgmpxx.a
/<snip>/build/static/lib/libgmp.a -lstdc++
[ALL ] /usr/bin/ld: /<snip>/build/static/lib/libppl.a(MIP_Problem.o):
undefined reference to symbol 'sqrt@@GLIBC_2.0'
[ALL ] /usr/bin/ld: note: 'sqrt@@GLIBC_2.0' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so so try adding
it to the linker command line
[ALL ] /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so:
could not read symbols: Invalid operation
[ALL ] collect2: ld returned 1 exit status
[ERROR] make[2]: *** [cloog] Error 1
[ERROR] make[1]: *** [check-recursive] Error 1

See:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

This patch fixes these errors by placing '-lm' at the right place on the command
line as libppl requires libm when linking cloog.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
     1 Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
     2 
     3 -= BEGIN original header =-
     4 only fork one to assist in stop-start-daemon assumptions about daemon behavior
     5 
     6 http://bugs.gentoo.org/190785
     7 
     8 -= END original header =-
     9 
    10 diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
    11 --- glibc-2_9.orig/nscd/nscd.c	2008-03-29 19:08:12.000000000 +0100
    12 +++ glibc-2_9/nscd/nscd.c	2009-02-02 22:01:10.000000000 +0100
    13 @@ -179,6 +179,9 @@
    14        if (pid != 0)
    15  	exit (0);
    16  
    17 +       if (write_pid (_PATH_NSCDPID) < 0)
    18 +	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    19 +
    20        int nullfd = open (_PATH_DEVNULL, O_RDWR);
    21        if (nullfd != -1)
    22  	{
    23 @@ -228,12 +231,6 @@
    24  	for (i = min_close_fd; i < getdtablesize (); i++)
    25  	  close (i);
    26  
    27 -      pid = fork ();
    28 -      if (pid == -1)
    29 -	error (EXIT_FAILURE, errno, _("cannot fork"));
    30 -      if (pid != 0)
    31 -	exit (0);
    32 -
    33        setsid ();
    34  
    35        if (chdir ("/") != 0)
    36 @@ -242,9 +239,6 @@
    37  
    38        openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
    39  
    40 -      if (write_pid (_PATH_NSCDPID) < 0)
    41 -        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    42 -
    43        if (!init_logfile ())
    44  	dbg_log (_("Could not create log file"));
    45