This is the mail archive of the cygwin@cygwin.com 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: duplicate regexec/regcomp functions detected


> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Corinna Vinschen
> Sent: Friday, December 14, 2001 11:36 AM
> To: cygwin
> Subject: Re: duplicate regexec/regcomp functions detected
>
>
> On Thu, Dec 13, 2001 at 09:18:39PM +0100, Ralf Habacker wrote:
> > Hi all,
> >
> > kde needs the regexp functions regexec and regcomp.
> >
> > The cygwin lib contains the System V8 function call style, while the pcre
> package (pcreposix)
> > provides another style (the system V style I guess). The problem is now, that both libs
> > supports the same names for regexec and regcomp but with different
> parameter/return types.
> > This results sometimes in execution failures if the libs are not in the right order like
> > shown in the following example.
> >
> > pcre regexp wanted
> >
> > $ gcc ... -lpcreposix -lcygwin   -> okay
> >
> > $ gcc ... -lpthreads|-lm|-lc -lpcreposix -lcygwin   -> failure: the functions in
> cygwin lib
> > are used
>
> But that order should never happen EXCEPT you're making the big
> mistake to give `-lm' or `-lc' on the command line explicitly.
> Since -lcygwin is appended automagically and libc.a and libm.a
> are the same library anyway, the answer is simply, "Don't do that."

This may be for -lm and -lc, but what about libpthread

Think about this link line:

gcc -o test -lpthread main.o [-lcygwin]

This will result in multiple defined symbols for WinMain (expected that main.o contains a
main function).
You can say don't do this, but what about bigger packages like qt. The qt configuring process
does only allow like the above link line.

anyway, saying don't do this is a way, but solving this problem is another.

A general possible solution for this, is not to make several links to cygwin, but to create
linkage libraries with only special symbols used for each cygwin derivated lib, like pthread.
The appended script does exactly this for libpthread. It extracts the pthread relating object
files from libcygwin.a and create a new archive libpthread.a. Using this technology removes
any ordering problems with pthread and other libs on the input line.

> > Especially in libtool related environment with many dependency libs like kde
> this causes much
> > trouble.
> >
> > Should it not be better, to remove the regexp support from cygwin into a seperate lib, so
> > that users has an easier possibility to choose which regexp style they want ?
>
> We didn't want that for compatibility reasons.  We often already
> discussed to trash the V8 implementation in favor of a POSIX
> implementation but that would break older applications which we're
> trying to avoid.

I understand, but what about to cast the function to another name (like _prefix or so) in the
headerfiles.
This would prevent some debugging sessions for people, who are not very confirm with this
issue.

Another solution may be the concept of creating extracted linking libraries desribed above.

> Btw., we have another POSIX regex library besides pcreposix: -lregex.
> It's somewhat smaller and it's also DLLized.  OpenSSH's configure.ac
> file has a special check to see if a regex lib exists and if the base
> regexp implementation in the std C lib is POSIX compliant.  We added
> that to the OpenSSH configury a few weeks ago to make Cygwin happy.

Thanks for this hint.

> Corinna
>
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Developer                                mailto:cygwin@cygwin.com
> Red Hat, Inc.
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>

Attachment: make_libpthread
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]