libtool
[Top][All Lists]
Advanced

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

Re: shared library depending on static library on Solaris


From: Sven Verdoolaege
Subject: Re: shared library depending on static library on Solaris
Date: Wed, 22 Jun 2005 17:12:20 +0200
User-agent: Mutt/1.5.6i

On Fri, Jun 10, 2005 at 06:37:15PM +0200, Ralf Wildenhues wrote:
> You could write a simple test that exposes this error.  This would be
> extremely helpful, as we fail this issue on other systems as well
> (linux/x86_64 for example).
> 
> The test could go somewhere like this: compile a lib statically, install
> it (the test suite has some default dirs for temporary installs), then
> build a shared lib that tries to link against it.  Then build an
> executable that need symbols from both that shared and that static lib.
> 
> Patches are always welcome.  :)

Patch against recent cvs version below.
It successfully fails on Solaris.

The actual test is generated from a test.in because I needed
the path to INSTALL.  A make dist will currently include
both test.in and test because of some default rules.

skimo
--
Add test of a dynamic library depending on a static library.

---
commit b9ffa64e2c09be1dbcf08ee1c96ebd13c5206ba8
tree c93508d37c9ab5ffc9a5876aeb0e8a728fe654d7
parent 95c814e157c44ea65170239702eb421fa833c2fd
author Sven Verdoolaege <address@hidden> Wed, 22 Jun 2005 16:09:41 +0200
committer Sven Verdoolaege <address@hidden> Wed, 22 Jun 2005 16:09:41 +0200

 Makefile.am           |    9 ++++++++-
 configure.ac          |    1 +
 tests/sddemo.test.in  |   50 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/sddemo/l1.c     |   36 +++++++++++++++++++++++++++++++++++
 tests/sddemo/l1.h     |   31 ++++++++++++++++++++++++++++++
 tests/sddemo/l2.c     |   39 ++++++++++++++++++++++++++++++++++++++
 tests/sddemo/l2.h     |   31 ++++++++++++++++++++++++++++++
 tests/sddemo/main.c   |   35 ++++++++++++++++++++++++++++++++++
 tests/sddemo/sysdep.h |   47 ++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 278 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -381,6 +381,7 @@ COMMON_TESTS = \
        tests/link.test tests/link-2.test tests/nomode.test \
        tests/objectlist.test tests/quote.test tests/sh.test \
        tests/suffix.test tests/tagtrace.test \
+       tests/sddemo.test \
        tests/cdemo-static.test tests/cdemo-make.test tests/cdemo-exec.test \
        tests/demo-static.test tests/demo-make.test tests/demo-exec.test \
        tests/demo-inst.test tests/demo-unst.test \
@@ -435,7 +436,13 @@ endif
 tests/demo-conf.test: libtool
 
 EXTRA_DIST     += tests/defs.in tests/defs.m4sh \
