This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [perl] Portably linking to libstdc++


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]