[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile on MacOS

From: Andrea -XFox- Govoni
Subject: Re: Compile on MacOS
Date: Tue, 08 Nov 2005 15:54:22 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; it-IT; rv:1.8b) Gecko/20050217

Thomas Dickey ha scritto:

>> This is really a misfeature in ld, which seems to look for .dylib
>> libraries along the whole library path before it bothers looking for .a
>> libraries.  This means that -L switches won't matter unless OpenSSL is
>> built with shared library support.

> As I read it, it doesn't mention the problem that you're seeing with
> ncurses - adding new symbols produces a linker problem since the
> new tic/infocmp use the symbols which aren't present earlier in the path.

To me it seems it's the same problem that ncurses has when trying to
build an executable that use it.
Since in Mac OS X there is a system ncurses *shared* library

[localhost:/usr/lib] xfox% ls -l *ncurses*
-rw-r--r--   1 root  wheel  304580 Nov  2 00:21 libncurses.5.4.dylib
-rw-r--r--   1 root  wheel  278948 Mar 21  2005 libncurses.5.dylib
lrwxr-xr-x   1 root  wheel      20 Apr 30  2005 libncurses.dylib@ ->

when you try to link object files that uses the ncurses library to make
an executable, even if you don't pass the -dynamic flag to GCC and pass
with -L<path> the location where the static ncurses library is located,
GCC (or ld) picks up the system shared library instead of the specified
static one.
Since the system library doesn't export some required symbols required
by the linked object files, maybe because they are expected to link with
5.5 version of the library but they are being actually linked with the
5.4 version one, the link fails.

-search_paths_first addresses this issue by forcing ld to look at a
search location for the dynamic and the static library *before* to
proceed to check the next search location.
In this way libncurses.a is picked up because its directory is searched
first, since it is passed to GCC with the -L../lib flag, and there isn't
any shared version of the ncurses library in ../lib.

I also found in the ld man page where it says that -dynamic is the
default and the gcc man page says that it doesn't work to pass to ld
-static because:
     On systems that support dynamic linking, this prevents linking with
     the shared libraries.  On other systems, this option has no effect.
     This option will not work on Mac OS X unless all libraries (includ-
     ing libgcc.a) have also been compiled with -static.  Since neither
     a static version of libSystem.dylib nor crt0.o are provided, this
     option is not useful to most people.

This is how I understand the whole thing, excuse me if I didn't
understand your point and I'm wrong.

Andrea "XFox" Govoni

ICQ UIN: 43488185
AIM/iChat: address@hidden
Yahoo! ID: xfox82
Skype Name: draykan

KeyID: 0x212E69C1
Fingerprint: FBE1 CA7D 34BE 4A53 9639  5C36 B7A0 605F 212E 69C1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]