linking correct libc

Yann E. MORIN yann.morin.1998@anciens.enib.fr
Fri May 29 20:39:00 GMT 2009


Peter,
All,

On Tuesday 26 May 2009 09:02:13 ng@piments.com wrote:
> > If it is really an ARM file, you can run again, but setting:
> > LDFLAGS="-L/back/ts/root2/usr/lib/ -v -Wl,--verbose"
[--SNIP--]
> attempt to open /back/ts/root2/usr/lib//libc.so succeeded
> opened script file /back/ts/root2/usr/lib//libc.so
> opened script file /back/ts/root2/usr/lib//libc.so
> attempt to open /lib/libc.so.6 succeeded

Look at that: you've got a libc.so in your root2 tree!
- Where does it come from?
- How did you construct your root2 tree?

The cross-gcc expects to find its libc.so in its sysroot directory (which
it finds automagically). If it finds a libc.so elsewhere, then all its
internal logic is then completelt broken. Remove that file, and see if
it fixes it.

Usually, to build a "rootfs", you'd do something like (replace with adequate
values, obviously!, and iterate for all your packages):
  cd my-package-1
  ./configure --prefix=/usr --build=i686-pc-linux-gnu   \
              --host=arm-unknown-linux-gnueabi          \
              --option1 --option2 [...]
  make
  make install DESTDIR=/back/ts/root2
  cd ..

Once you're done, your root2 will contain all the files installed by your
packages, and only those. It should *not* contain files from the toolchain
(from the syysroot, notably). So it is not suited for direct usage.

You would then use the script provided with crosstool-NG that is specifically
used to complete your root-dir structure with the necessary files:
  arm-unknown-linux-gnueabi-populate -v    \
      -s /back/ts/root2                    \
      -d /back/ts/root2-full

Then, root2-full can be used as input to build file system images for your
target (eg. mksquashfs, mkfs.jffs2and so on...), or can be used as an
NFS-root. Of course, your root2 will still only contain the files installed
by your packages.

This way, you achieve two main goals:
- you don't modify the sysroot, so your toolchain can be reused to build
  other things;
- your root-dir contains only the files installed by the packages, and can
  thus be considered "pure".

Regards,
Yann E. MORIN.

PS. Be patient, if no one answers, it can be for at least two reasons:
- no one has the answer, in which case saying so is just a waste
  of bandwidth;
- someone might have the answer, but is not reading his/her mails
  due to other duties.

Remember, this is a volunteer-based effort, and you can't expect anyone
to abide by your desires. Repeating the same problem again and again
will surely not help.

YEM.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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



More information about the crossgcc mailing list