Re: libtool 2.2.2, ccache and -all-static

2008-04-22 Thread Ralf Wildenhues
Hi Richard,

* Richard Purdie wrote on Tue, Apr 22, 2008 at 12:29:50PM CEST:
 
 I've noticed another problem with two packages in poky, prelink and
 libvorbis. Both packages have areas where LDFLAGS=-all-static is used.
 
 The problem comes about since Poky sets CC to ccache gcc, then libtool
 puts the -static flag between ccache and gcc.

Thanks for the bug report, and especially for providing an example to
reproduce it!

 libtool: link: ccache -static gcc -O20 -ffast-math -D_REENTRANT -fsigned-char 
 -DUSE_MEMORY_H -o decoder_example decoder_example.o  ../lib/.libs/libvorbis.a 
 -lm /usr/lib/libogg.a

Confirmed.  Fixed as below, committed, put you in THANKS.

Cheers,
Ralf

2008-04-22  Ralf Wildenhues  [EMAIL PROTECTED]

Fix regression over 1.5.26 with ccache $CC -all-static.
* libltdl/config/ltmain.m4sh (func_mode_link): Add
$link_static_flag to compile_command and link_command only
later, instead of right after a possible compiler wrapper.
* tests/static.at (ccache -all-static): New test.
* THANKS: Update.
Report by Richard Purdie.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index ff1e50d..ac334dc 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -3160,9 +3160,6 @@ func_mode_link ()
  fi
  if test -n $link_static_flag; then
dlopen_self=$dlopen_self_static
-   # See comment for -static flag below, for more details.
-   func_append compile_command  $link_static_flag
-   func_append finalize_command  $link_static_flag
  fi
  prefer_static_libs=yes
  ;;
@@ -3450,7 +3447,11 @@ func_mode_link ()
 
   case $arg in
   -all-static)
-   # The effects of -all-static are defined in a previous loop.
+   if test -n $link_static_flag; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command  $link_static_flag
+ func_append finalize_command  $link_static_flag
+   fi
continue
;;
 
diff --git a/tests/static.at b/tests/static.at
index 74b1c63..1a51d0d 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -352,3 +352,26 @@ for withdep in no yes; do
 done
 
 AT_CLEANUP
+
+
+AT_SETUP([ccache -all-static])
+
+AT_DATA([ccache],
+[[#! /bin/sh
+# poor man's ccache clone
+case $1 in
+-*) echo bogus argument: $1 2; exit 1 ;;
+esac
+exec $@
+]])
+chmod +x ./ccache
+
+AT_DATA([a.c],
+[[int main(void) { return 0; }
+]])
+
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c], [], [ignore])
+AT_CHECK([$LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS 
-all-static a.$OBJEXT -o a],
+[], [ignore])
+
+AT_CLEANUP




Re: libtool 2.2.2, ccache and -all-static

2008-04-22 Thread Gary V. Vaughan

Hallo Ralf,

On 22 Apr 2008, at 15:43, Ralf Wildenhues wrote:

* Richard Purdie wrote on Tue, Apr 22, 2008 at 12:29:50PM CEST:


I've noticed another problem with two packages in poky, prelink and
libvorbis. Both packages have areas where LDFLAGS=-all-static is  
used.


The problem comes about since Poky sets CC to ccache gcc, then  
libtool

puts the -static flag between ccache and gcc.


Thanks for the bug report, and especially for providing an example to
reproduce it!

libtool: link: ccache -static gcc -O20 -ffast-math -D_REENTRANT - 
fsigned-char -DUSE_MEMORY_H -o decoder_example  
decoder_example.o  ../lib/.libs/libvorbis.a -lm /usr/lib/libogg.a


Confirmed.  Fixed as below, committed, put you in THANKS.

Cheers,
Ralf

2008-04-22  Ralf Wildenhues  [EMAIL PROTECTED]

Fix regression over 1.5.26 with ccache $CC -all-static.
* libltdl/config/ltmain.m4sh (func_mode_link): Add
$link_static_flag to compile_command and link_command only
later, instead of right after a possible compiler wrapper.
* tests/static.at (ccache -all-static): New test.
* THANKS: Update.
Report by Richard Purdie.



abs_srcdir=`CDPATH=${ZSH_VERSION+.}:  cd ..  pwd`; cd tests; \
CONFIG_SHELL=/bin/sh /bin/sh $abs_srcdir/tests/testsuite \
	  MAKE=make CC=gcc CFLAGS=-g -O2 CPP=gcc -E CPPFLAGS= LD=/ 
usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld LDFLAGS= LIBS=  
LN_S=ln -s NM=/usr/bin/nm -p RANLIB=ranlib STRIP=strip  
OBJEXT=o EXEEXT= SHELL=/bin/sh CONFIG_SHELL=/bin/sh CXX=g++  
CXXFLAGS=-g -O2 CXXCPP=g++ -E F77= FFLAGS= FC= FCFLAGS=  
GCJ= GCJFLAGS=-g -O2 _lt_pkgdatadir=/Users/gary/Devo/libtool-- 
master--0/+build/.. LIBTOOLIZE=/Users/gary/Devo/libtool-- 
master--0/+build/libtoolize LIBTOOL=/Users/gary/Devo/libtool-- 
master--0/+build/libtool tst_aclocaldir=/Users/gary/Devo/libtool-- 
master--0/+build/../libltdl/m4 -v 27

## -- ##
## libtool 2.2.3a test suite. ##
## -- ##
27. static.at:357: testing ...
../../tests/static.at:373: $CC $CPPFLAGS $CFLAGS -c a.c
stdout:
../../tests/static.at:375: $LIBTOOL --mode=link --tag=CC ./ccache $CC  
$CFLAGS $LDFLAGS -all-static a.$OBJEXT -o a

--- /dev/null   2008-04-22 18:51:28.0 -0400
+++ /Users/gary/Devo/libtool--master--0/+build/tests/testsuite.dir/at- 
stderr	2008-04-22 18:51:32.0 -0400

@@ -0,0 +1 @@
+libtool: link: warning: complete static linking is impossible in this  
configuration

stdout:
libtool: link: ./ccache gcc -g -O2 a.o -o a
27. static.at:357:  FAILED (static.at:375)

## - ##
## Test results. ##
## - ##

ERROR: 1 test was run,
1 failed unexpectedly.

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_






PGP.sig
Description: This is a digitally signed message part


Re: libtool 2.2.2, ccache and -all-static

2008-04-22 Thread Richard Purdie
Hi Ralf,

On Tue, 2008-04-22 at 21:43 +0200, Ralf Wildenhues wrote:
 Thanks for the bug report, and especially for providing an example to
 reproduce it!
 
  libtool: link: ccache -static gcc -O20 -ffast-math -D_REENTRANT 
  -fsigned-char -DUSE_MEMORY_H -o decoder_example decoder_example.o  
  ../lib/.libs/libvorbis.a -lm /usr/lib/libogg.a
 
 Confirmed.  Fixed as below, committed, put you in THANKS.

I've confirmed the fix, added it to Poky and dropped the hacks I had,
thanks!

Cheers,

Richard





Re: libtool 2.2.2, ccache and -all-static

2008-04-22 Thread Ralf Wildenhues
* Gary V. Vaughan wrote on Wed, Apr 23, 2008 at 12:54:57AM CEST:
 27. static.at:357: testing ...
 ../../tests/static.at:373: $CC $CPPFLAGS $CFLAGS -c a.c
 stdout:
 ../../tests/static.at:375: $LIBTOOL --mode=link --tag=CC ./ccache $CC  
 $CFLAGS $LDFLAGS -all-static a.$OBJEXT -o a
 --- /dev/null 2008-04-22 18:51:28.0 -0400
 +++ /Users/gary/Devo/libtool--master--0/+build/tests/testsuite.dir/at- 
 stderr2008-04-22 18:51:32.0 -0400
 @@ -0,0 +1 @@
 +libtool: link: warning: complete static linking is impossible in this  
 configuration
 stdout:
 libtool: link: ./ccache gcc -g -O2 a.o -o a
 27. static.at:357:  FAILED (static.at:375)

Thanks.  Fixed as below.  (We could skip the test if link_static_flag is
empty, but we'd have to ignore linker warning output for stupid systems
anyway, so might as well just do that.)

Sorry for not doing that right away.

Cheers,
Ralf

2008-04-23  Ralf Wildenhues  [EMAIL PROTECTED]

* tests/static.at (ccache -all-static): Ignore link warnings.
Report by Gary V. Vaughan.

diff --git a/tests/static.at b/tests/static.at
index 1a51d0d..b5e9946 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -372,6 +372,6 @@ AT_DATA([a.c],
 
 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c], [], [ignore])
 AT_CHECK([$LIBTOOL --mode=link --tag=CC ./ccache $CC $CFLAGS $LDFLAGS 
-all-static a.$OBJEXT -o a],
-[], [ignore])
+[], [ignore], [ignore])
 
 AT_CLEANUP