delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/06/03/12:14:51

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:mime-version
:content-type; q=dns; s=default; b=xf59YaYJPo21lHvArHwDGJ2lY6iRA
opSUdz4qaXKmBEYToAKgnxFYgO8q4mdL3vtpNviifYqcpMzwP8J6Z0+twA/o46SJ
WkbkPM2z7J6vdUrs4LZefc9z+Rso7T72kKRHlnv120PkmSUOIDiHPdVD7Mqedvxc
xrm0yvpoLEKKgo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:mime-version
:content-type; s=default; bh=0PpVWtQj3iuXdr7kynaFB+Q5GiU=; b=Xqt
bLtzgXx02uuuVpJj/Ke7Le2P6wZPAQtOyH0h0Y1BerkpDtwlAnmWVRBX4ayOAdmz
CgC3xAuBM24Rr780jM60JCLvske/mZeeLwvmyZzaH9t6zXnkwMZi9wvK1J/tJR9K
ljIXlllbgXUFtu5s1nrR6AeBACVtR8kEvzCOYTCg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=strawberry, sk:portabl, resembling, Sincerely
X-HELO: karasik.eu.org
Date: Fri, 3 Jun 2016 18:14:19 +0200
From: Dmitry Karasik <dmitry AT karasik DOT eu DOT org>
To: cygwin AT cygwin DOT com
Subject: bug: configuration problem in perl with gcc libs
Message-ID: <20160603161419.GA5300@karasik2>
MIME-Version: 1.0
User-Agent: Mutt/1.5.23 (2014-03-12)
Note-from-DJ: This may be spam

Hello,

I'd like to report a configuration bug in perl.  The problem arises when a 3-rd
party module tries to build an extension using perl configuration with a
gcc-specific library.

Generally perl extensions don't have a way to specify library to link with
directly, they do that through ExtUtils::MakeMaker, the standard tool for that.
Which in turn tries to resolve '-llibname' using its own
compile-time-configured internal list of lib paths. Everything works so far
libraries are found in perl's libpth (see by running 'perl -V:libpth') which is
/usr/lib on my machine. The problem arises when I need to link together with
libgomp, which is not found there, being a gcc-version-specific library.

For example, the following minimal Makefile.PL configure script

   use ExtUtils::MakeMaker;
   WriteMakefile(NAME => 'foo', LIBS => '-lgomp');

will emit a warning

   Warning (mostly harmless): No library found for -lgomp

and removes -lgomp from the linker command, resulting in perl extension not
being able to compile.

The problem is confirmed, when, if I edit perl configuration file
/usr/lib/perl5/5.22/i686-cygwin-threads-64int/Config.pm, everything works:

     ldlibpthname => 'PATH',
-    libpth => '/usr/lib',
+    libpth => '/usr/lib /usr/lib/gcc/i686-pc-cygwin/5.3.0',
     osname => 'cygwin',

I believe perl needs to be built with the properly set/found libpth in advance.
The diff below is the closest thing resembling a patch for the perl source
package I could come with:

--- Configure.0	2016-06-03 17:45:43.102008000 +0200
+++ Configure	2016-06-03 17:46:10.077558700 +0200
@@ -4948,6 +4948,16 @@
 		   *) libpth="$libpth $j";;
 		   esac
 	       fi
+               # add gcc-specific libpath
+               if echo "$i" | grep -q "/usr/lib/gcc/"; then
+	           j="`$echo $i|$sed 's,/include$,,'`"
+	           if $test -d $j; then
+	               case " $libpth " in
+	               *" $j "*) ;;
+	               *) libpth="$libpth $j";;
+	               esac
+	           fi
+               fi
 	    done
 	    libpth="`$echo $libpth|$sed 's/^ //'`"
 	    for xxx in $libpth $loclibpth $plibpth $glibpth; do

The idea for the patch is taken from strawberry perl, which has the gcc libpath
included in configuration.  I couldn't find though exactly how they manage to
include the path, during the configuration or when building, but it seems they
somehow add it explicitly, using a custom tool for the MinGW perl build:

https://github.com/StrawberryPerl/Perl-Dist-Strawberry/blob/master/share/portable/portable.perl.32#L60-L65

Hopefully this makes sense.

-- 
Sincerely,
	Dmitry Karasik


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019