[Openmcl-devel] openmcl64 on x86_64 and 32 bit libraries

Gary Byers gb at clozure.com
Sat May 26 06:09:48 PDT 2007



On Sat, 26 May 2007, Stefan Nobis wrote:

> Hi.
>
> I just tried to load some libraries with the newest prerelease of
> openmcl on my new MBP (Core 2 Duo). For example libsqlite3 is a 32 bit
> library and openmcl doesn't load it:
>
> ,----
> | % openmcl
> | ; loading system definition from /usr/local/src/ccl/tools/asdf-install/asdf-install.asd into #<Package "ASDF0">
> | ; registering #<SYSTEM ASDF-INSTALL #x300040F2BC0D> as ASDF-INSTALL
> | Welcome to OpenMCL Version 1.1-pre-070512 (DarwinX8664)!
> | ? (ccl:open-shared-library "libsqlite3.dylib")
> | > Error: Error opening shared library "libsqlite3.dylib": dlopen(libsqlite3.dylib, 10): no suitable image found.  Did find:
> | >               /usr/lib/libsqlite3.dylib: no matching architecture in universal wrapper
> | > While executing: OPEN-SHARED-LIBRARY, in process listener(1).
> | > Type :POP to abort, :R for a list of available restarts.
> | > Type :? for other options.
> | 1 > :q
> | ? (quit)
> | % file /usr/lib/libsqlite3.dylib
> | /usr/lib/libsqlite3.dylib: symbolic link to `libsqlite3.0.dylib'
> | % file /usr/lib/libsqlite3.0.dylib
> | /usr/lib/libsqlite3.0.dylib: Mach-O universal binary with 2 architectures
> | /usr/lib/libsqlite3.0.dylib (for architecture i386):    Mach-O dynamically linked shared library i386
> | /usr/lib/libsqlite3.0.dylib (for architecture ppc):     Mach-O dynamically linked shared library ppc
> `----
>
> So I assume it's not possible to load 32 bit libraries with openmcl64?

It is not possible to load 32-bit libraries from 64-bit applications
(or vice versa) on OSX (or on any other OS that I can think of
offhand); this has nothing to do with OpenMCL specifically.

> Is this support planned for sometime in the near future?

As I said, I don't know of any OSes that offer support for having
32-bit and 64-bit userspace code running in the same process (and
any such support would have to be provided at the OS level.)  I don't
even know if it's possible to do this (or the details of how it could
be made to work); my best guess is that it's (a) at least very hard to do
(b) even harder to do without introducing severe performance and usability
penalties and (c) fortunately, something that (after a bit of thought)
most people will realize that they don't really need or want.


What users of 64-bit applications more likely do want and need is
... 64-bit libraries.  In the case of open-source things (including
sqlite, which Apple also bundles with the OS), it's often fairly
simple to build 64-bit versions of the library from source.  In the case of
closed-source things (including Carbon and Cocoa and most of the
things that they depend on): as of Tiger, Apple doesn't provide
64-bit versions as of Tiger, but that's an announced feature of
Leopard.



> Is sbcl the
> only free alternative that's capable of loading 32 bit libraries on
> x86_64 Macs?

It is not particularly difficult for 32-bit applications to load 32-bit
libraries; the dynamic linker does most of the hard stuff ...

I assume that any 32-bit CL implementation that can load libraries and
that runs on OSX can load 32-bit libraries on OSX.


>
> -- 
> Until the next mail...,
> Stefan.
>

I sort of assume that everyone understands these issues, but I doubt
if that assumption's valid.

I also assume that there's a FAQ or something similar somewhere that
concisely explains these issues.  That might be a more valid assumption,
but I don't know the URL of such a "FAQ or something";  Apple's developer
site certainly offers the information, but I don't know how concisely
it's presented.

I also think that it's pretty much self-evident that none of this
has much to do with OpenMCL, but to state the obvious:

  - most libraries that ship with Tiger are 32-bit only; libSystem
    (basically the standard C library) is one of the few exceptions.

  - 64-bit applications can't link against 32-bit code (statically or
    dynamically); 32-bit applications can't link against 64-bit code.
    (If it's even possible to implement this, it would involve a lot
    of work at pretty low levels of the OS; I imagine that that
    would have enormous hack value and minimal practical value.)

  - the x86 version of OpenMCL is a 64-bit application.



More information about the Openmcl-devel mailing list