Prev: Solaris 10 networking - Global zones
Next: RBAC and EMC SymCLI : Access denied - you are not an authorized base daemon user
From: n'importe_de_quoi on 8 Jul 2008 23:18 Generally, it is considered bad practice to use shaered libs with boot time applications. Yet it seems Solaris forces one to use shared libs for some system functions. For example calling getpwuid/getpwnam from an application will require calls to dlopen, dlsym, etc. In fact the getpwuid man page has: USAGE Applications that use the interfaces described on this manual page cannot be linked statically, since the implemen- tations of these functions employ dynamic loading and link- ing of shared objects at run time. So the question is, can boot time applications use shared system libraries without restriction? My original compilation used the -dn C flag. With the resulting binary ldd reported foo: file is not a dynamic executable or shared object That compilation line fails if I call getpw* functions. Undefined first referenced symbol in file _dlopen /lib/libc.a(nss_deffinder.o) _dlsym /lib/libc.a(nss_deffinder.o) _dlclose /lib/libc.a(nss_deffinder.o) Gotta love it when a static library implicitly requires a shared lib for a set of functions... If I instead use the remove the -dn flag and add -Bstatic and - Bdynamic flags ldd shows libc.so.1 => /usr/lib/libc.so.1 libdl.so.1 => /usr/lib/libdl.so.1 /usr/platform/SUNW,Sun-Fire-480R/lib/libc_psr.so.1 Is this a boot time problem waiting to happen????? Thanks in advance. --Eric
From: Andrew Gabriel on 9 Jul 2008 00:32 In article <879f0d34-6598-44f1-b872-fd5bc48b5c1f(a)8g2000hse.googlegroups.com>, "n'importe_de_quoi" <rice.stew(a)gmail.com> writes: > Generally, it is considered bad practice to use shaered libs with boot > time applications. Yet it seems Solaris forces one to use shared libs > for some system functions. For example calling getpwuid/getpwnam from > an application will require calls to dlopen, dlsym, etc. In fact the > getpwuid man page has: > > USAGE > Applications that use the interfaces described on this > manual page cannot be linked statically, since the implemen- > tations of these functions employ dynamic loading and link- > ing of shared objects at run time. > > > So the question is, can boot time applications use shared system > libraries without restriction? The libraries have to be in /lib and not /usr/lib > My original compilation used the -dn C flag. With the resulting binary > ldd reported > > foo: file is not a dynamic executable or shared > object > > That compilation line fails if I call getpw* functions. .... as the manpage said it would. > Undefined first referenced > symbol in file > _dlopen /lib/libc.a(nss_deffinder.o) > _dlsym /lib/libc.a(nss_deffinder.o) > _dlclose /lib/libc.a(nss_deffinder.o) > > > Gotta love it when a static library implicitly requires a shared lib > for a set of functions... > > If I instead use the remove the -dn flag and add -Bstatic and - > Bdynamic flags ldd shows > > libc.so.1 => /usr/lib/libc.so.1 > libdl.so.1 => /usr/lib/libdl.so.1 > /usr/platform/SUNW,Sun-Fire-480R/lib/libc_psr.so.1 > > > Is this a boot time problem waiting to happen????? Solaris doesn't support static linking of the system libraries. In Solaris releases before 10, some static system libraries were provided for historic reasons, but they were removed in Solaris 10 to stop people from using them to create static binaries, which was never supported. -- Andrew Gabriel [email address is not usable -- followup in the newsgroup]
From: rice.cruft on 9 Jul 2008 13:37 On Jul 9, 12:32 am, and...(a)cucumber.demon.co.uk (Andrew Gabriel) wrote: > In article <879f0d34-6598-44f1-b872-fd5bc48b5...(a)8g2000hse.googlegroups.com>, > "n'importe_de_quoi" <rice.s...(a)gmail.com> writes: > > > Generally, it is considered bad practice to use shaered libs with boot > > time applications. Yet it seems Solaris forces one to use shared libs > > for some system functions. For example calling getpwuid/getpwnam from > > an application will require calls to dlopen, dlsym, etc. In fact the > > getpwuid man page has: > [snippage] > Solaris doesn't support static linking of the system libraries. > In Solaris releases before 10, some static system libraries were > provided for historic reasons, but they were removed in Solaris 10 > to stop people from using them to create static binaries, which > was never supported. > > -- > Andrew Gabriel > [email address is not usable -- followup in the newsgroup] Andrew, Thanks for the response. Can you cite any Solaris documentation regarding shared library support during boot up? As I recall, it was not always guaranteed that the user libs directory would be located on the root directory. Has this changed? Emphasis here is on boot time support. --Eric
From: Tim Bradshaw on 9 Jul 2008 13:58 On Jul 9, 6:37 pm, rice.cr...(a)gmail.com wrote: > Thanks for the response. Can you cite any Solaris documentation > regarding shared library support during boot up? As I recall, it was > not always guaranteed that the user libs directory would be located on > the root directory. I think /lib probably must be in /, and as Andrew said, the shared libraries must be in /lib not /usr/lib (yours are, the /usr/lib copies are symlinks). There are probably people who have been ruder about changes in Solaris 10 than me, though I don't know anyone. But getting rid of static libraries is a good thing.
From: Wayne on 9 Jul 2008 14:35
Tim Bradshaw wrote: > On Jul 9, 6:37 pm, rice.cr...(a)gmail.com wrote: > >> Thanks for the response. Can you cite any Solaris documentation >> regarding shared library support during boot up? As I recall, it was >> not always guaranteed that the user libs directory would be located on >> the root directory. > > I think /lib probably must be in /, and as Andrew said, the shared > libraries must be in /lib not /usr/lib (yours are, the /usr/lib copies > are symlinks). > > There are probably people who have been ruder about changes in Solaris > 10 than me, though I don't know anyone. But getting rid of static > libraries is a good thing. You're probably right, but there is a difference between not needed any static utilities, and not allowing any to be built. I think Sun should allow a user the option to build static applications or utilities if desired. For one thing, forensic investigation tools need to be statically linked, and this restriction means you can't use Solaris 10 for a forensic platform. -Wayne |