Re: broken dependency_libs handling of -pthread

2005-05-24 Thread Ralf Wildenhues
Hi Joerg,

* Joerg Sonnenberger wrote on Mon, May 23, 2005 at 06:17:15PM CEST:
 On Thu, May 19, 2005 at 07:17:28PM +0200, Joerg Sonnenberger wrote:
  libtool-1.5.18 doesn't include -pthread in the dependency_libs
  field of the .la file. This leads to link errors on DragonFly,

Not only on DragonFly, I would believe.

  when linking against that library. Typical example is
  ligthread from glib, which is a dependency of libORBit-2.
  orbit-name-server-2 is linked against libORBit-2, but without
  explicit -pthread. This fails with missing symbols.

ACK.

 Attached patch only threats -pthread special and leaves the rest of
 the flags alone.

The problem with the patch is that it breaks backward compatibility.
Older libtool versions (1.4.x I believe) require that only libraries and
their search paths (i.e., arguments of the form -L.. and -l..) be
stored in deplibs.

In branch-2-0, we have implemented a scheme which uses a new variable
for this and thus solves this problem cleanly.

For now, you could just add -pthread to the flags of the depending
package (the ACX_PTHREAD macro from the autoconf macro archive would
handle this).  It sounds bad, but if you think about the fact that
usually the depending package has to be careful and know anyway if any
of its libraries are threaded, then it does not seem like such a bad
assumption any more.

At least I believe this is the current situation, I have not looked
deeply into this stuff.

 Please at least comment on this patch, libtool is
 seriously broken on DragonFly when used with pkgsrc without it.

It's good to remind us to look at things.  Especially *BSD support
within Libtool could be better, and input from the *BSD people would be
very helpful to this end.

I might add that I have little spare time at the moment, so replies can
take a while, sorry.

Regards,
Ralf


___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool


Re: broken dependency_libs handling of -pthread

2005-05-23 Thread Joerg Sonnenberger
On Thu, May 19, 2005 at 07:17:28PM +0200, Joerg Sonnenberger wrote:
 libtool-1.5.18 doesn't include -pthread in the dependency_libs
 field of the .la file. This leads to link errors on DragonFly,
 when linking against that library. Typical example is
 ligthread from glib, which is a dependency of libORBit-2.
 orbit-name-server-2 is linked against libORBit-2, but without
 explicit -pthread. This fails with missing symbols.

Attached patch only threats -pthread special and leaves the rest of
the flags alone. Please at least comment on this patch, libtool is
seriously broken on DragonFly when used with pkgsrc without it.

Joerg
--- ltmain.sh.orig  2005-05-16 11:39:29.0 +0200
+++ ltmain.sh   2005-05-23 18:14:40.0 +0200
@@ -1519,7 +1519,15 @@
continue
;;
 
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ -pthread)
+   compiler_flags=$compiler_flags $arg
+   compile_command=$compile_command $arg
+   finalize_command=$finalize_command $arg
+   deplibs=$deplibs $arg
+   continue
+   ;;
+
+ -mt|-mthreads|-kthread|-Kthread||-pthreads|--thread-safe)
compiler_flags=$compiler_flags $arg
compile_command=$compile_command $arg
finalize_command=$finalize_command $arg
@@ -2006,13 +2014,46 @@
lib=
found=no
case $deplib in
-   -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+   -pthread)
  if test $linkmode,$pass = prog,link; then
compile_deplibs=$deplib $compile_deplibs
finalize_deplibs=$deplib $finalize_deplibs
  else
compiler_flags=$compiler_flags $deplib
  fi
+
+ case $linkmode in
+ lib)
+   deplibs=$deplib $deplibs
+   test $pass = conv  continue
+   newdependency_libs=$deplib $newdependency_libs
+   ;;
+ prog)
+   if test $pass = conv; then
+ deplibs=$deplib $deplibs
+ continue
+   fi
+   if test $pass = scan; then
+ deplibs=$deplib $deplibs
+   else
+ compile_deplibs=$deplib $compile_deplibs
+ finalize_deplibs=$deplib $finalize_deplibs
+   fi
+   ;;
+ *)
+   ;;
+ esac # linkmode
+
+ continue
+ ;;
+   -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe)
+ if test $linkmode,$pass = prog,link; then
+   compile_deplibs=$deplib $compile_deplibs
+   finalize_deplibs=$deplib $finalize_deplibs
+ else
+   compiler_flags=$compiler_flags $deplib
+ fi
+
  continue
  ;;
-l*)
___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool