bug-gnulib
[Top][All Lists]
Advanced

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

Re: no license on some test modules


From: Eric Blake
Subject: Re: no license on some test modules
Date: Mon, 10 Dec 2007 16:59:33 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Bruno Haible <bruno <at> clisp.org> writes:

>       * gnulib-tool (func_emit_tests_Makefile_am): Accept use_libtests
>       argument. If true, add rules to generate libtests.a, and put libtests.a
>       into $(LDADD).

> --- 1919,1939 ----
>     echo "  -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
>     echo "  -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/
${testsbase_inverse}/${sourcebase-lib}"
>     echo
> !   local_ldadd=''
> !   if $use_libtests; then
> !     local_ldadd=' libtests.a $(LIBTESTS_LIBDEPS)'
> !   fi
> !   echo "LDADD =${local_ldadd} ${testsbase_inverse}/${sourcebase-lib}/
${libname}.${libext}"
>     echo
> +   if $use_libtests; then
> +     echo "libtests_a_SOURCES ="
> +     # Here we use $(LIBOBJS), not @address@hidden The value is the same. 
> However,
> +     # automake during its analyses looks for $(LIBOBJS), not for 
> @address@hidden
> +     echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
> +     echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
> +     echo "EXTRA_libtests_a_SOURCES ="
> +     echo
> +   fi

This is problematic, at least on cygwin.  For example, with branch-1_4 of m4 
git, I am now seeing the following (where ../lib/libm4.a is the normal gnulib 
library):

gcc -std=gnu99  -gdwarf-2 -Wall -Werror   -o test-avltree_oset.exe test-
avltree_oset.o libtests.a  ../lib/libm4.a  
../lib/libm4.a(error.o): In function `error':
../../lib/error.c:250: undefined reference to `_program_name'
../lib/libm4.a(error.o): In function `error_at_line':
../../lib/error.c:309: undefined reference to `_program_name'
collect2: ld returned 1 exit status

This is because test-avltree_oset.c relies on progname.c to provide 
program_name.  Since m4 didn't use progname.c (only the test programs did), 
progname.o is now part of libtests.a rather than ../lib/libm4.a.  Yet, the use 
of program_name doesn't occur until error.o in ../lib/libm4.a, so progname.o 
didn't get linked into the executable when libtests.a was listed first.

Is this patch okay to apply, or do you think we will ever encounter circular 
library dependencies that would require listing libtests.a twice in LDADD, both 
before and after ../lib/libm4.a?

From: Eric Blake <address@hidden>
Date: Mon, 10 Dec 2007 09:54:54 -0700
Subject: [PATCH] Fix test-avltree_oset on cygwin.

* gnulib-tool (func_emit_tests_Makefile_am): Reverse LDADD order,
to avoid undefined symbols.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog   |    5 +++++
 gnulib-tool |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b509e0..e0b733c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-10  Eric Blake  <address@hidden>
+
+       * gnulib-tool (func_emit_tests_Makefile_am): Reverse LDADD order,
+       to avoid undefined symbols.
+
 2007-12-09  Bruno Haible  <address@hidden>
 
        Let 'gnulib-tool --import' collect sources needed for the tests in
diff --git a/gnulib-tool b/gnulib-tool
index 35638b9..9414621 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1923,7 +1923,7 @@ func_emit_tests_Makefile_am ()
   if $use_libtests; then
     local_ldadd=' libtests.a $(LIBTESTS_LIBDEPS)'
   fi
-  echo "LDADD =${local_ldadd} ${testsbase_inverse}/${sourcebase-lib}/
${libname}.${libext}"
+  echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}
${local_ldadd}"
   echo
   if $use_libtests; then
     echo "libtests_a_SOURCES ="
-- 
1.5.3.5








reply via email to

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