delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/12/12/14:51:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C17B526.60915DD9@freeler.nl>
Date: Wed, 12 Dec 2001 20:51:02 +0100
From: Teun Burgers <a DOT rburgers AT freeler DOT nl>
X-Mailer: Mozilla 4.78 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: Robert Collins <robert DOT collins AT itdomain DOT com DOT au>
Subject: Re: gcc -mno-cygwin creates cygwin executables!
References: <3C17011D AT freeler-webmail-01> <04ea01c18303$55406a70$0200a8c0 AT lifelesswks>

To sum up this thread:

consider the following program:

main () {
        pthread_create();
}

gcc -mno-cygwin -o zz.exe zz.c -lpthread will compile and build.
A cygcheck on zz.exe reveals that libcygwin.a is linked in. The
problem with this is that a configure script with CC='gcc -mno-cygwin'
will incorrectly find that libpthread.a is available with
AC_SEARCH_LIBS(pthread_create, -lpthread)

This comes about since gcc -mno-cygwin searches for libs in /usr/lib
and libpthread.a is a symlink to libcygwin.a

One way to fix this would be to break out the thread functions of
libcygwin.a into a separate libpthread.a. When you then link with
gcc -mno-cygwin, libcygwin.a is not linked in and the link will fail.
Apparantly for performance and technical reasons this is not
recommendable.
This has to do with libcygwin.a depending on the pthread functions.

Another would be to put the libpthread.a symlink in a directory that gcc
-mno-cygwin
doesn't search, e.g. /usr/lib/cygwin, and add this library to the specs
for cygwin
links.
What would be the problem with this approach?

There are 2 other alternatives that fix the configure problem:

1) How about making libpthread.a a dummy library with just one .o file
   with a dummy (empty) function? This does fix this particular
   configure problem, but might have side effects since the pthread
symbols
   are no longer in libpthread.a

2) include the pthread symbols in both libcygwin.a and libpthread.a?

Robert Collins wrote:

> Hmm. Why not put the win32 api checks in the configure script ahead of
> pthread?

What do you mean with that?

Teun

--
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/

- Raw text -


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