why my cross-gcc cannot find system root libs?

View: New views
4 Messages — Rating Filter:   Alert me  

why my cross-gcc cannot find system root libs?

by miloody :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dear all:
I attach my error at the end of letter.
I did see libc.a in sysroot/usr/lib, but my ld complains he cannot find it.
I also check the options I set in ld.pdf but it seems all fine.
did I miss something while build the toolchain?
appreciate your help,
miloody

mipsel-unknown-linux-uclibc-ld -T ./link.xn -o TestCode.elf -Map
TestCode.map --oformat elf32-tradlittlemips  reset.o cpufunc.o host.o
Interrupt.o main.o memtst.o ntsys.o diskio.o FileSystem.o tff.o misc.o
DMA.o GPIO.o SDMMC.o Storage.o ntuart.o uart.o -static -lc
mipsel-unknown-linux-uclibc-ld: cannot find -lc
make: *** [TestCode.elf] Error 1

# mipsel-unknown-linux-uclibc-gcc -v
Using built-in specs.
Target: mipsel-unknown-linux-uclibc
Configured with: /root/toolchain/targets/src/gcc-4.1.2/configure
--build=i486-build_pc-linux-gnu --host=i486-build_pc-linux-gnu
--target=mipsel-unknown-linux-uclibc
--prefix=/root/x-tools/mipsel-unknown-linux-uclibc
--with-sysroot=/root/x-tools/mipsel-unknown-linux-uclibc/mipsel-unknown-linux-uclibc//sys-root
--enable-languages=c --disable-multilib --with-float=soft
--enable-__cxa_atexit
--with-local-prefix=/root/x-tools/mipsel-unknown-linux-uclibc/mipsel-unknown-linux-uclibc//sys-root
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99
--enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.1.2

# ls /root/x-tools/mipsel-unknown-linux-uclibc/mipsel-unknown-linux-uclibc/sys-root/usr/lib/
crt1.o              libcurses.so        libmenu.a
libncurses.so.5     libpthread.a        libthread_db_pic.a
crti.o              libdl.a             libmenu_g.a
libncurses.so.5.6   libpthread_pic.a    libthread_db.so
crtn.o              libdl_pic.a         libmenu.so          libnsl.a
         libpthread.so       libutil.a
libc.a              libdl.so            libmenu.so.5
libnsl_pic.a        libresolv.a         libutil_pic.a
libc_pic.a          libform.a           libmenu.so.5.6      libnsl.so
         libresolv_pic.a     libutil.so
libcrypt.a          libform_g.a         libm_pic.a          libpanel.a
         libresolv.so        Scrt1.o
libcrypt_pic.a      libform.so          libm.so
libpanel_g.a        librt.a             terminfo/
libcrypt.so         libform.so.5        libncurses.a
libpanel.so         librt_pic.a         uclibc_nonshared.a
libc.so             libform.so.5.6      libncurses_g.a
libpanel.so.5       librt.so
libcurses.a         libm.a              libncurses.so
libpanel.so.5.6     libthread_db.a

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: *** SPAM ***why my cross-gcc cannot find system root libs?

by Yann E. MORIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Loody,
All,

On Sunday 20 September 2009 10:43:22 loody wrote:
> I attach my error at the end of letter.
> I did see libc.a in sysroot/usr/lib, but my ld complains he cannot find it.
> I also check the options I set in ld.pdf but it seems all fine.

ld.pdf ?

> mipsel-unknown-linux-uclibc-ld -T ./link.xn -o TestCode.elf -Map
> TestCode.map --oformat elf32-tradlittlemips  reset.o cpufunc.o host.o
> Interrupt.o main.o memtst.o ntsys.o diskio.o FileSystem.o tff.o misc.o
> DMA.o GPIO.o SDMMC.o Storage.o ntuart.o uart.o -static -lc
> mipsel-unknown-linux-uclibc-ld: cannot find -lc
> make: *** [TestCode.elf] Error 1

Can you re-run with --verbose ?

