public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Brian Dessent <brian@dessent.net>
To: gcc-help@gcc.gnu.org
Subject: Re: link error
Date: Fri, 21 Oct 2005 23:08:00 -0000	[thread overview]
Message-ID: <435974E7.86A4D7AB@dessent.net> (raw)
In-Reply-To: <7adf9af0510211322q39d3a0eag@mail.gmail.com>

Moon Hwang wrote:

> I make my own library using this makefile.

You might consider using automake and libtool, which takes care of all
this for you.

> SONAME := lib$(TARGET)$(MODI).so

.so is not the universal extension for shared libraries.  Under windows
(and Cygwin) it's .dll, under darwin it's .dylib, and so on.  You really
shouldn't hardcode this information and expect to have a portable
makefile.

Under Cygwin the normal convention is that for a library named "foo" the
shared library is cygfoo.dll and the import libray is libfoo.dll.a.  If
it is a versioned library then it is cygfoo-n.dll and libfoo-n.dll.a.

> g++ -I /usr/X11R6/include -I ../../../Include -I
> /usr/local/include/boost_1_32_0 -L /usr/X11R6/lib -L
> /home/MHHwang/lib/Release Bomb.cpp -o Bomb  -lxyDEVS -lpthread
> 
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
> cannot find -lxyDEVS
> collect2: ld returned 1 exit status

Under Cygwin, when you specify -lxyDEVS, the linker will search for the
following filenames (in this order):

libxyDEVS.dll.a
xyDEVS.dll.a
libxyDEVS.a
cygxyDEVS.dll
libxyDEVS.dll
xyDEVS.dll

(As documented at
<http://sourceware.org/binutils/docs-2.16/ld/WIN32.html#WIN32>.)

So of course it errors because .so is not tne correct extension under
Cygwin.  You can still link against a .so file but you will probably
have to specify its full filename like with other link objects, as
opposed to -lfoo.

Brian

  reply	other threads:[~2005-10-21 23:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21 20:22 Moon Hwang
2005-10-21 23:08 ` Brian Dessent [this message]
     [not found] <AANLkTiniPnQ-ioijpQXhMC1ygSqNSZsEGW2O-OVS5Qa8@mail.gmail.com>
2010-08-12 10:18 ` Link error Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2009-04-01 13:23 link error Duan Wang
2009-04-01 13:42 ` Axel Freyn
2008-08-15 20:39 Link error Vardhan, Sundara (GE Infra, Energy)
2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
2008-07-24 23:55 ` Rob Sherry
2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 11:41     ` Andrew Haley
2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 13:26         ` Andrew Haley
2008-07-29  8:56           ` Ralf Wildenhues
2008-07-29 11:49             ` Andrew Haley
2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
2008-07-24 10:04 Vardhan, Sundara (GE Infra, Energy)
2002-10-17  8:11 HKOELMAN
2002-08-13  6:54 Link Error Tom Browder
2002-08-13  7:16 ` Ish Rattan
2002-08-13  7:30   ` Tom Browder
2002-08-13  7:59     ` Ish Rattan
2001-06-05 14:22 link error Alex Fridman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=435974E7.86A4D7AB@dessent.net \
    --to=brian@dessent.net \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).