Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.development > #8921 > unrolled thread

cross compiler can't produce dynamic library

Started byPeter Cheung <mcheung63@gmail.com>
First post2015-10-25 12:53 -0700
Last post2015-10-26 22:50 -0700
Articles 4 — 2 participants

Back to article view | Back to alt.os.development


Contents

  cross compiler can't produce dynamic library Peter Cheung <mcheung63@gmail.com> - 2015-10-25 12:53 -0700
    Re: cross compiler can't produce dynamic library "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-25 17:27 -0400
      Re: cross compiler can't produce dynamic library Peter Cheung <mcheung63@gmail.com> - 2015-10-26 02:59 -0700
        Re: cross compiler can't produce dynamic library Peter Cheung <mcheung63@gmail.com> - 2015-10-26 22:50 -0700

#8921 — cross compiler can't produce dynamic library

FromPeter Cheung <mcheung63@gmail.com>
Date2015-10-25 12:53 -0700
Subjectcross compiler can't produce dynamic library
Message-ID<0c6f1e58-16cb-4b7b-adf7-82dfd7e5e75c@googlegroups.com>
Hi
  What is the reason of my cross compiler can't produce dynamic library, the lib was compiled by :

	$(CC) -I$(NEWLIB_DIR)/include -Wall -fPIC -c testingLibrary.c
	$(CC) -Wall -shared -o libTesting.so testingLibrary.o

$ngLibrary>file testingLibrary.o
testingLibrary.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

$file libTesting.so 
libTesting.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped    <-- see?


$i586-peter-elf-gcc -v
Using built-in specs.
COLLECT_GCC=i586-peter-elf-gcc
COLLECT_LTO_WRAPPER=/toolchain/libexec/gcc/i586-peter-elf/5.2.0/lto-wrapper
Target: i586-peter-elf
Configured with: ../gcc-5.2.0/configure --target=i586-peter-elf --prefix=/toolchain --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/opt/local --with-newlib
Thread model: single
gcc version 5.2.0 (GCC) 


thanks
from Peter (cmk128@hotmail.com)

[toc] | [next] | [standalone]


#8922

From"Rod Pemberton" <boo@fasdfrewar.cdm>
Date2015-10-25 17:27 -0400
Message-ID<op.x62y8qt7yfako5@localhost>
In reply to#8921
On Sun, 25 Oct 2015 15:53:14 -0400, Peter Cheung <mcheung63@gmail.com> wrote:

>   What is the reason of my cross compiler can't produce dynamic library, the lib was compiled by :
>
> 	$(CC) -I$(NEWLIB_DIR)/include -Wall -fPIC -c testingLibrary.c
> 	$(CC) -Wall -shared -o libTesting.so testingLibrary.o
>
> $ngLibrary>file testingLibrary.o
> testingLibrary.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
>
> $file libTesting.so
> libTesting.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked,
>  not stripped    <-- see?
>
>
> $i586-peter-elf-gcc -v
> Using built-in specs.
> COLLECT_GCC=i586-peter-elf-gcc
> COLLECT_LTO_WRAPPER=/toolchain/libexec/gcc/i586-peter-elf/5.2.0/lto-wrapper
> Target: i586-peter-elf
> Configured with: ../gcc-5.2.0/configure --target=i586-peter-elf --prefix=/toolchain --disable-nls
>  --enable-languages=c,c++ --without-headers --with-gmp=/opt/local --with-newlib
> Thread model: single
> gcc version 5.2.0 (GCC)
>

There is a '-static' option for GNU LD (linker):

ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html#SEC3


The GCC man page "Link Options" lists '-static', '-static-libcc',
'-static-libstdc++', '-pie', '-nostdlib', '-nodefaultlibs',
and 'rdynamic' etc:

https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html


Rod Pemberton

-- 
When El Chapo is the most beloved man in Mexico and
Trump is the most hated man, it shows that Mexico
is truly fouled up.

[toc] | [prev] | [next] | [standalone]


#8924

