delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/21/16:03:05

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4304a5bd1002211259k1f678ac6j29cb170ea535f49b@mail.gmail.com>
References: <4304a5bd1002211259k1f678ac6j29cb170ea535f49b AT mail DOT gmail DOT com>
Date: Sun, 21 Feb 2010 16:02:54 -0500
Message-ID: <18d205ed1002211302t798e156bxc8279b973668afee@mail.gmail.com>
Subject: Re: Linking Linux static library under Cygwin
From: Gregg Levine <gregg DOT drwho8 AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Sun, Feb 21, 2010 at 3:59 PM, Dmitriy Strebkov <-----------> wrote:
> My problem is the following.
>
> I have a static library libmysqlclient.a, from MySQL version compiled
> under Linux (mysql-5.0.45-linux-i686-glibc23).
> Is there any possibility to link that library to an object file
> complied under Cygwin's GCC?
>
> For instance, I have the following code (test.c):
>
> #include "mysql.h"
> #include <stdarg.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> ...
>
> int main(int argc,char* argv[])
> {
> MYSQL *one, *two;
> mysql_server_init(argc, argv, server_groups);
>
> ...
> }
>
> gcc -c test.c
>
> As a result in test.o there is a reference to mysql_server_init()
> function as "_mysql_server_init", i.e. with '_' as the first symbol.
> In libmysqlclient.a, where the code of mysql_server_init() function is
> located, I see a reference to "mysql_server_init" (without '_'
> symbol).
>
> On attempt to link test.o with libmysqlclient.a I get the following error:
> test.o: undefined reference to '_mysql_server_init'
> because of problem described above.
>
> Linking is initiated by executing such command:
> gcc -o mian -L. -lmysqlclient main.o
>
> Thus, could you please explain me:
> - Is there any way to link and use Linux libraries under Cygwin at all?
> - How can I workaround generation of references with '_' as a first
> symbol in test.o?
>
> Thanks in advance!
>

Hello!
Um no. That's not what Cygwin is for. If you want something that
originated on Linux to be made available for Cygwin, you're going to
need to build it yourself. There are ample hints that explain how to
do this.

You might want to ask on the Apps list to see if anyone has considered
porting MySQL to Cygwin, and what happened during the process.

-----
Gregg C Levine gregg DOT drwho8 AT gmail DOT com
"This signature fought the Time Wars, time and again."

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

- Raw text -


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