Re: Crosstools and dynamic libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your quick answer. Yes I have noticed
myself that the problem is that the target cannot use
both glibc of his own and the glibc I have installed
on my host even if I give LD_LIBRARY_PATH.

So what you are suggesting is to give up crosstools
and try build my own tool chain using the lib path of
my embedded system. Could I copy the *.so files that
my /lib dir contains on my embedded system and use
them while I make, make install the binutils, gcc on
my host machine? Can anyone suggest documentation or a
how to for this as I have found only for bootstraping
and building everything (binutils,gcc,glibc) from
scratch.

Moreover my /lib dir on the target system has very few
libraries and it seems to have been built using
egcs-2.91.66- does this put any restrictions on which
gcc/binutils should I use? In /lib dir there is
libc-1.99.so (libc.so.6 is a symbolic link to it) as
the glibc shared library. ( I have not set up the
system in the first place but took it ready with linux
on it)

I have to admit that I am very new to cross
development. Thanks for any help

Andreas Sotirakopoulos

--- Kai Ruottu <karuottu@xxxxxxxx> wrote:

> none none wrote:
> 
>  > I have tried to produce executable code for my
> embedded linux system 
> with the cross-gcc
>  > when I try to run it on my target system I get
> the following error:
>  > bash$./hello_world
>  > ./hello_world: error in loading shared libraries
>  > : undefined symbol: __libc_start_main
>  > I know that I am supposed to export to my target
> system the dynamic 
> libraries I need.
> 
> No, no ! Totally vice versa - you should copy the
> runtimes and 
> development parts from your
> target system onto the cross host before starting to
> build the cross GCC 
> there!  If you would
> build a native GCC onto your target system, it would
> use the '/lib', 
> '/usr/include' and '/usr/lib'
> stuff on it... Totally in the same way the cross GCC
> would need to use 
> this same stuff when
> creating executables for this target system.  So you
> only need to build 
> binutils and GCC for
> your cross-host, they must run there meanwhile the
> target C library is 
> something which was
> produced for the target system, not for the host
> system!
> 
> If the target system hasn't any C library for it
> yet, then you must 
> produce it (on the cross host)!
> 
>  >  The problem is that I cannot find the libraries
> neither in 
> crosstools directory nor in eldk dir.
>  > Where are they?
> 
> Just look at '/lib' (the runtimes) and '/usr/lib'
> (development 
> libraries) or the "install CD"s for your
> embedded Linux (the development parts aren't surely
> installed)!  Please 
> look 'bash' with 'ldd' in
> your Linux target system :
> 
>    bash$ ldd /bin/bash
> 
> A 'bash' in a Linux distro lists quite a lot
> runtimes, so in order to 
> run bash, one should have them
> all already installed!  When you could run 'bash'
> then you must have 
> some runtimes installed!
> 
>  >  Did not they created when the crosstools or eldk
> installed? Do I 
> have to install or make anything
>  > else I have not understood?
> 
> You haven't understood that a crosstoolchain will be
> made to produce 
> apps for the target system,
> not for something else!  The goal in 'crosstool' and
> 'eldk' is to create 
> the target system from scratch
> using the produced crosstoolchain, and the self-made
> runtime C libraries 
> will be installed onto the
> target system (which hadn't anything yet) !
> 
>  > Furthermore when I give ldd hello_world in my
> host platform I get the 
> message:
>  > not a dynamic executable
>  > where in my target system I get
>  >  libc.so.6 => /lib/libc.so.6 (0x30000000)
>  >  /lib/ld.so.1 => /lib/ld.so.1 (0x08000000)
> 
> So you ALREADY HAVE the required '/lib/libc.so.6'
> and '/lib/ld.so.1' on 
> your target system!  But
> you DIDN'T USE THEM in your crosstoolchain although
> for all sanity you 
> should have done so!
> Then the apps produced there would have been linked
> against these 
> linktime/runtime libraries. The
> crosstoolchain you made was targeted for SOMETHING
> ELSE, and uses some 
> other target libs,
> so there is no guarantee that the executables made
> with it could run on 
> your target system :-(
> 
> 



      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux