libtool-patches
[Top][All Lists]
Advanced

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

Re: MSYS+MSVC for libtool branch-2-0, take 7


From: Ralf Wildenhues
Subject: Re: MSYS+MSVC for libtool branch-2-0, take 7
Date: Sat, 13 Aug 2005 09:26:55 +0200
User-agent: Mutt/1.5.9i

Hi Peter,

* Peter Ekberg wrote on Thu, Aug 11, 2005 at 11:38:59AM CEST:
> 
> I ported the patch over to HEAD (took some work, but not too
> difficult, the worst incompatibility was that the
> $file_list_spec feature have been added for AIX which I hooked
> into instead of hardcoding approximately the same thing for
> MSVC)

OK.  I'm planning on rewriting that part eventually anyway.

> Anyway, here's testsuite.log and I configured with:
> ../configure CC=cl CFLAGS=-MD CXX=cl CXXFLAGS=-MD STRIP=: RANLIB=:
> F77=no FC=no NM="dumpbin -symbols" AR=lib LD=link

Good.

> I also fixed the compile mode to add -TC or -TP for MSVC
> instead of removing those flags in func_mode_link, which
> was what you sufggested. But a couple of the tests (14
> and 15, template.at) still trips on this issue as they
> use $CXX directly instead of libtool's compile mode...

Hrmpf.  We can do the -TC/-TP munging inside the libtool script,
but people expect to be able to use $CXX as done in the tests.
See, not everybody uses Automake, and these people cannot be 
expected to use libtool for compilation of code which does not
end up in a shared library.

I don't see an easy way out here.  Either these people will just
have to rename their files *.cpp or use some wrapper for MSVC.  :-/

I'm hesitant to change the testsuite to use libtool compile mode
everywhere, exactly so that we catch such issues before bug reports
reach us.  So, let's change the respective file names.

For the general case, I'm not certain which way is good:
Set -TC in CXX, and override CXXLD, or set -TC in per-target CPPFLAGS?
The latter still won't work for mixed C/C++ code.  In any case, the user
will have to manually adapt if the package author did not use .cpp.

(Note: we need to provide patches for Automake.)

> Also, test 11 (link-order.at) seems to need some -no-undefined
> flags. I get:

ACK.

*snip*
> There are more similar warnings for other libs in that test.

OK.  I just realized that stresstest doesn't do half the damage
that I want it to expose on win32.  Will propose an updated version
soon, which I expect to break on several platforms.

Meanwhile, I installed these patches below.  If inherited_flags still
fails, at least we should now be able to see why.

Cheers,
Ralf

        * tests/inherited_flags.at: Store intermediate libtool output
        for better debugging.

        * tests/link-order.at: Add -no-undefined to LDFLAGS.

        * tests/convenience.at, tests/template.at: Change suffix of C++
        files to .cpp, for compatibility with MSVC.
        Reported by Peter Ekberg <address@hidden>.

Index: tests/convenience.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/convenience.at,v
retrieving revision 1.3
diff -u -r1.3 convenience.at
--- tests/convenience.at        8 Aug 2005 09:23:57 -0000       1.3
+++ tests/convenience.at        13 Aug 2005 06:44:19 -0000
@@ -47,18 +47,18 @@
 AT_SETUP([C++ convenience archives])
 LT_AT_TAG([CXX])
 
-echo 'int a(void) { return 1; }' > a.cc
-echo 'int b(void) { return 2; }' > b.cc
-echo 'int c(void) { return 3; }' > c.cc
-AT_DATA(main.cc,
+echo 'int a(void) { return 1; }' > a.cpp
+echo 'int b(void) { return 2; }' > b.cpp
+echo 'int c(void) { return 3; }' > c.cpp
+AT_DATA(main.cpp,
 [[extern int a(void), b(void), c(void);
 int main(void) { return a() + b() + c() != 6; }
 ]])
 
-$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c a.cc
-$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c b.cc
-$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c c.cc
-$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c main.cc
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c a.cpp
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c b.cpp
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c c.cpp
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c main.cpp
 $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba.la a.lo
 $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o libb.la b.lo
 $LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o libcee.la c.lo 
liba.la libb.la -rpath /notexist
Index: tests/template.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/template.at,v
retrieving revision 1.3
diff -u -r1.3 template.at
--- tests/template.at   27 Apr 2005 18:18:10 -0000      1.3
+++ tests/template.at   13 Aug 2005 06:44:19 -0000
@@ -27,7 +27,7 @@
 [[int cf(int);
 ]])
 
-AT_DATA(aclib.cc,
+AT_DATA(aclib.cpp,
 [[#include "aclib.h"
 template<typename T>
 
@@ -46,7 +46,7 @@
 [[int f(int);
 ]])
 
-AT_DATA(alib.cc,
+AT_DATA(alib.cpp,
 [[#include "alib.h"
 
 template<typename T>
@@ -61,7 +61,7 @@
 }
 ]])
 
-AT_DATA(prog.cc,
+AT_DATA(prog.cpp,
 [[#include <iostream>
 #include "alib.h"
 #include "aclib.h"
@@ -77,11 +77,11 @@
 }
 ]])
 
-AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o 
alib.lo alib.cc, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o 
aclib.lo aclib.cc, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o 
alib.lo alib.cpp, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o 
aclib.lo aclib.cpp, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o 
libaclib.la aclib.lo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o libalib.la 
-rpath /usr/local/lib alib.lo libaclib.la, [0], [ignore], [ignore])
-AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c -o prog.o prog.cc, [0], [ignore], 
[ignore])
+AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c -o prog.o prog.cpp, [0], [ignore], 
[ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o prog 
prog.o libalib.la, [0], [ignore], [ignore])
 
 LT_AT_EXEC_CHECK([./prog], [0], [a sample prog
@@ -108,13 +108,13 @@
 dnl AT_DATA(Makefile.am,
 dnl [[ACLOCAL_AMFLAGS = -I m4
 dnl noinst_LTLIBRARIES = libaclib.la
-dnl libaclib_la_SOURCES = aclib.cc aclib.h
+dnl libaclib_la_SOURCES = aclib.cpp aclib.h
 dnl lib_LTLIBRARIES = libalib.la
 dnl include_HEADERS = alib.h
-dnl libalib_la_SOURCES = alib.cc
+dnl libalib_la_SOURCES = alib.cpp
 dnl libalib_la_LIBADD = libaclib.la
 dnl bin_PROGRAMS = prog
-dnl prog_SOURCES = prog.cc
+dnl prog_SOURCES = prog.cpp
 dnl LDADD = libalib.la
 dnl ]])
 
@@ -147,7 +147,7 @@
 }
 ]])
 
