Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Linking to Mach-O bundle (libpq)

0 views
Skip to first unread message

Y. J. Chun

unread,
Apr 18, 2004, 6:12:06 PM4/18/04
to

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

Robert Hsu

unread,
Apr 18, 2004, 10:48:40 PM4/18/04
to

"Y. J. Chun" <NO_y...@mac.com_SPAM> writes:

> 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.

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.

Benjamin Riefenstahl

unread,
Apr 20, 2004, 6:48:06 AM4/20/04
to
Hi,

"Y. J. Chun" <NO_y...@mac.com_SPAM> writes:

> 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.

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

0 new messages