This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [crosstool-ng] Small question and mini-patch


Hello Michael!
Hello All!

On Thursday 02 October 2008 14:05:48 Michael Abbott wrote:
> That reminds me: I encountered an interesting extra problem using the 
> populate script: the resolver library (at least in glibc) dynamically 
> loads the library it requires (unfortunately I can't remember *which* 
> library that is at the moment) and fails silently if that library can't be 
> found.  Took me *ages* to figure that one out!

I remember having the same problem... Also took me ages to find out...

> Ah yes, I had to use strace to figure out the problem -- and running it 
> again, I see that I need to have /lib/libnss_dns.so.2 and 
> /lib/libresolv.so.2 available.  I don't know why these are always 
> dynamically linked, seems very odd to me.

Were you linking statically, by chance? Even when building staticaly, you
will need to have the libnss*.so files present. This is called Name Service
Switch, and allows to 'switch' name resolution (hosts, users, groups...)
without recompiling by changing /etc/nsswitch.conf:
  http://www.gnu.org/software/libc/FAQ.html#s-2.22

Not sure it is always usefull to have runtime switch... There are cases
where switching will never ever occur at runtime. There are devices whith
*no* name resolution (yes, there are). But hey, in this case, one might
consider using uClibc instead...

> Just a little warning if you use this otherwise quite cute script.

I was thinking of an additional command line option to populate that
will make it accept a list of forced libraries, eg.:
  ${CT_TARGET}-populate -s dir1 -d dir2 --libs=libnss_{compat,files,dns}-\*.so

Would that help?

Or populate could be smart enough to look at an existing /etc/nsswitch.conf
file, and extract needed nss libraries. Only glibc-based (and eglibc-based)
systems should have /etc/nsswitch.conf.
Of course, it would be the responsibility of the rootfs builder to setup a
proper /etc/nsswitch.conf.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]