.so or .so.0 or .so.1 or... (dynamic libraries extension)

Paul Dufresne dufrp at hotmail.com
Tue Mar 22 06:33:50 PST 2005


I have made major cleanup on my hard disk, to finally see that I was
unable to load SDL anymore, because the libraries were not found anymore.

Investigating, I found that I most likely had added my home LD_LIBRARY_PATH
directory and created two symlinks on SDL libs in /usr/lib. But I now
removed them.

We use safe_string in  src/mobius/vm/platform/unix/extprim.c:
#if defined(__CYGWIN__)
  #define DLL_FILE_NAME_EXTENSION ".dll"
#else
  #define DLL_FILE_NAME_EXTENSION ".so"
#endif
...
static char *safe_string(struct ByteArray *s, char const *suffix) {
  size_t len = BYTEARRAY_LEN(s);
  char *result = malloc(strlen(suffix) + len + 1);
  if (result == NULL)
    return NULL;
  memcpy(result, s->elements, len);
  strcpy(result + len, suffix);
  return result;
}

Bool openExternalLibrary(struct ByteArray *libname,
			struct ByteArray *handle)
{
  char *fullname;
  void *h;

  assert(BYTEARRAY_LEN(handle) >= sizeof(h));

  fullname = safe_string(libname, DLL_FILE_NAME_EXTENSION);
...

Now, my problem is that my /usr/lib directory looks like this:
libImlib.so.1
libImlib.so.1.9.14
libImlib.so.11
libImlib.so.11.0.0
libMagick.so.6
libMagick.so.6.0.2
libMrm.so.2
libMrm.so.2.0.1
libORBit-2.so.0
libORBit-2.so.0.0.0
libORBit-imodule-2.so.0
libORBit-imodule-2.so.0.0.0
libORBitCosNaming-2.so.0
libORBitCosNaming-2.so.0.0.0
libOggFLAC.so.1
libOggFLAC.so.1.0.2
libSDL-1.2.so.0
libSDL-1.2.so.0.7.0
libSDL_image-1.2.so.0
libSDL_image-1.2.so.0.1.2
libSDL_mixer-1.2.so.0
libSDL_mixer-1.2.so.0.2.3
libSGE.so.0
libSGE.so.0.020904
libWand.so.6
libWand.so.6.0.2
libXcursor.so.1
libXcursor.so.1.0.2
libXft.so.2
libXft.so.2.1.1
libXm.so.2
libXm.so.2.0.1
libXrender.so.1
libXrender.so.1.2.2
liba52-0.7.4.so
libadns.so.1
libadns.so.1.0
libalsatoss.a
libalsatoss.la
libalsatoss.so
libalsatoss.so.0
libalsatoss.so.0.0.0
libanl.a
libanl.so
libao.so.2
libao.so.2.1.2
libaoss.a
libaoss.la
libaoss.so
libaoss.so.0
libaoss.so.0.0.0
libapm.so.1
libapm.so.1.0.0
libapt-inst-libc6.3-5.so.1.0
libapt-inst-libc6.3-5.so.1.0.0
libapt-pkg-libc6.3-5.so.3.0

So there is almost no .so files.
Mostly .so.0 files.

Actually, the libs I build myself are "better" ls /usr/local/lib:
libSDL_gfx.a
libSDL_gfx.la
libSDL_gfx.so
libSDL_gfx.so.13
libSDL_gfx.so.13.0.0

I am not sure if my system (Ubuntu) is mostly like others, or very 
different.

Should we clearly specify in the documentation
to do a symlink if it does not exist, or should we find a way to 
automatically
find the correct filename of the library?





More information about the Slate mailing list