Was that line hand-written, or was it generated by an "upper-layer" tool
(such as gcc)?

> # mipsel-unknown-linux-uclibc-gcc -v

ld comes from binutils, not gcc, so gcc can't tell you how ld will find
it libraries.

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: *** SPAM ***why my cross-gcc cannot find system root libs?

by miloody :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi:
thanks for your help.
2009/9/20 Yann E. MORIN <yann.morin.1998@...>:
> Loody,
> All,
>
> On Sunday 20 September 2009 10:43:22 loody wrote:
>> I attach my error at the end of letter.
>> I did see libc.a in sysroot/usr/lib, but my ld complains he cannot find it.
>> I also check the options I set in ld.pdf but it seems all fine.
>
> ld.pdf ?
The document which describe the usage of ld.
(included in binutils documents)
I guess maybe the error comes from my wrong options.

>
>> mipsel-unknown-linux-uclibc-ld -T ./link.xn -o TestCode.elf -Map
>> TestCode.map --oformat elf32-tradlittlemips  reset.o cpufunc.o host.o
>> Interrupt.o main.o memtst.o ntsys.o diskio.o FileSystem.o tff.o misc.o
>> DMA.o GPIO.o SDMMC.o Storage.o ntuart.o uart.o -static -lc
>> mipsel-unknown-linux-uclibc-ld: cannot find -lc
>> make: *** [TestCode.elf] Error 1
>
> Can you re-run with --verbose ?
the result is below:
......
......
attempt to open uart.o succeeded
uart.o
attempt to open
/root/x-tools/mipsel-unknown-linux-uclibc/bin/../lib/libc.a failed

why the mipsel-unknown-linux-uclibc-ld search this directory for libs?

>
> Was that line hand-written, or was it generated by an "upper-layer" tool
> (such as gcc)?

the line is made by Makefile, which is got as below:
LD        = $(TOOLCHAIN)ld
LDLIBS    = -static -lc
LDFLAGS   = -T $(LDSCRIPT) -o $(IMAGE_ELF) -Map $(IMAGE_MAP) --oformat
$(OFORMAT)

$(IMAGE_ELF) : $(OBJ) $(LDSCRIPT)
        $(LD) $(LDFLAGS) $(OBJ) $(LDLIBS)

>
>> # mipsel-unknown-linux-uclibc-gcc -v
>
> ld comes from binutils, not gcc, so gcc can't tell you how ld will find
> it libraries.
>
Is the option, "--with-sysroot" used to tell toolchain where to get
the libs and include files?
I saw a lot of libs and include headers located at where
"--with-sysroot" points to, so I think where is the place linker will
find the libs it needs.
appreciate your help,
miloody

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: why my cross-gcc cannot find system root libs?

by Bugzilla from raj.khem@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Sep 20, 2009 at 1:43 AM, loody <miloody@...> wrote:

> dear all:
> I attach my error at the end of letter.
> I did see libc.a in sysroot/usr/lib, but my ld complains he cannot find it.
> I also check the options I set in ld.pdf but it seems all fine.
> did I miss something while build the toolchain?
> appreciate your help,
> miloody
>
> mipsel-unknown-linux-uclibc-ld -T ./link.xn -o TestCode.elf -Map
> TestCode.map --oformat elf32-tradlittlemips  reset.o cpufunc.o host.o
> Interrupt.o main.o memtst.o ntsys.o diskio.o FileSystem.o tff.o misc.o
> DMA.o GPIO.o SDMMC.o Storage.o ntuart.o uart.o -static -lc
> mipsel-unknown-linux-uclibc-ld: cannot find -lc
> make: *** [TestCode.elf] Error 1

you are using your own linker script link.xn which is the reason for
this error. You should add SEARCH_DIR in
the linker script. something like

SEARCH_DIR("=/usr/lib");

or you should add -L <yoursysrootdir>/usr/lib to the commandline.

-Khem

--
For unsubscribe information see http://sourceware.org/lists.html#faq