From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1466 invoked by alias); 30 May 2014 02:36:59 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 1454 invoked by uid 89); 30 May 2014 02:36:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_FSL_HELO_BARE_IP_2 autolearn=no version=3.3.2 X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 30 May 2014 02:36:57 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WqCgf-0007Me-PQ for cygwin@cygwin.com; Fri, 30 May 2014 04:36:53 +0200 Received: from 209.237.53.3 ([209.237.53.3]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 May 2014 04:36:53 +0200 Received: from Andrew by 209.237.53.3 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 May 2014 04:36:53 +0200 To: cygwin@cygwin.com From: Andrew DeFaria Subject: Re: Building cpan module that links with proprietary libs Date: Fri, 30 May 2014 08:01:00 -0000 Message-ID: References: <5387E20D.7090806@cygwin.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <5387E20D.7090806@cygwin.com> X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00528.txt.bz2 On 5/29/2014 6:42 PM, Larry Hall (Cygwin) wrote: >> I had two archives two choose from. One was for Windows and contained the >> .lib files. The other was for Linux and contains .a files. I first >> tried the >> Linux one but that failed with: >> >> g++ -shared P4.o -o blib/arch/auto/P4/P4.dll lib/libp4.a \ >> /usr/lib/perl5/5.14/x86_64-cygwin-threads/CORE/cygperl5_14.dll >> -L/cygdrive/a/p4perlBuild/p4api/lib -lclient -lrpc -lsupp >> -lp4sslstub \ >> >> collect2: error: ld terminated with signal 11 [Segmentation fault], >> core dumped >> Makefile:531: recipe for target 'blib/arch/auto/P4/P4.dll' failed >> make: *** [blib/arch/auto/P4/P4.dll] Error 1 >> Adefaria-lt: >> >> I can give you more output if you need it. > > No need. Forgive me for saying this but I find it hard to believe that > after all this time on the list Andrew that you don't know that trying to > use Linux-compiled libraries on Cygwin isn't going to work. But I guess > my surprise is not that important here. ;-) When I first when to get this to work I choose the Linux style of the package for p4api. I figured the Windows style was for ActiveState only and that'd probably not work. Hell ActiveState doesn't even use cpan, they use ppm. I didn't look inside for anything like .o, .a or .dll or .lib. I figured that it would have been source code and it would have been compiled as part of the make process. It wasn't until it failed that I saw the reference to .a's, etc. and looked into the p4api directory structure to see .lib's in the Windows copy and .a's in the Linux copy. Sure at *that* point I knew the Linux style will never work in this situation. So I tried to link with the Windows style .lib copy. >>> It seems to be on the right track; "g++ -shared -o P4.dll" sounds >>> good to me. > > You say that the libs were built by Visual Studio and the remainder of your > comments make it clear that the libraries are C++ and not C code. I don't believe I ever said it was just C code. If I did then I'm sorry. > As a > result, you will never get code compiled with g++ to link with these > libraries. There is no common ABI among C++ compilers. Thus, the > libraries > and headers of one can't be used as input to the compiler of another, even > on the same platform. This only works for C code. So you have to either > build the proprietary libs with Cygwin's C++ compiler or write your own > "shim" library that wraps the necessary calls and objects in a C API, > compile that with VS, and link your program against the APIs in your > library. Being as this code is proprietary I doubt that Perforce will release it to me to compile but I will point them at this thread...' Thanks. -- Andrew DeFaria http://defaria.com -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple