delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/19/10:38:24

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <48FB462B.4B75336B@dessent.net>
Date: Sun, 19 Oct 2008 07:37:31 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [perl] Portably linking to libstdc++
References: <586E6C4720134D06B35A67112D3BBBCE AT desktop2> <C9004AE9971E4B7ABBC246E73FC599AF AT desktop2>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

Sisyphus wrote:

> But on cygwin, there is no '-lstdc++' to be found in $Config{libpth}, so
> MakeMaker decides to not pass the switch on (which has always been
> MakeMaker's policy in such cases, afaik). This is a pity - there would be no
> problem if it *did* the pass switch on, as both gcc and g++ on cygwin will
> resolve that link.

MakeMaker should be fixed to allow the switch through.

Really the correct way to link C++ code is by using g++ which doesn't
require this manual -lstdc++ nonsense.  Can't you just do that, by
either fixing the makefile to link with $(CXX) or overriding the
appropriate variable?

Or, how about:

$ perl Makefile.PL LIBS="$(${CC:-gcc} -print-file-name=libstdc++.a)"

But this is still not optimal because it assumes static libstdc++, which
has been the only available choice until now but will not be in the
future, i.e. we want to move to shared libstdc++ eventually with gcc4. 
The optimal solution again is to link by calling $(CXX) and not have to
worry about any of this.

> IMO, on my cygwin perl, $Config{libpth} should be set to '/usr/local/lib
> /usr/lib /lib /lib/gcc/i686-pc-cygwin/3.4.4', and I regard it as a bug that
> '/lib/gcc/i686-pc-cygwin/3.4.4' is not being included in $Config{libpth}. In
> fact, I've modified the libpth setting in Config.pm to '/usr/local/lib
> /usr/lib /lib /lib/gcc/i686-pc-cygwin/3.4.4'.

$libexec/gcc/$target/$version is a private directory of the compiler. 
The compiler knows how to find it, and other external apps should not
need to know what it is or even that it exists.  Exposing this internal
detail of the compiler to any other build system is just plain wrong for
many reasons.

Brian

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

- Raw text -


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