FromPeter Cheung <mcheung63@gmail.com>
Date2015-10-26 02:59 -0700
Message-ID<80ce57ad-51b3-4470-a1fb-7c99373ccf25@googlegroups.com>
In reply to#8922
Rod Pemberton於 2015年10月26日星期一 UTC+8上午5時27分43秒寫道:
> On Sun, 25 Oct 2015 15:53:14 -0400, Peter Cheung <mcheung63@gmail.com> wrote:
> 
> >   What is the reason of my cross compiler can't produce dynamic library, the lib was compiled by :
> >
> > 	$(CC) -I$(NEWLIB_DIR)/include -Wall -fPIC -c testingLibrary.c
> > 	$(CC) -Wall -shared -o libTesting.so testingLibrary.o
> >
> > $ngLibrary>file testingLibrary.o
> > testingLibrary.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
> >
> > $file libTesting.so
> > libTesting.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked,
> >  not stripped    <-- see?
> >
> >
> > $i586-peter-elf-gcc -v
> > Using built-in specs.
> > COLLECT_GCC=i586-peter-elf-gcc
> > COLLECT_LTO_WRAPPER=/toolchain/libexec/gcc/i586-peter-elf/5.2.0/lto-wrapper
> > Target: i586-peter-elf
> > Configured with: ../gcc-5.2.0/configure --target=i586-peter-elf --prefix=/toolchain --disable-nls
> >  --enable-languages=c,c++ --without-headers --with-gmp=/opt/local --with-newlib
> > Thread model: single
> > gcc version 5.2.0 (GCC)
> >
> 
> There is a '-static' option for GNU LD (linker):
> 
> ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html#SEC3
> 
> 
> The GCC man page "Link Options" lists '-static', '-static-libcc',
> '-static-libstdc++', '-pie', '-nostdlib', '-nodefaultlibs',
> and 'rdynamic' etc:
> 
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
> 
> 
> Rod Pemberton
> 
> -- 
> When El Chapo is the most beloved man in Mexico and
> Trump is the most hated man, it shows that Mexico
> is truly fouled up.

still no luck, the same options work in normal ubuntu, i don't know why my cross compiler can't produce dynamic library. 
thanks

[toc] | [prev] | [next] | [standalone]


#8925

FromPeter Cheung <mcheung63@gmail.com>
Date2015-10-26 22:50 -0700
Message-ID<347d9c2b-75a4-4689-a007-a62bf237a2d4@googlegroups.com>
In reply to#8924
Peter Cheung於 2015年10月26日星期一 UTC+8下午6時00分01秒寫道:
> Rod Pemberton於 2015年10月26日星期一 UTC+8上午5時27分43秒寫道:
> > On Sun, 25 Oct 2015 15:53:14 -0400, Peter Cheung <mcheung63@gmail.com> wrote:
> > 
> > >   What is the reason of my cross compiler can't produce dynamic library, the lib was compiled by :
> > >
> > > 	$(CC) -I$(NEWLIB_DIR)/include -Wall -fPIC -c testingLibrary.c
> > > 	$(CC) -Wall -shared -o libTesting.so testingLibrary.o
> > >
> > > $ngLibrary>file testingLibrary.o
> > > testingLibrary.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
> > >
> > > $file libTesting.so
> > > libTesting.so: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked,
> > >  not stripped    <-- see?
> > >
> > >
> > > $i586-peter-elf-gcc -v
> > > Using built-in specs.
> > > COLLECT_GCC=i586-peter-elf-gcc
> > > COLLECT_LTO_WRAPPER=/toolchain/libexec/gcc/i586-peter-elf/5.2.0/lto-wrapper
> > > Target: i586-peter-elf
> > > Configured with: ../gcc-5.2.0/configure --target=i586-peter-elf --prefix=/toolchain --disable-nls
> > >  --enable-languages=c,c++ --without-headers --with-gmp=/opt/local --with-newlib
> > > Thread model: single
> > > gcc version 5.2.0 (GCC)
> > >
> > 
> > There is a '-static' option for GNU LD (linker):
> > 
> > ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html#SEC3
> > 
> > 
> > The GCC man page "Link Options" lists '-static', '-static-libcc',
> > '-static-libstdc++', '-pie', '-nostdlib', '-nodefaultlibs',
> > and 'rdynamic' etc:
> > 
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
> > 
> > 
> > Rod Pemberton
> > 
> > -- 
> > When El Chapo is the most beloved man in Mexico and
> > Trump is the most hated man, it shows that Mexico
> > is truly fouled up.
> 
> still no luck, the same options work in normal ubuntu, i don't know why my cross compiler can't produce dynamic library. 
> thanks

I solved this issue, lets shere: Many tutorials use gcc to produce the final .so file, it doesn't work for me. I changed to use LD, then it works. Here is my final compile commands:

testingLibrary.so.1: testingLibrary.c testingLibrary.h
	$(CC) -I$(NEWLIB_DIR)/include -Wall -shared -fPIC -c testingLibrary.c
	$(LD) -shared -soname,libTesting.so.1 -o libTesting.so testingLibrary.o

[toc] | [prev] | [standalone]


Back to top | Article view | alt.os.development


csiph-web