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 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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/