delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/01/12:15:50

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <41FFB92A.8050307@inbox.ru>
Date: Tue, 01 Feb 2005 20:15:22 +0300
From: Vladius <boxforsr AT inbox DOT ru>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: Dave Korn <dk AT artimi DOT com>, maxb AT ukf DOT net
Subject: Problems creating "-mno-cygwin" DLLs with libtool HACK.
References: <41FF9EEC DOT 8050806 AT inbox DOT ru>
In-Reply-To: <41FF9EEC.8050806@inbox.ru>
X-Antivirus: avast! (VPS 0505-0, 31.01.2005), Outbound message
X-Antivirus-Status: Clean
X-Spam: Not detected


Vladius wrote:

> I have problems compiling DLLs with -mno-cygwin flag, using libtool.
>
> Command is: libtool --mode=link --tag=CXX g++ -rpath 
> /Projects/Tests/libtool -mno-cygwin -no-undefined -o libcommon.la 
> common.lo
> Output:
> rm -fr  .libs/libcommon.a .libs/libcommon.la .libs/libcommon.lai
> g++ -shared -nostdlib 
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtbegin.o  .libs/common.o  
> -L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3 
> -L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../.. -lstdc++ -lgcc 
> -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc 
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtend.o  -mno-cygwin -o 
> .libs/cygcommon-0.dll -Wl,--image-base=0x10000000 
> -Wl,--out-implib,.libs/libcommon.dll.a
> ar cru .libs/libcommon.a  common.o
> ranlib .libs/libcommon.a
> creating libcommon.la
> (cd .libs && rm -f libcommon.la && ln -s ../libcommon.la libcommon.la)
>
>    As U can see... it automatically passes -lcygwin flag to the 
> linker(g++). When cygcheck'ing resulting DLL it lists cygwin DLL as 
> one of its dependencies.
> I heard somewhere that cygwin is requierd for DLL initialisation, is 
> it true?
> The interesting thing is that linking against resulting DLL with 
> so-called "-mno-cygwin -lcygwin" mix results in program startup 
> failure(no errors, it just hangs).
>    Any ideas on how to create cygwin independent DLL with libtool?

    I have found a solution to hack this issue.
1.Goto usr/autotool/devel/bin/
2.Open "libtool" file with a text editor(vim).
3.Search for "postdeps" initialisation. ("postdeps=" string)
4.Remove "-lcygwin" initialisation literal string to the right.
5.Check out next variable assignment - "compiler_lib_search_path=".
6.change "i*86-pc-cygwin" to "i*86-pc-mingw" in all of its occurences to 
the right of varable assignment.

The resulting library created with libtool no longer depends on cygwin DLL.

Does anyone have a better solution? Maybe I just missed smth allready 
known or implemented. Please, let me know.


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

- Raw text -


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