-                 $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS)
+                 $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) \
+                 tests/sddemo/l1.c \
+                 tests/sddemo/l1.h \
+                 tests/sddemo/l2.c \
+                 tests/sddemo/l2.h \
+                 tests/sddemo/main.c \
+                 tests/sddemo/sysdep.h
 DIST_SUBDIRS   += $(CONF_SUBDIRS)
 
 # The defs script shouldn't be recreated whenever the Makefile is
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -183,4 +183,5 @@ AM_CONDITIONAL(HAVE_RC, [test -n "[$]_LT
 ## Outputs. ##
 ## -------- ##
 AC_CONFIG_FILES([Makefile libltdl/Makefile])
+AC_CONFIG_FILES([tests/sddemo.test], [chmod +x tests/sddemo.test])
 AC_OUTPUT
diff --git a/tests/sddemo.test.in b/tests/sddemo.test.in
new file mode 100644
--- /dev/null
+++ b/tests/sddemo.test.in
@@ -0,0 +1,50 @@
+#! /bin/sh
+# sddemo.test.in - build a dynamic lib that depends on a static lib
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+INSTALL="@INSTALL@"
+
+. tests/defs || exit 1
+
+LIBTOOL=../../libtool
+func_mkprefixdir
+func_cd "tests/sddemo"
+$LIBTOOL --mode=compile $CC -I. -static $CFLAGS -c l1.c -o l1.lo || \
+       exit $EXIT_FAILURE
+$LIBTOOL --mode=link $CC -static -rpath $prefix -o libl1.la l1.lo || \
+       exit $EXIT_FAILURE
+$LIBTOOL --mode=install $INSTALL libl1.la $prefix/libl1.la || \
+       exit $EXIT_FAILURE
+$LIBTOOL --mode=clean $RM libl1.la l1.lo
+
+$LIBTOOL --mode=compile $CC -I. $CFLAGS -c l2.c -o l2.lo || exit $EXIT_FAILURE
+$LIBTOOL --mode=link $CC -shared -L$prefix -rpath $prefix -o libl2.la l2.lo 
-ll1 || \
+       exit $EXIT_FAILURE
+
+$LIBTOOL --mode=compile $CC -I. $CFLAGS -c main.c -o main.lo || \
+       exit $EXIT_FAILURE
+$LIBTOOL --mode=link $CC -o main main.lo -ll2
+
+$LIBTOOL --mode=clean $RM libl2.la l2.lo main.lo main
+func_rmprefixdir
+
+exit $EXIT_SUCCESS
diff --git a/tests/sddemo/l1.c b/tests/sddemo/l1.c
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/l1.c
@@ -0,0 +1,36 @@
+/* l1.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+#include "l1.h"
+#include <stdio.h>
+
+int    var_l1 = 0;
+
+int
+func_l1(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l1 (%i)\n", var_l1);
+  var_l1++;
+  return 0; 
+}
diff --git a/tests/sddemo/l1.h b/tests/sddemo/l1.h
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/l1.h
@@ -0,0 +1,31 @@
+/* l1.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L1_H_
+#define _L1_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l1;
+int    func_l1 __P((int));
+__END_DECLS
+
+#endif /* !_L1_H_ */
diff --git a/tests/sddemo/l2.c b/tests/sddemo/l2.c
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/l2.c
@@ -0,0 +1,39 @@
+/* l2.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+#include "l2.h"
+
+#include "l1.h"
+#include <stdio.h>
+
+int    var_l2 = 0;
+
+int
+func_l2(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l2 (%i)\n", var_l2);
+  func_l1(indent+1);
+  var_l2 += var_l1;
+  return 0; 
+}
diff --git a/tests/sddemo/l2.h b/tests/sddemo/l2.h
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/l2.h
@@ -0,0 +1,31 @@
+/* l2.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L2_H_
+#define _L2_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l2;
+int    func_l2 __P((int));
+__END_DECLS
+
+#endif /* !_L2_H_ */
diff --git a/tests/sddemo/main.c b/tests/sddemo/main.c
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/main.c
@@ -0,0 +1,35 @@
+/* main.c -- inter-library dependency test program
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation
+   by Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+#include "l1.h"
+#include "l2.h"
+#include <stdio.h>
+#include <string.h>
+
+int
+main (argc,argv)
+    int argc;
+    char **argv;
+{
+  printf("dependencies:\n");
+  func_l1(0);
+  func_l2(0);
+  return 0;
+}
diff --git a/tests/sddemo/sysdep.h b/tests/sddemo/sysdep.h
new file mode 100644
--- /dev/null
+++ b/tests/sddemo/sysdep.h
@@ -0,0 +1,47 @@
+/* sysdep.h -- system dependent declarations
+   Copyright (C) 1998-1999 Thomas Tanner <address@hidden>
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+USA. */
+
+/* Only include this header file once. */
+#ifndef _SYSDEP_H_
+#define _SYSDEP_H_ 1
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+   so that C++ compilers don't mangle their names.  Use __END_DECLS at
+   the end of C declarations. */
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+/* __P is a macro used to wrap function prototypes, so that compilers
+   that don't understand ANSI C prototypes still work, and ANSI C
+   compilers can issue warnings about type mismatches. */
+#undef __P
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined 
(_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
+# define __P(protos) protos
+#else
+# define __P(protos) ()
+#endif
+
+#endif /* !_SYSDEP_H_ */




reply via email to

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