[Top][All Lists]

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

Re: Got shared libraries to build with libtool on MinGW, but it was a st

From: Ralf Wildenhues
Subject: Re: Got shared libraries to build with libtool on MinGW, but it was a struggle
Date: Sun, 18 Sep 2005 13:08:02 +0200
User-agent: Mutt/1.5.9i

Hello everybody,

Unfortunately, this discussion separated across several channels, sorry
for that.  This is a cross-post to libtool and mingw-users lists.  For
non-subscribed followup posters: the former is moderated, the latter
requires subscription here[1] or web-based posting (choose Action
Followup here[2]), so you might have to remove mingw-users from the list
of recipients.  Readers may pick up the missing posts from [2] or [3].

Now to the first of the two different issues:

* Alan W. Irwin wrote on Fri, Sep 16, 2005 at 07:21:43PM CEST:
> >* Alan W. Irwin wrote on Fri, Sep 16, 2005 at 02:58:38AM CEST:
> >>
> >>(1) The sed s/^/import/ command (found in the function func_win32_libid
> >>within does not work properly on MinGW so that shared libraries
> >>are never recognized. 

> >>The solution was to replace
> >>
> >>s/^/import/ ==> s/^.*/import/

> nm -f posix -A zlib.dll.a | \
> sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'
> The expected "import" output did not appear.

All in all, we have several possible reasons but no conclusion:
- msys path translation issues
- bug in a specific sed version
- end-of-line issues

Alan, and others, could you verify that in your setup, the following
patch fixes the problem?  It should avoid any of these issues, and,
unless someone comes up with the specific cause of this problem (or
problems!), should be ignorant to all of them.  Please test it, it's
unfortunately a non-minimal change.

RCS file: /cvsroot/libtool/libtool/Attic/,v
retrieving revision 1.334.2.87
diff -u -r1.334.2.87
---   17 Sep 2005 07:40:54 -0000      1.334.2.87
+++   18 Sep 2005 09:59:03 -0000
@@ -157,12 +157,11 @@
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
       win32_nmres=`eval $NM -f posix -A $1 | \
-       sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
-      if test "X$win32_nmres" = "Ximport" ; then
-        win32_libid_type="x86 archive import"
-      else
-        win32_libid_type="x86 archive static"
-      fi
+       sed -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac

> Ralf, I cannot find how to post to the thread at
> so I would
> appreciate it if you would forward this specific full test to that
> discussion thread for verification of the problem (or not).  (I assume that
> any *.dll.a file will do for the test so long as it's output has the " I "
> string in it that triggers the rest of the sed script.)

Yes.  This part of the thread should be rereadable at [3] now.

> If they cannot easily verify the problem using the above full example, they
> should state the version numbers of both MinGW and MSYS that they are using.
> I will ask the PLplot developer with the MinGW/MSYS platform to do the same
> (although knowing him as I do, he probably has the latest stable versions of
> both MinGW and MSYS installed).

It would be good to have him test the patch above.  Thank you.

Now to the second issue:

> >>(2) Like Cygwin (a platform where we can build a shared version of PLplot
> >>without difficulty), MinGW has no shared version of the math library.  It
> >>does have a dummy static version of the math library to work around 
> >>libtools needs for static builds on MinGW, but that is a different
> >>story.  Since there is no shared math library even with the above
> >>sed change you still get the same
> >*snip*
> >>message for -lm, and shared libraries crash and burn again on MinGW
> >>because of this.
> >>
> >>One (bad) way out of this shared library dilemma is to ask the MinGW
> >>developers to also build a dummy shared math library, but that solution
> >>seems overly-complicated to me, and it is much easier IMO to put MinGW on
> >>the libtool list of platforms without a math library.

Mingw gods, how do you think about this?  Alan proposed this patch:

--- ltmain.sh_original  2005-09-15 16:55:41.000000000 -0700
+++   2005-09-15 16:57:25.000000000 -0700
@@ -1479,11 +1479,11 @@
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
          case $host in
-         *-*-cygwin* | *-*-pw32* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
            # These systems don't actually have a C or math library (as such)
-         *-*-mingw* | *-*-os2*)
+         *-*-os2*)
            # These systems don't actually have a C library (as such)
            test "X$arg" = "X-lc" && continue

Thanks everone for participating.


Note that has 12-24 hours latency.

reply via email to

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