MacOS X: Loading extensions

2 views
Skip to first unread message

Steve...@zveno.com

unread,
Sep 3, 2001, 9:42:10 PM9/3/01
to
I was delighted to discover Tcl, and a recent version at that,
pre-installed on MacOS X (I understand the reason for it, given
Jim Ingham's involvement at Apple with tkgdb).

Now, one of the first things I have tried to do is get an
extension compiled and installed. Once I pointed the configure
script at the right place that went fine (compiling Tcl8.4a3
out-of-the-box was problematic - it couldn't figure out how to do
shared libraries).

However, when I try to load my dynamic (shared) library I get the
error 'dyld: inappropriate Mach-O file'. The 'file' command indicates
that the library file is of the correct type, though.

Google searches, FAQs, etc, have not thrown any light on the subject.

Any ideas?

Cheers,
Steve Ball

--
Steve Ball | XSLT Standard Library | Training & Seminars
Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas
http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development
Steve...@zveno.com +---------------------------+---------------------
Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099

Jeffrey Hobbs

unread,
Sep 4, 2001, 12:16:14 AM9/4/01
to
Steve...@zveno.com wrote:
...

> script at the right place that went fine (compiling Tcl8.4a3
> out-of-the-box was problematic - it couldn't figure out how to do
> shared libraries).
>
> However, when I try to load my dynamic (shared) library I get the
> error 'dyld: inappropriate Mach-O file'. The 'file' command indicates
> that the library file is of the correct type, though.

There is a patch for building on OS-X with the correct settings
to have the dlls work. This is certainly the first problem, and
is likely linked to the second. Check out the SF bug db for
more info. Tell me how it goes.

--
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions

Jon Guyer

unread,
Sep 4, 2001, 8:36:25 AM9/4/01
to

> However, when I try to load my dynamic (shared) library I get the
> error 'dyld: inappropriate Mach-O file'. The 'file' command indicates
> that the library file is of the correct type, though.

Is this Tcl extension a Mac-type .shlb shared library or a unix-type
.dll shared library? The former won't work and I don't know anything
about doing the latter; see Jeff's comments about a patch on SF.

--
Jonathan E. Guyer

<http://www.his.com/jguyer/>

Steve...@zveno.com

unread,
Sep 4, 2001, 5:02:36 PM9/4/01
to
Jon Guyer wrote:
>
> In article <3B943172...@zveno.com>, Steve...@zveno.com wrote:
>
> > However, when I try to load my dynamic (shared) library I get the
> > error 'dyld: inappropriate Mach-O file'. The 'file' command indicates
> > that the library file is of the correct type, though.
>
> Is this Tcl extension a Mac-type .shlb shared library or a unix-type
> .dll shared library? The former won't work and I don't know anything
> about doing the latter; see Jeff's comments about a patch on SF.

I'm trying to build a MacOS X-type .dylib dynamic library, which is
more like a Unix style .dll.

The patch seems to be close to what I need. Currently trying to apply
it to Tcl 8.4a3.

Daniel A. Steffen

unread,
Sep 4, 2001, 7:49:11 PM9/4/01
to

> The patch seems to be close to what I need. Currently trying to apply
> it to Tcl 8.4a3.

A while back, in connection with my update to patch 435258 on SF
(http://sourceforge.net/tracker/download.php?group_id=10894&atid=310894&
file_id=8079&aid=435258), I had posted some instructions on how to
build Tcl 8.3.3 as close as possible to what Apple does so that you can
install on top of the Apple delivered Tcl easily:
http://www.maths.mq.edu.au/~steffen/tcltk/darwin.php
this may help with compiling 8.4 as well

note that I had to make some changes to the patch just recently so that
it applies to the HEAD, as Vince Darley has checked in some changes to
tclLoadDyld.c, let me know if you need them.

The error you were seeing has to do with dyld binary formats, Fred
Sanchez' original code in tclLoadDyld.c used MachO bundles, which is
the binary format used for CFBundle et al (e.g. app. plugins), the new
patch changes this to standard .dylibs to be closer to other unices.
This will obviously break any extensions build with the old model...

Cheers,

Daniel

Reply all
Reply to author
Forward
0 new messages