ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: "Denis S. Filimonov" <den@academ.org>
To: sisyphus@altlinux.ru
Subject: Re: [sisyphus] связывание в ar
Date: Thu, 31 Oct 2002 23:04:37 +0600
Message-ID: <200210312304.37932.den@academ.org> (raw)
In-Reply-To: <20021031183458.GS2322@bebi.novosoft.ru>

1 Ноябрь 2002 00:34, Alexey Morozov написал:
> c++ -o test29 test29.o libtest29a.a libtest29b.a
>
> то нас ждет... э-э-э, разочарование:
> alex@pyro alex/tmp/c++ $ c++ -o test29 test29.o libtest29a.a libtest29b.a
> libtest29b.a(test29b.o): In function `singleton::get()':
> test29b.o(.gnu.linkonce.t._ZN9singleton3getEv+0x2d): undefined reference to
> `singleton::s' collect2: ld returned 1 exit status
> alex@pyro alex/tmp/c++ $ _
>
> Небольшое расследование показало, что причиной неверной сборки является
> /неправильный/ порядок указания библиотек. То есть, если libtest29b.a
> поставить перед libtest29a.a, то все слинкуется нормально.
>
> По-моему, это бага (хотя бы из соображений использования cross-linked
> библиотек внутри некоторого проекта).
>
> и ar, и ld из комплекта binutils-2.13.90.0.4-alt1
>
> Что скажут ведущие си- и плюсоводы?
да вроде как ld всегда так поступал.
линкуя очередную библиотеку, он проверяет совпадения между библиотечной таблицей экспорта и уже созданной таблицей неотрезолвленых символов,
но не проверяет наличие импортируемых этой библиотекой символов в общей таблице экспортируемых символов (от всех предыдущих библиотек).
таким образом, если A зависит от B, gcc ... A.a B.a слинкуется, а gcc ... B.a A.a -- нет.
при перекрестной зависимости библиотеки линкуются два раза: gcc ... A.a B.a A.a
то же самое с .so

>
> _______________________________________________
> Sisyphus mailing list
> Sisyphus@altlinux.ru
> http://altlinux.ru/mailman/listinfo/sisyphus

-- 
If computers take over (which seems to be their natural tendency), it will
serve us right.
		-- Alistair Cooke



      parent reply	other threads:[~2002-10-31 17:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-31 18:34 Alexey Morozov
2002-10-31 16:50 ` Sergey Vlasov
2002-10-31 17:04 ` Denis S. Filimonov [this message]

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=200210312304.37932.den@academ.org \
    --to=den@academ.org \
    --cc=sisyphus@altlinux.ru \
    /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

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git