[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] linux/unix shared libraries?
From: |
Olaf Dietrich |
Subject: |
Re: [Tinycc-devel] linux/unix shared libraries? |
Date: |
Tue, 22 Apr 2008 13:57:12 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
grischka (2008-04-21T18:07:35+0200):
> Works for me. (on ubuntu 6.02)
That's good news - so what might go wrong here?
Did I use the appropriate compiler/linker options?
(Are you saying that you did exactly the same
things that I did, or that you were (somehow) able
to build a shared library?)
If I display the shared library dependencies of the files
compiled/linked with tcc; I get:
$ ldd libmylib.so
linux-gate.so.1 => (0xb7f01000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dc2000)
/lib/ld-linux.so.2 (0x80000000)
$ ldd testlib
linux-gate.so.1 => (0xb7fb4000)
libmylib.so => /home/olaf/tcc_test/libmylib.so (0xb7fb0000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e75000)
/lib/ld-linux.so.2 (0xb7fb5000)
which looks pretty similar to the results after
building with gcc.
However, with the additional -r or -d switch, the result is:
$ ldd -d -r libmylib.so
/usr/bin/ldd: line 117: 21091 Segmentation fault LD_TRACE_LOADED_OBJECTS=1
LD_WARN=yes LD_BIND_NOW=yes LD_LIBRARY_VERSION=$verify_out LD_VERBOSE= "$@"
linux-gate.so.1 => (0xb7f58000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e19000)
/lib/ld-linux.so.2 (0x80000000)
$ ldd -d -r testlib
/usr/bin/ldd: line 117: 21096 Segmentation fault LD_TRACE_LOADED_OBJECTS=1
LD_WARN=yes LD_BIND_NOW=yes LD_LIBRARY_VERSION=$verify_out LD_VERBOSE= "$@"
linux-gate.so.1 => (0xb7f1c000)
libmylib.so => /home/olaf/tcc_test/libmylib.so (0xb7f18000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ddd000)
/lib/ld-linux.so.2 (0xb7f1d000)
(again some "segmentation faults").
Any suggestions what to try?
(The system here is a Debian stable with
"/lib/libc.so.6 -> libc-2.3.6.so".)
Olaf
> From: "Olaf Dietrich":
> > The simple question is: Is it or has it ever been possible to
> > compile shared libraries with tcc under linux/unix?
> >
> > Here is a very simple test case:
> >
> >
> > $ cat mylib.c
> >
> > int func(void)
> > {
> > return 12345;
> > }
> >
> >
> > $ cat testlib.c
> >
> > #include <stdio.h>
> >
> > extern int func(void);
> >
> > int main(void) {
> > printf("%d\n", func());
> > return 0;
> > }
> >
> >
> > Using gcc, I can simply compile these files and
> > obtain a working shared library:
> >
> > $ export LD_LIBRARY_PATH=`pwd`
> > $ gcc -fPIC -shared mylib.c -o libmylib.so
> > $ gcc testlib.c -L. -lmylib -o testlib
> > $ ./testlib
> > 12345
> >
> > How can I do the same thing with tcc? I tried:
> >
> > $ export LD_LIBRARY_PATH=`pwd`
> > $ tcc -r -shared mylib.c -o libmylib.so
> > $ tcc testlib.c -L. -lmylib -o testlib
> > $ ./testlib
> > Segmentation fault
- [Tinycc-devel] linux/unix shared libraries?, Olaf Dietrich, 2008/04/21
- Re: [Tinycc-devel] linux/unix shared libraries?, Mike Aubury, 2008/04/21
- Re: [Tinycc-devel] linux/unix shared libraries?, David Given, 2008/04/21
- Re: [Tinycc-devel] linux/unix shared libraries?, grischka, 2008/04/21
- Re: [Tinycc-devel] linux/unix shared libraries?,
Olaf Dietrich <=
- Re: [Tinycc-devel] linux/unix shared libraries?, grischka, 2008/04/22
- Re: [Tinycc-devel] linux/unix shared libraries?, Olaf Dietrich, 2008/04/23
- Re: [Tinycc-devel] linux/unix shared libraries?, grischka, 2008/04/24
- Re: [Tinycc-devel] linux/unix shared libraries?, grischka, 2008/04/25
- Re: [Tinycc-devel] linux/unix shared libraries?, Olaf Dietrich, 2008/04/28