delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <6910a60810200030q562bd1b8q9064178bc13cd0e6@mail.gmail.com> |
Date: | Mon, 20 Oct 2008 09:30:43 +0200 |
From: | "Reini Urban" <rurban AT x-ray DOT at> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: [perl] Portably linking to libstdc++ |
In-Reply-To: | <BA6845624D6F4E01AA4E2CCEC494A9E5@desktop2> |
MIME-Version: | 1.0 |
References: | <586E6C4720134D06B35A67112D3BBBCE AT desktop2> <C9004AE9971E4B7ABBC246E73FC599AF AT desktop2> <48FB462B DOT 4B75336B AT dessent DOT net> <BA6845624D6F4E01AA4E2CCEC494A9E5 AT desktop2> |
X-Google-Sender-Auth: | b70ab8f74a82ee1d |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 |
2008/10/20 Sisyphus: >> 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? > Aaah ... good point. I had missed something. > > I had changed $Config{cc} from 'gcc' to 'g++' thinking that should do the > trick. And it works fine for MinGW-built perls .... but (as it turns out) > only because $Config{ld} is already set to 'g++'. LD is already g++. And if you need to compile C++ you have to use g++ anyway as CC. No need to change anything in current cygwin perl IMO. > On both linux and cygwin, I've just realised that $Config{ld} is still set > to 'gcc' - which is what necessitates linking explicitly to libstdc++. > Of course, the other option on both linux and cygwin is to set *both* > $Config{cc} and $Config{ld} to 'g++', and that works fine on linux, but > doesn't quite work on cygwin where I still get an undefined reference to > `_WinMain AT 16': Current cygwin perl already has g++ as LD for some releases. > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab): > undefined reference to `_WinMain AT 16' > collect2: ld returned 1 exit status > > Why does that happen ? Maybe because the linker believes you have a -mwindows GUI app? Which distro are you talking about? InlineX::CPP2XS I assume. > Btw, overriding $Config{cc} and $Config{ld} is trivial. In the Makefile.PL's > %WriteMakefile() it's just a matter of: > > CC => 'g++', > LD => 'g++', > > Or they can be overridden from the command line when the Makefile.PL is run: > > perl Makefile.PL CC="g++" LD="g++" perl Makefile.PL CC="g++" should be enough. > And I think that's all I need do on any perl build where g++ is the name of > the c++ compiler .... except for Cygwin (where it doesn't work because of > that undefined reference to `_WinMain AT 16'). -- Reini Urban http://phpwiki.org/ http://murbreak.at/ -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |