[Vm-dev] [commit][2661] Add yet another libc line to the linux launch script(s), and try and make the

Bert Freudenberg bert at freudenbergs.de
Tue Jan 8 23:30:39 UTC 2013


On 08.01.2013, at 15:23, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> Hi Bert,
> 
>     its necessary because the VM and the image must use the same libc.so, and to do that reliably one needs to specify a LD_LIBRARY_PATH that will include the directory containing the actual libc.so in use by the VM first.  LD_LIBRARY_PATH may need to be set by the user, e.g. to pick up specific versions of plugins or support libraries but if that LD_LIBRARY_PATH doesn't include the right dir for libc then

This ...

> the image may load the wrong libc and things will break.

... is exactly what I'm talking about. If the image explicitly states "libc" causing the VM to go hunting for it, then the image code is broken, IMNSHO. The way to access libc functions is by passing null into dlopen.

- Bert -

>   This is a real case that Cadence customers saw in using a complex application that uses a number of C libraries.  i.e. even if my explanation sounds waffly there's actual experience behind it :)
> 
> 
> On Tue, Jan 8, 2013 at 12:35 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 
> Why is this even necessary? To look up libc functions we used to leave the module name empty in the FFI declaration, so it wouldn't ever need to know the exact location of libc. This used to end up in a dlopen() call with a null file name.
> 
> - Bert -
> 
> 
> On 08.01.2013, at 11:57, commits at squeakvm.org wrote:
> 
> >
> > Revision: 2661
> > Author:   eliot
> > Date:     2013-01-08 11:57:41 -0800 (Tue, 08 Jan 2013)
> > Log Message:
> > -----------
> > Add yet another libc line to the linux launch script(s), and try and make the
> > script suggest users extend it themselves.  you can lead a horse to water...
> > Rationalize the includes in sqUnixUUID.c.
> >
> > Modified Paths:
> > --------------
> >    branches/Cog/platforms/unix/config/bin.squeak.sh.in
> >    branches/Cog/platforms/unix/config/squeak.sh.in
> >    branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c
> >
> > Property Changed:
> > ----------------
> >    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
> >
> >
> > Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
> > ___________________________________________________________________
> > Modified: checkindate
> >   - Mon Jan  7 13:52:47 PST 2013
> >   + Tue Jan  8 11:56:08 PST 2013
> >
> > Modified: branches/Cog/platforms/unix/config/bin.squeak.sh.in
> > ===================================================================
> > --- branches/Cog/platforms/unix/config/bin.squeak.sh.in       2013-01-07 21:54:37 UTC (rev 2660)
> > +++ branches/Cog/platforms/unix/config/bin.squeak.sh.in       2013-01-08 19:57:41 UTC (rev 2661)
> > @@ -14,15 +14,18 @@
> > # libc (e.g. through the FFI) then it must use the same version that the VM uses
> > # and so it should take precedence over /lib libc.  This is done by setting
> > # LD_LIBRARY_PATH appropriately, based on ldd's idea of the libc use by the VM.
> > -case `/usr/bin/ldd "$BIN/squeak" | /bin/fgrep /libc. | sed 's/^.*=> //'` in
> > +LIBC_SO="`/usr/bin/ldd "$BIN/squeak" | /bin/fgrep /libc. | sed 's/^.*=> //'`"
> > +case "$LIBC_SO" in
> > /lib/libc*)                                   SVMLLP="/lib:/usr/lib";;
> > /lib32/libc*)                         SVMLLP="/lib32:/usr/lib32";;
> > /lib64/libc*)                         SVMLLP="/lib64:/usr/lib64";;
> > /lib/tls/libc*)                               SVMLLP="/lib/tls:/lib:/usr/lib/tls:/usr/lib";;
> > /lib/i386-linux-gnu/libc*)    \
> > -     SVMLLP="/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu";;
> > +     SVMLLP="/lib/i386-linux-gnu:/lib:/usr/lib/i386-linux-gnu:/usr/lib";;
> > /lib/tls/i686/cmov/libc*)     \
> >       SVMLLP="/lib/tls/i686/cmov:/lib:/usr/lib/tls/i686/cmov:/usr/lib";;
> > +/lib/386-linux-gnu/i686/cmov/libc*)  \
> > +     SVMLLP="/lib/386-linux-gnu/i686/cmov:/lib:/usr/lib/386-linux-gnu/i686/cmov:/usr/lib";;
> > /lib/tls/i686/nosegneg/libc*) \
> >       SVMLLP="/lib/i686/nosegneg/tls:/lib:/usr/lib/i686/nosegneg/tls:/usr/lib";;
> > "")   case `/bin/uname -m || /usr/bin/uname -m` in
> > @@ -30,7 +33,7 @@
> >       *)      echo "/usr/bin/ldd didn't produce any output. Can't infer base LD_LIBRARY_PATH. Aborting." 1>&2
> >       esac
> >       exit 1;;
> > -*)   echo "Can't infer base LD_LIBRARY_PATH. Aborting." 1>&2
> > +*)   echo "Can't infer base LD_LIBRARY_PATH. Aborting. Try adding a line for $LIBC_SO to $0. Please report your edit to squeak vm-dev." 1>&2
> >       exit 1
> > esac
> > # prepending is less flexible but safer because it ensures we find the plugins
> >
> > Modified: branches/Cog/platforms/unix/config/squeak.sh.in
> > ===================================================================
> > --- branches/Cog/platforms/unix/config/squeak.sh.in   2013-01-07 21:54:37 UTC (rev 2660)
> > +++ branches/Cog/platforms/unix/config/squeak.sh.in   2013-01-08 19:57:41 UTC (rev 2661)
> > @@ -14,15 +14,18 @@
> > # libc (e.g. through the FFI) then it must use the same version that the VM uses
> > # and so it should take precedence over /lib libc.  This is done by setting
> > # LD_LIBRARY_PATH appropriately, based on ldd's idea of the libc use by the VM.
> > -case `/usr/bin/ldd "$BIN/squeak" | /bin/fgrep /libc. | sed 's/^.*=> //'` in
> > +LIBC_SO="`/usr/bin/ldd "$BIN/squeak" | /bin/fgrep /libc. | sed 's/^.*=> //'`"
> > +case "$LIBC_SO" in
> > /lib/libc*)                                   SVMLLP="/lib:/usr/lib";;
> > /lib32/libc*)                         SVMLLP="/lib32:/usr/lib32";;
> > /lib64/libc*)                         SVMLLP="/lib64:/usr/lib64";;
> > /lib/tls/libc*)                               SVMLLP="/lib/tls:/lib:/usr/lib/tls:/usr/lib";;
> > /lib/i386-linux-gnu/libc*)    \
> > -     SVMLLP="/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu";;
> > +     SVMLLP="/lib/i386-linux-gnu:/lib:/usr/lib/i386-linux-gnu:/usr/lib";;
> > /lib/tls/i686/cmov/libc*)     \
> >       SVMLLP="/lib/tls/i686/cmov:/lib:/usr/lib/tls/i686/cmov:/usr/lib";;
> > +/lib/386-linux-gnu/i686/cmov/libc*)  \
> > +     SVMLLP="/lib/386-linux-gnu/i686/cmov:/lib:/usr/lib/386-linux-gnu/i686/cmov:/usr/lib";;
> > /lib/tls/i686/nosegneg/libc*) \
> >       SVMLLP="/lib/i686/nosegneg/tls:/lib:/usr/lib/i686/nosegneg/tls:/usr/lib";;
> > "")   case `/bin/uname -m || /usr/bin/uname -m` in
> > @@ -30,7 +33,7 @@
> >       *)      echo "/usr/bin/ldd didn't produce any output. Can't infer base LD_LIBRARY_PATH. Aborting." 1>&2
> >       esac
> >       exit 1;;
> > -*)   echo "Can't infer base LD_LIBRARY_PATH. Aborting." 1>&2
> > +*)   echo "Can't infer base LD_LIBRARY_PATH. Aborting. Try adding a line for $LIBC_SO to $0. Please report your edit to squeak vm-dev." 1>&2
> >       exit 1
> > esac
> > # prepending is less flexible but safer because it ensures we find the plugins
> >
> > Modified: branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c
> > ===================================================================
> > --- branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c       2013-01-07 21:54:37 UTC (rev 2660)
> > +++ branches/Cog/platforms/unix/plugins/UUIDPlugin/sqUnixUUID.c       2013-01-08 19:57:41 UTC (rev 2661)
> > @@ -3,12 +3,12 @@
> > #if defined(HAVE_SYS_UUID_H)
> > # include <sys/types.h>
> > # include <sys/uuid.h>
> > -#endif
> > -#if defined(HAVE_UUID_UUID_H)
> > +#elif defined(HAVE_UUID_UUID_H)
> > # include <uuid/uuid.h>
> > -#endif
> > -#if defined(HAVE_UUID_H)
> > +#elif defined(HAVE_UUID_H)
> > # include <uuid.h>
> > +#else
> > +# error cannot find a uuid.h to include
> > #endif
> >
> > #include "sq.h"
> >
> 
> 
> 
> 
> -- 
> best,
> Eliot



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20130108/f825bb4c/attachment-0001.htm


More information about the Vm-dev mailing list