How do you make shared libraries on Mac OS X ?

Stephen J. Turnbull stephen at xemacs.org
Tue Mar 6 12:28:28 EST 2007


Didier Verna writes:

 > Stephen J. Turnbull wrote:
 > 
 > > I don't see the problem.  I've been building the external widget for
 > > years, although I haven't tested it recently.  I just don't use shared
 > > libraries.  Why do you need a shared library?
 > 
 > libextcli_Xt.so.1 and libextcli_Xlib.so.1 are shared libraries.

libextcli_Xt.a and libextcli_Xlib.a are static libraries.  Do you
*need* shared libraries, or would inhibiting them so that you can
finish the build be good enough?

Doing this right on Mac OS X would involve at least fixing the
extension (.so -> .dylib).  (IIRC that's not strictly necessary but
there'd be no point in flouting convention.)

This test in src/Makefile.in.in looks bogus to me:

## I cannot figure out how to do shared a.out libraries, so just punt.
#  elif !defined (LINUX) || defined (__ELF__)
#   define EXTW_LINK(objs, output) $(CC) -shared objs -o output

However, I don't know what the right way to handle that test is, so
prepending three lines:

## I could tell you how to do .dylibs, but then I'd have to kill you.
#  elif defined (__APPLE__)
#   undef EXTW_LINK
## I cannot figure out how to do shared a.out libraries, so just punt.
#  elif !defined (LINUX) || defined (__ELF__)
#   define EXTW_LINK(objs, output) $(CC) -shared objs -o output

should allow you to build only the static libraries.  (untested)

On 21.5 building actually "works" because Ben moved the stanza that
defines shared_other_files to where EXTW_LINK isn't defined yet, and
as a consequence the shared libraries are *never* built in 21.5.  I'm
not sure why he did that, probably just an accident of reorganizing
the Makefile.



More information about the XEmacs-Beta mailing list