Professional Web Applications Themes

shared libraries, configure, make - Mac Programming

Trying to figure out some software installation issues, and getting somewhat confused. Two questions: (1) does OS X support shared libraries? There's a comment in one README file that says no, but another package talks about compiling a shared library. Does it depend on which OS version? (i.e. classic, 10.1, jaguar, panther, client vs. server) (2) can anyone recommend a good source for explaining how to setup/read configure scripts, and the differences between make/make clean/make test/make install? Thanks, Dave Stone...

  1. #1

    Default shared libraries, configure, make

    Trying to figure out some software installation issues, and getting
    somewhat confused. Two questions:

    (1) does OS X support shared libraries? There's a comment in one README
    file that says no, but another package talks about compiling a
    shared library. Does it depend on which OS version? (i.e. classic,
    10.1, jaguar, panther, client vs. server)

    (2) can anyone recommend a good source for explaining how to setup/read
    configure scripts, and the differences between make/make clean/make
    test/make install?

    Thanks,

    Dave Stone
    David Guest

  2. #2

    Default Re: shared libraries, configure, make

    Hi David,


    "David C. Stone" <com> writes: 

    Yes. They are called dynamic libraries on this system and have the
    extension .dylib, e.g. /usr/lib/libSystem.dylib.
     

    "Classic" is pre-X (up until 9.2) and a *very* different OS. You
    probably don't want to write new software for Classic or even port to
    it.
     

    For the beginning you should be fine with the INSTALL and README files
    that every package should have.

    If you really want to delve into configure scripts (probably
    overkill), the standard reference is

    GNU Autoconf, Automake, and Libtool
    by Gary V. Vaughan, Ben Elliston, Tom Tromey and Ian Lance Taylor

    For make and shell scripting (you need the latter for autoconf), you
    want to read some generic Unix development books. Have a look at the
    O'Reilly <http://www.oreilly.com/> catalog, they even have a dedicated
    Msc OS X corner, but the generic Unix books are also of interest.


    benny
    Benjamin Guest

  3. #3

    Default Re: shared libraries, configure, make

    David C. Stone wrote:
     

    Certainly does. There's hundreds on the system. I think every release
    in OS X must have had them in some form. Check the 'libtool' manual page.
     

    For configure scripts -- it depends what they are. An actual shell script?
    A plain text file used by a particular application? Or a real 'configure.in'
    file? I try not to read the configure scripts -- too much clutter.

    As for the make commands, first, read the 'make' manual page. The details
    all depend on the particular 'Makefile'. The argument you pass to the 'make'
    command just identifies the so-called target inside the make file. If there
    isn't a target by the name of 'clean', then 'make clean' will fail. Each
    target has a set of commands associated with it -- we can pretend they're
    plain shell commands. For example:

    clean:
    rm -f *.o core

    The UNIX Programming Environment book is a good introduction to shell
    scripting, C programming, makefiles, lex/yacc, and doentation on UNIX.
    It's old, but nearly all of it is still good (the book, I mean! :-).



    Mike Guest

  4. #4

    Default Re: shared libraries, configure, make

    In article <blsc9v$ldc$news.rcn.net>, Mike Hall
    <com> wrote:
     

    Thanks to both Mike and benny for the responses. 
    >
    > Certainly does. There's hundreds on the system. I think every release
    > in OS X must have had them in some form. Check the 'libtool' manual page.[/ref]

    Ok, here's the problem. According to the configure script for Zlib:

    # To create a shared library, use "configure --shared"; by default a
    static
    # library is created. If the primitive shared library support provided
    here
    # does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz

    so I did that, and received no errors. Then I followed the make
    instructions to "make test; make install"

    make test reports no errors and seems to work fine.
    make install, however, fails, and no .dylib is created:

    admin% sudo make install
    cp zlib.h zconf.h /usr/local/include
    chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
    cp libz.a /usr/local/lib
    cd /usr/local/lib; chmod 755 libz.a
    cd /usr/local/lib; if test -f libz.so.1.1.4; then \
    rm -f libz.so libz.so.1; \
    ln -s libz.so.1.1.4 libz.so; \
    ln -s libz.so.1.1.4 libz.so.1; \
    (ldconfig || true) >/dev/null 2>&1; \
    fi

    the libz.a is, however, created and copied to /usr/local/lib

    So how do I get the .dylib created? Anyone successfully done this
    on 10.1.x?

    Thanks,

    Dave Stone
    David Guest

  5. #5

    Default Re: shared libraries, configure, make

    On Mon, 6 Oct 2003, David C. Stone wrote:
     
    >
    > Thanks to both Mike and benny for the responses. 
    > >
    > > Certainly does. There's hundreds on the system. I think every release
    > > in OS X must have had them in some form. Check the 'libtool' manual page.[/ref]
    >
    > Ok, here's the problem. According to the configure script for Zlib:
    >
    > # To create a shared library, use "configure --shared"; by default a
    > static
    > # library is created. If the primitive shared library support provided
    > here
    > # does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
    >
    > so I did that, and received no errors. Then I followed the make
    > instructions to "make test; make install"
    >
    > make test reports no errors and seems to work fine.
    > make install, however, fails, and no .dylib is created:
    >
    > admin% sudo make install
    > cp zlib.h zconf.h /usr/local/include
    > chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
    > cp libz.a /usr/local/lib
    > cd /usr/local/lib; chmod 755 libz.a
    > cd /usr/local/lib; if test -f libz.so.1.1.4; then \
    > rm -f libz.so libz.so.1; \
    > ln -s libz.so.1.1.4 libz.so; \
    > ln -s libz.so.1.1.4 libz.so.1; \
    > (ldconfig || true) >/dev/null 2>&1; \
    > fi
    >
    > the libz.a is, however, created and copied to /usr/local/lib
    >
    > So how do I get the .dylib created? Anyone successfully done this
    > on 10.1.x?[/ref]

    libz.so is a shared library.

    Fred

    Frederick Guest

  6. #6

    Default Re: shared libraries, configure, make

    David C. Stone wrote:
     

    It was able to determine how to make a shared lib?
     
     

    Hmmm, where does it ever install the .so ?
    And why is it called .so ??
     

    Yeah, pretty sure I have. I also recall searching around for a patch,
    I think.


    Mike Guest

  7. #7

    Default Re: shared libraries, configure, make

    Mike Hall wrote:
     

    Just use Apple's configure:
    http://www.opendarwin.org/cgi-bin/cvsweb.cgi/~checkout~/src/zlib/zlib/configure?rev=1.1.1.2&content-type=text/plain

    The appropriate bit would appear to be:
    Darwin*) SFLAGS=${CFLAGS-"-O3"}
    CFLAGS=${CFLAGS-"-O3"}
    SHAREDEXT='.dylib'
    LDSHARED=${LDSHARED-'$(CC) $(CFLAGS) -dynamiclib -install_name
    "$(libdir)/$(SHAREDLIB).$(VER)$(SHAREDEXT)" -current_version $(VER)
    -compatibility_version 1'}
    LDTEST=NO;;

    Peter

    Peter Guest

  8. #8

    Default Re: shared libraries, configure, make

    Hi David,


    "David C. Stone" <com> writes: 

    Does it install the ".so" files? That's what shared libraries are
    called on other systems, and they may just work. On Mac OS X, ".so"
    is just a unusual name for a dynamic lib, I have seen several packages
    that work fine with that kind of name.

    Note that zlib is part of the OS install and that you can get the
    source for the version that Apple uses from the OpenDarwin project.
    The diffs between that and the corresponding base version should help
    port any newer version that you may want to compile and install.


    benny
    Benjamin Guest

  9. #9

    Default Re: shared libraries, configure, make

    In article <benny.turtle-trading.net>, Benjamin
    Riefenstahl <de> wrote:
     
    >
    > Does it install the ".so" files? That's what shared libraries are[/ref]

    No. It appears that the Makefile is set to dump out the script for
    any part that fails during make [whatever]. On a related note, when
    I loook closely at the output from ./configure, it ALWAYS reports
    that "shared library is not supported" A cryptic comment in the
    top of the configure file suggests I need to use libtool, which does
    appear to be on my system and also appears to be the thing responsible
    for generating/renaming the .so files.
     


    Thanks again to all for the suggestions. I'll check out the files
    in the repository, and then have another stab at it.
    David Guest

  10. #10

    Default Re: shared libraries, configure, make

    In article <071020030910140743%com>,
    "David C. Stone" <com> wrote:
     
    > >
    > > Does it install the ".so" files? That's what shared libraries are[/ref]
    >
    > No. It appears that the Makefile is set to dump out the script for
    > any part that fails during make [whatever]. On a related note, when
    > I loook closely at the output from ./configure, it ALWAYS reports
    > that "shared library is not supported"[/ref]

    That's because you're not using Apple's patches to the configure script
    for zlib. Pick those up and it should work.

    -Eric

    --
    Eric Albert edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

Similar Threads

  1. Replies: 2
    Last Post: September 25th, 08:45 AM
  2. Shared libraries and security/domains
    By panorezo in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: September 30th, 12:43 PM
  3. loading shared libraries
    By albert105 in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: February 24th, 10:34 AM
  4. onSoundComplete for sounds from Shared Libraries
    By HumanJHawkins in forum Macromedia Flash
    Replies: 2
    Last Post: October 20th, 09:09 PM
  5. About shared libraries...
    By Kundan Nehete in forum Mac Programming
    Replies: 0
    Last Post: July 7th, 12:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139