-AT_DATA(src/lib/a.cc,
+AT_DATA(src/lib/a.cpp,
 [[#include "a.hh"
 
 int a2(char t)
@@ -169,7 +169,7 @@
 extern int b3(bs t);
 ]])
 
-AT_DATA(src/lib2/b.cc,
+AT_DATA(src/lib2/b.cpp,
 [[#include "b.hh"
 
 int b2(char* t)
@@ -183,7 +183,7 @@
 }
 ]])
 
-AT_DATA(src/sub/main.cc,
+AT_DATA(src/sub/main.cpp,
 [[#include "b.hh"
 
 int main()
@@ -199,9 +199,9 @@
 
 cd obj
 
-AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib/a.lo ../src/lib/a.cc, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib2/b.lo ../src/lib2/b.cc, [0], [ignore], [ignore])
-AT_CHECK($CXX $CPPFLAGS $CXXFLAGS -c -o sub/main.o ../src/sub/main.cc, [0], 
[ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib/a.lo ../src/lib/a.cpp, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib2/b.lo ../src/lib2/b.cpp, [0], [ignore], [ignore])
+AT_CHECK($CXX $CPPFLAGS $CXXFLAGS -c -o sub/main.o ../src/sub/main.cpp, [0], 
[ignore], [ignore])
 # both convenience
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la 
lib/a.lo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo, [0], [ignore], [ignore])
@@ -253,10 +253,10 @@
 dnl INCLUDES = -I$(srcdir)/lib -I$(srcdir)/lib2
 dnl bin_PROGRAMS = sub/main
 dnl noinst_LTLIBRARIES = lib/liba.la lib2/libb.la
-dnl lib_liba_la_SOURCES = lib/a.cc lib/a.hh
-dnl lib2_libb_la_SOURCES = lib2/b.cc lib2/b.hh
+dnl lib_liba_la_SOURCES = lib/a.cpp lib/a.hh
+dnl lib2_libb_la_SOURCES = lib2/b.cpp lib2/b.hh
 dnl #lib2_libb_la_LIBADD = lib/liba.la
-dnl sub_main_SOURCES = sub/main.cc
+dnl sub_main_SOURCES = sub/main.cpp
 dnl sub_main_LDADD = lib2/libb.la lib/liba.la
 dnl ]])
 
Index: tests/link-order.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order.at,v
retrieving revision 1.3
diff -u -r1.3 link-order.at
--- tests/link-order.at 27 Apr 2005 18:18:10 -0000      1.3
+++ tests/link-order.at 13 Aug 2005 06:51:12 -0000
@@ -20,6 +20,7 @@
 
 AT_SETUP([Link order test.])
 eval `$LIBTOOL --config | grep ECHO=`
+LDFLAGS="$LDFLAGS -no-undefined"
 
 prefix_old=`pwd`/old
 prefix_new=`pwd`/new
@@ -53,7 +54,7 @@
   $LIBTOOL --mode=compile $CC $CFLAGS -c src/b_$i.c -o src/b.lo
   $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/libb.la src/b.lo \
       -L$prefix_old/lib -lcee -rpath $prefix/lib
-  $LIBTOOL --mode=link $CC $CFLAGS -o src/liba.la src/a.lo \
+  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/liba.la src/a.lo \
       src/libb.la -L$prefix_old/lib -lcee -rpath $prefix/lib
   $LIBTOOL --mode=install cp src/libb.la $prefix/lib/libb.la
   AT_CHECK([$LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la],

Index: tests/inherited_flags.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/inherited_flags.at,v
retrieving revision 1.4
diff -u -r1.4 inherited_flags.at
--- tests/inherited_flags.at    2 Jul 2005 14:44:20 -0000       1.4
+++ tests/inherited_flags.at    13 Aug 2005 07:25:08 -0000
@@ -55,7 +55,13 @@
 sed -e 
's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g'
 < libbar.la.bak > libbar.la
 rm libbar.la.bak
 
-AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la 
baz.lo -no-undefined -rpath /usr/local/lib ./libfoo.la ./libbar.la | grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
-AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo 
-no-undefined -rpath /usr/local/lib  ./libfoo.la ./libbar.la | grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
+AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la 
baz.lo -no-undefined -rpath /usr/local/lib ./libfoo.la ./libbar.la],
+        [ignore],[stdout],[ignore])
+AT_CHECK([grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib' stdout],
+        [0],[ignore],[ignore])
+AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo 
-no-undefined -rpath /usr/local/lib  ./libfoo.la ./libbar.la],
+       [ignore],[stdout],[ignore])
+AT_CHECK([grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib' stdout],
+        [0],[ignore],[ignore])
 
 AT_CLEANUP




reply via email to

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