* [devel] как правильно слинковать динамическую библиотеку
@ 2002-12-25 11:53 Alexey Tourbin
2002-12-25 16:48 ` Dmitry V. Levin
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Tourbin @ 2002-12-25 11:53 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
Есть такое дело (lua):
%changelog
* Tue Dec 24 2002 Alexey Tourbin <at@altlinux.ru> 4.0.1-alt4
- error in previous build: *.so files are binary copy of *.so.* files,
not symlinks; fixed
- really shared build (s/ld -shared/ld -shared -lc/ in alt-soname patch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- post and postun sections added (ldconfig)
elinks с такой библиотекой линкуется хорошо, а tolua -- не хочет,
говорит:
gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm
/usr/lib/liblualib.so: undefined reference to `dlclose'
/usr/lib/liblualib.so: undefined reference to `dlopen'
/usr/lib/liblualib.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
Если же пересобрать lua c s/ld -shared/ld -shared -lc -ldl/, то всё
собирается хорошо.
И
gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm -ldl
тоже собирается хорошо.
А вопрос такой: какую бы мне доку прочитать, чтобы до конца разобраться,
как это всё правильно должно подцепляться.
--
WBR, Alexey Tourbin
BIOZAK Ltd., Russia
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [devel] как правильно слинковать динамическую библиотеку
2002-12-25 11:53 [devel] как правильно слинковать динамическую библиотеку Alexey Tourbin
@ 2002-12-25 16:48 ` Dmitry V. Levin
2002-12-25 17:16 ` Sergey Vlasov
2003-01-09 12:48 ` Alexey Tourbin
0 siblings, 2 replies; 8+ messages in thread
From: Dmitry V. Levin @ 2002-12-25 16:48 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
On Wed, Dec 25, 2002 at 02:53:33PM +0300, Alexey Tourbin wrote:
> Есть такое дело (lua):
>
> %changelog
> * Tue Dec 24 2002 Alexey Tourbin <at@altlinux.ru> 4.0.1-alt4
> - error in previous build: *.so files are binary copy of *.so.* files,
> not symlinks; fixed
> - really shared build (s/ld -shared/ld -shared -lc/ in alt-soname patch)
И это правильно.
> gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm
> /usr/lib/liblualib.so: undefined reference to `dlclose'
> /usr/lib/liblualib.so: undefined reference to `dlopen'
> /usr/lib/liblualib.so: undefined reference to `dlsym'
> collect2: ld returned 1 exit status
>
> Если же пересобрать lua c s/ld -shared/ld -shared -lc -ldl/, то всё
> собирается хорошо.
Это неправильно.
> И
> gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm -ldl
> тоже собирается хорошо.
А вот это правильно.
> А вопрос такой: какую бы мне доку прочитать, чтобы до конца разобраться,
> как это всё правильно должно подцепляться.
info ld, на тему "-shared".
Advanced reading: http://people.redhat.com/drepper/dsohowto.pdf
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [devel] как правильно слинковать динамическую библиотеку
2002-12-25 16:48 ` Dmitry V. Levin
@ 2002-12-25 17:16 ` Sergey Vlasov
2002-12-25 17:28 ` Dmitry V. Levin
2003-01-09 12:48 ` Alexey Tourbin
1 sibling, 1 reply; 8+ messages in thread
From: Sergey Vlasov @ 2002-12-25 17:16 UTC (permalink / raw)
To: devel
On Wed, 25 Dec 2002 19:48:17 +0300
"Dmitry V. Levin" <ldv@altlinux.org> wrote:
> On Wed, Dec 25, 2002 at 02:53:33PM +0300, Alexey Tourbin wrote:
> > Есть такое дело (lua):
> >
> > %changelog
> > * Tue Dec 24 2002 Alexey Tourbin <at@altlinux.ru> 4.0.1-alt4
> > - error in previous build: *.so files are binary copy of *.so.* files,
> > not symlinks; fixed
> > - really shared build (s/ld -shared/ld -shared -lc/ in alt-soname patch)
>
> И это правильно.
>
> > gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm
> > /usr/lib/liblualib.so: undefined reference to `dlclose'
> > /usr/lib/liblualib.so: undefined reference to `dlopen'
> > /usr/lib/liblualib.so: undefined reference to `dlsym'
> > collect2: ld returned 1 exit status
> >
> > Если же пересобрать lua c s/ld -shared/ld -shared -lc -ldl/, то всё
> > собирается хорошо.
>
> Это неправильно.
А почему неправильно? Ведь, судя по сообщениям, dlopen() используется
именно в liblualib.so.N - почему бы в её зависимости не добавить
libdl.so.2?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [devel] как правильно слинковать динамическую библиотеку
2002-12-25 17:16 ` Sergey Vlasov
@ 2002-12-25 17:28 ` Dmitry V. Levin
2002-12-25 17:51 ` [devel] " Alexey Tourbin
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry V. Levin @ 2002-12-25 17:28 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
On Wed, Dec 25, 2002 at 08:16:53PM +0300, Sergey Vlasov wrote:
> > > Есть такое дело (lua):
> > >
> > > %changelog
> > > * Tue Dec 24 2002 Alexey Tourbin <at@altlinux.ru> 4.0.1-alt4
> > > - error in previous build: *.so files are binary copy of *.so.* files,
> > > not symlinks; fixed
> > > - really shared build (s/ld -shared/ld -shared -lc/ in alt-soname patch)
> >
> > И это правильно.
> >
> > > gcc -o ../../bin/tolua tolua.o tolualua.o -L/usr/lib -L../../lib -ltolua -llua -llualib -lm
> > > /usr/lib/liblualib.so: undefined reference to `dlclose'
> > > /usr/lib/liblualib.so: undefined reference to `dlopen'
> > > /usr/lib/liblualib.so: undefined reference to `dlsym'
> > > collect2: ld returned 1 exit status
> > >
> > > Если же пересобрать lua c s/ld -shared/ld -shared -lc -ldl/, то всё
> > > собирается хорошо.
> >
> > Это неправильно.
>
> А почему неправильно? Ведь, судя по сообщениям, dlopen() используется
> именно в liblualib.so.N - почему бы в её зависимости не добавить
> libdl.so.2?
Если существует реальное использование этой библиотеки без задействования
dlopen(3), то не стоит; если не существует, то нужно добавить.
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [devel] Re: как правильно слинковать динамическую библиотеку
2002-12-25 17:28 ` Dmitry V. Levin
@ 2002-12-25 17:51 ` Alexey Tourbin
2002-12-25 18:33 ` Dmitry V. Levin
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Tourbin @ 2002-12-25 17:51 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]
On Wed, Dec 25, 2002 at 08:28:39PM +0300, Dmitry V. Levin wrote:
> Если существует реальное использование этой библиотеки без задействования
> dlopen(3), то не стоит; если не существует, то нужно добавить.
$ echo "main(){}" > ldtest.c
$ gcc ldtest.c -llua -llualib
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `log'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `sqrt'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `ceil'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `floor'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlclose'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `fmod'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `cos'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `sin'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `atan2'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlopen'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `pow'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `log10'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlsym'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `exp'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `tan'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `atan'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `asin'
/usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `acos'
collect2: ld returned 1 exit status
$
Т.е. с liblua.so всё нормально, а к liblualib.so нужно ещё -lm -ldl?
--
WBR, Alexey Tourbin
BIOZAK Ltd., Russia
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [devel] Re: как правильно слинковать динамическую библиотеку
2002-12-25 17:51 ` [devel] " Alexey Tourbin
@ 2002-12-25 18:33 ` Dmitry V. Levin
0 siblings, 0 replies; 8+ messages in thread
From: Dmitry V. Levin @ 2002-12-25 18:33 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 2092 bytes --]
On Wed, Dec 25, 2002 at 08:51:34PM +0300, Alexey Tourbin wrote:
> > Если существует реальное использование этой библиотеки без задействования
> > dlopen(3), то не стоит; если не существует, то нужно добавить.
>
> $ echo "main(){}" > ldtest.c
> $ gcc ldtest.c -llua -llualib
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `log'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `sqrt'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `ceil'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `floor'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlclose'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `fmod'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `cos'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `sin'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `atan2'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlopen'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `pow'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `log10'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `dlsym'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `exp'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `tan'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `atan'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `asin'
> /usr/lib/gcc-lib/i586-alt-linux/2.96/../../../liblualib.so: undefined reference to `acos'
> collect2: ld returned 1 exit status
> $
>
> Т.е. с liblua.so всё нормально, а к liblualib.so нужно ещё -lm -ldl?
Исходя из вышеприведенного, да.
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [devel] Re: как правильно слинковать динамическую библиотеку
2002-12-25 16:48 ` Dmitry V. Levin
2002-12-25 17:16 ` Sergey Vlasov
@ 2003-01-09 12:48 ` Alexey Tourbin
2003-01-09 12:58 ` Dmitry V. Levin
1 sibling, 1 reply; 8+ messages in thread
From: Alexey Tourbin @ 2003-01-09 12:48 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
On Wed, Dec 25, 2002 at 07:48:17PM +0300, Dmitry V. Levin wrote:
> info ld, на тему "-shared".
> Advanced reading: http://people.redhat.com/drepper/dsohowto.pdf
Прочитал. Но у меня линкер выдает вовсе не такую подробну информацию,
как у него в примерах. Это связано с glibc-2.3.x?
$ LD_DEBUG=statistics date
07046: number of relocations: 271
07046: number of relocations from cache: 101
Thu Jan 9 15:45:28 MSK 2003
$
--
WBR, Alexey Tourbin
BIOZAK Ltd., Russia
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [devel] Re: как правильно слинковать динамическую библиотеку
2003-01-09 12:48 ` Alexey Tourbin
@ 2003-01-09 12:58 ` Dmitry V. Levin
0 siblings, 0 replies; 8+ messages in thread
From: Dmitry V. Levin @ 2003-01-09 12:58 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
On Thu, Jan 09, 2003 at 03:48:11PM +0300, Alexey Tourbin wrote:
> > info ld, на тему "-shared".
> > Advanced reading: http://people.redhat.com/drepper/dsohowto.pdf
>
> Прочитал. Но у меня линкер выдает вовсе не такую подробну информацию,
> как у него в примерах. Это связано с glibc-2.3.x?
Возможно.
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-01-09 12:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-25 11:53 [devel] как правильно слинковать динамическую библиотеку Alexey Tourbin
2002-12-25 16:48 ` Dmitry V. Levin
2002-12-25 17:16 ` Sergey Vlasov
2002-12-25 17:28 ` Dmitry V. Levin
2002-12-25 17:51 ` [devel] " Alexey Tourbin
2002-12-25 18:33 ` Dmitry V. Levin
2003-01-09 12:48 ` Alexey Tourbin
2003-01-09 12:58 ` Dmitry V. Levin
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/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 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git