* [Comm] shared and static libs
@ 2003-04-17 15:12 vic ismakaev
2003-04-17 16:23 ` [Comm] " Sergey Vlasov
0 siblings, 1 reply; 4+ messages in thread
From: vic ismakaev @ 2003-04-17 15:12 UTC (permalink / raw)
To: community
Приветствую!
Возник вопросик у меня:
Допустим есть две либы в двух ипостасях - статические(libname1.a, libname2.a)
и динамическая(libname1.so,libname2.so).
Можно ли ,и если можно -то как сказать gcc при сборке какие либы использовать
статические или динамические.
Про динамические вроде ясно
gcc -rdynamic -lname1 -lname2 и он подхватит сошки.
А если статические?
--
С уважением
Виктор В Исмакаев
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Comm] Re: shared and static libs
2003-04-17 15:12 [Comm] shared and static libs vic ismakaev
@ 2003-04-17 16:23 ` Sergey Vlasov
2003-04-17 16:38 ` vic ismakaev
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Vlasov @ 2003-04-17 16:23 UTC (permalink / raw)
To: community
On Thu, 17 Apr 2003 21:12:50 +0600
vic ismakaev <viclists@mail.esoo.ru> wrote:
> Допустим есть две либы в двух ипостасях - статические(libname1.a, libname2.a)
> и динамическая(libname1.so,libname2.so).
> Можно ли ,и если можно -то как сказать gcc при сборке какие либы использовать
> статические или динамические.
> Про динамические вроде ясно
> gcc -rdynamic -lname1 -lname2 и он подхватит сошки.
Кстати, в современных системах для сборки с динамическими библиотеками
вообще никаких ключей указывать не нужно. -Wl,--export-dynamic -
отдельная ситуация. В общем случае для переносимости лучше
использовать libtool.
> А если статические?
Для отдельных библиотек (сохранив динамические libc и т.п.) - просто
указать /path/libname1.a. Всё статикой - -static, но это лучше не
делать (есть проблемы с загрузкой libnss*.so.* из glibc); разве что
для специфических утилит, где используется что-то вроде dietlibc
вместо glibc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Comm] Re: shared and static libs
2003-04-17 16:23 ` [Comm] " Sergey Vlasov
@ 2003-04-17 16:38 ` vic ismakaev
2003-04-17 16:51 ` Sergey Vlasov
0 siblings, 1 reply; 4+ messages in thread
From: vic ismakaev @ 2003-04-17 16:38 UTC (permalink / raw)
To: community
17 Апрель 2003 22:23, Sergey Vlasov написал:
> On Thu, 17 Apr 2003 21:12:50 +0600
>
> vic ismakaev <viclists@mail.esoo.ru> wrote:
> > Допустим есть две либы в двух ипостасях - статические(libname1.a,
> > libname2.a) и динамическая(libname1.so,libname2.so).
> > Можно ли ,и если можно -то как сказать gcc при сборке какие либы
> > использовать статические или динамические.
> > Про динамические вроде ясно
> > gcc -rdynamic -lname1 -lname2 и он подхватит сошки.
>
> Кстати, в современных системах для сборки с динамическими библиотеками
> вообще никаких ключей указывать не нужно. -Wl,--export-dynamic -
> отдельная ситуация.
А чем определяется ее отдельность?
>В общем случае для переносимости лучше
> использовать libtool.
Понятно.
> > А если статические?
>
> Для отдельных библиотек (сохранив динамические libc и т.п.) - просто
> указать /path/libname1.a.
Или делать libname1_s.a, и потом -lname1_s? Так по идее тоже можно?
>Всё статикой - -static, но это лучше не
> делать (есть проблемы с загрузкой libnss*.so.* из glibc); разве что
> для специфических утилит, где используется что-то вроде dietlibc
> вместо glibc.
--
С уважением
Виктор В Исмакаев
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Comm] Re: shared and static libs
2003-04-17 16:38 ` vic ismakaev
@ 2003-04-17 16:51 ` Sergey Vlasov
0 siblings, 0 replies; 4+ messages in thread
From: Sergey Vlasov @ 2003-04-17 16:51 UTC (permalink / raw)
To: community
On Thu, 17 Apr 2003 22:38:07 +0600
vic ismakaev <viclists@mail.esoo.ru> wrote:
> 17 Апрель 2003 22:23, Sergey Vlasov написал:
> > On Thu, 17 Apr 2003 21:12:50 +0600
> >
> > vic ismakaev <viclists@mail.esoo.ru> wrote:
> > > Допустим есть две либы в двух ипостасях - статические(libname1.a,
> > > libname2.a) и динамическая(libname1.so,libname2.so).
> > > Можно ли ,и если можно -то как сказать gcc при сборке какие либы
> > > использовать статические или динамические.
> > > Про динамические вроде ясно
> > > gcc -rdynamic -lname1 -lname2 и он подхватит сошки.
> >
> > Кстати, в современных системах для сборки с динамическими библиотеками
> > вообще никаких ключей указывать не нужно. -Wl,--export-dynamic -
> > отдельная ситуация.
> А чем определяется ее отдельность?
Это нужно, если в программе делается dlopen() для загрузки модулей,
которые используют функции из самой программы (а не из разделяемых
библиотек). Например, так работает apache (хотя сейчас в ALT он
собирается с выносом основного кода в libhttpd.so для совместимости с
чем-то (чем - не помню); вообще-то этот вариант в основном там сделан
для систем, не имеющих эквивалента --export-dynamic).
Хотя при сборке GTK+-приложений эта опция выставляется автоматом (с
расчётом на использование libgmodule - на самом деле её использует
libgtk).
> >В общем случае для переносимости лучше
> > использовать libtool.
> Понятно.
> > > А если статические?
> >
> > Для отдельных библиотек (сохранив динамические libc и т.п.) - просто
> > указать /path/libname1.a.
> Или делать libname1_s.a, и потом -lname1_s? Так по идее тоже можно?
Можно (хотя в последнее время так делают всё реже и реже).
Ещё встречается суффикс _p (для библиотек, скомпилированных с -pg).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-17 16:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-17 15:12 [Comm] shared and static libs vic ismakaev
2003-04-17 16:23 ` [Comm] " Sergey Vlasov
2003-04-17 16:38 ` vic ismakaev
2003-04-17 16:51 ` Sergey Vlasov
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/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 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git