bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-pipe-filter-gi1.c: link failure on darwin


From: Bruno Haible
Subject: Re: test-pipe-filter-gi1.c: link failure on darwin
Date: Fri, 19 Mar 2010 01:45:07 +0100
User-agent: KMail/1.9.9

Hi Simon,

> gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -I. -I. -I.. -I./.. -I../gllib 
> -I./../gllib -I/opt/local/include  -g -O2 -MT test-pipe-filter-gi1.o -MD -MP 
> -MF $depbase.Tpo -c -o test-pipe-filter-gi1.o test-pipe-filter-gi1.c &&\
> mv -f $depbase.Tpo $depbase.Po
> gcc -std=gnu99  -g -O2   -o test-pipe-filter-gi1 test-pipe-filter-gi1.o 
> ../gllib/libgnu.a -L/Users/jas/daily/lib -lintl -L/opt/local/lib -liconv -lc  
> -Wl,-framework -Wl,CoreFoundation 
> /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
> _posix_spawn_file_actions_addclose
> _posix_spawn_file_actions_adddup2
> _posix_spawn_file_actions_addopen
> _posix_spawn_file_actions_destroy
> _posix_spawn_file_actions_init
> _posix_spawnattr_destroy
> _posix_spawnattr_init
> _posix_spawnattr_setflags
> _posix_spawnattr_setsigmask
> _posix_spawnp
> collect2: ld returned 1 exit status
> make[4]: *** [test-pipe-filter-gi1] Error 1
>
> [0] http://autobuild.josefsson.org/gnulib/log-201003170817383606000.txt

Hmm. The log file indicates that all posix_spawn* modules are present,
that the functions are not declared in the system headers, that
HAVE_POSIX_SPAWN is 0, but nevertheless the files such as
spawnattr_init.c have not been compiled. This is because HAVE_POSIX_SPAWN
has been set to 0 too late. In configure.ac we see:
  - First comes the expansion of gl_POSIX_SPAWN_BODY, before gl_INIT already.
  - Inside gl_INIT, first comes the snippet from modules/posix_spawnattr_init
    and then only comes gl_SPAWN_H.

This should fix it:


2010-03-18  Bruno Haible  <address@hidden>

        Fix bug introduced on 2010-03-14.
        * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): New macro.
        (gl_SPAWN_H): Require it.
        * m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): Likewise.
        Reported by Simon Josefsson.

--- m4/posix_spawn.m4.orig      Fri Mar 19 01:40:01 2010
+++ m4/posix_spawn.m4   Fri Mar 19 01:39:02 2010
@@ -1,4 +1,4 @@
-# posix_spawn.m4 serial 6
+# posix_spawn.m4 serial 7
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@
 AC_DEFUN([gl_POSIX_SPAWN_BODY],
 [
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([posix_spawn])
+  AC_REQUIRE([gl_HAVE_POSIX_SPAWN])
   dnl Assume that when the main function exists, all the others,
   dnl except posix_spawnattr_{get,set}sched*, are available as well.
   dnl AC_CHECK_FUNCS_ONCE([posix_spawnp])
--- m4/spawn_h.m4.orig  Fri Mar 19 01:40:02 2010
+++ m4/spawn_h.m4       Fri Mar 19 01:39:33 2010
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 9
+# spawn_h.m4 serial 10
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,10 +33,7 @@
   fi
   AC_SUBST([HAVE_SPAWN_H])
 
-  AC_CHECK_FUNCS_ONCE([posix_spawn])
-  if test $ac_cv_func_posix_spawn != yes; then
-    HAVE_POSIX_SPAWN=0
-  fi
+  AC_REQUIRE([gl_HAVE_POSIX_SPAWN])
 
   AC_REQUIRE([AC_C_RESTRICT])
 
@@ -55,6 +52,20 @@
     posix_spawn_file_actions_adddup2])
 ])
 
+dnl Checks whether the system has the functions posix_spawn.
+dnl Sets ac_cv_func_posix_spawn and HAVE_POSIX_SPAWN.
+AC_DEFUN([gl_HAVE_POSIX_SPAWN],
+[
+  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+  dnl once only, before all statements that occur in other macros.
+  AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([posix_spawn])
+  if test $ac_cv_func_posix_spawn != yes; then
+    HAVE_POSIX_SPAWN=0
+  fi
+])
+
 dnl Unconditionally enables the replacement of <spawn.h>.
 AC_DEFUN([gl_REPLACE_SPAWN_H],
 [




reply via email to

[Prev in Thread] Current Thread [Next in Thread]