Professional Web Applications Themes

Linking to Mach-O bundle (libpq) - Mac Programming

Hello. I'm developing a generic unix console application. It is linked to a few libraries including postgresql's libpq. When I check shared libraries my application uses with otools -L, it doesn't list libpq. Looked like it is linked with static library. so i checked if dylib file exist in pgsql's lib directory and found no dylib file but .so file. file command says it is a Mach-O bundle file. I have no knowledge regarding Mach-O bundle file. How do you link bundle files into your application using commandline tools? My application is not Xcode project but just a Makefile project. ...

  1. #1

    Default Linking to Mach-O bundle (libpq)


    Hello.

    I'm developing a generic unix console application. It is linked to a few
    libraries including postgresql's libpq.

    When I check shared libraries my application uses with otools -L, it doesn't
    list libpq. Looked like it is linked with static library. so i checked if
    dylib file exist in pgsql's lib directory and found no dylib file but .so
    file. file command says it is a Mach-O bundle file. I have no knowledge
    regarding Mach-O bundle file.

    How do you link bundle files into your application using commandline tools? My
    application is not Xcode project but just a Makefile project.

    Thanks.
    --
    Y. J. Chun
    Y. Guest

  2. #2

    Default Re: Linking to Mach-O bundle (libpq)


    "Y. J. Chun" <com_SPAM> writes:
     

    To have used the .so extension for shared object files would have been
    an act of not thinking sufficiently different.

    You can turn libpq.a into libpq.dylib as follows:

    % libtool -dynamic -o libpq.dylib libpq.a -lSystem

    This produces a file called libpq.dylib in the same directory as
    libpq.a. If you recompile your program, it should then be linked with
    the new dynamic library. If not, you can give the -dynamic flag to
    gcc. To successfully run the program, you will also need to make the
    library accessible to dyld(1), e.g. by setting the DYLD_LIBRARY_PATH
    environment variable.
    Robert Guest

  3. #3

    Default Re: Linking to Mach-O bundle (libpq)

    Hi,

    "Y. J. Chun" <com_SPAM> writes: 

    A name doesn't say much about a file type, but the linker expects a
    specific naming convention.

    I just recently read the Fink porting notes about this topic and found
    them interesting <http://fink.sourceforge.net/doc/porting/shared.php>.

    benny
    Benjamin Guest

Similar Threads

  1. Can't build libpq test example
    By Jim in forum PostgreSQL / PGSQL
    Replies: 2
    Last Post: February 9th, 11:22 PM
  2. Statically linking against libpq
    By Matthew Metnetsky in forum PostgreSQL / PGSQL
    Replies: 6
    Last Post: January 18th, 08:06 PM
  3. Bundle::CPAN: File lacking bundle definition
    By Jim Keenan in forum PERL Modules
    Replies: 0
    Last Post: April 1st, 02:23 PM
  4. How can I load a CFM shared library in a Mach-O bundle?
    By Hans Stoessel in forum Mac Programming
    Replies: 0
    Last Post: September 19th, 12:23 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