[Top][All Lists]

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

gcc -print-search-dirs / MacOS X 10.2

From: Robby Griffin
Subject: gcc -print-search-dirs / MacOS X 10.2
Date: Wed, 30 Oct 2002 23:48:12 -0500

libtool.m4 in cvs says:

if test "$GCC" = yes; then
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g"`

When this runs on MacOS X 10.2 (with August 2002 developer tools), it gets only one search dir rather than the whole set of dirs, and leads to later problems like the inability to locate libc when linking libltdl.

This gcc appears to use a linefeed as the path separator (see below), so piping the gcc output directly to grep doesn't look very useful. What might be a good strategy for repairing the output and producing a search path?

1. Special-case this OS / compiler? I'm not sure if this is Apple's fault or gcc's, but hopefully it doesn't extend to other platforms / versions. Might be ok if we can pin down the conditions under which it occurs, and just substitute a constant path.

2. Flatten into a single line first and then extract the part between "libraries:" and (end-of-string or (word followed by colon)). Sounds workable. Assume the libraries section is always last and it's simpler.

3. Do something iterative, begin with the line that matches "^libraries:" and keep adding lines to the search list until eof or a line that doesn't look like a dir somehow:
        - doesn't start with a slash
        - contains a colon
    - other?



% gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1161, based on gcc version 3.1 20020420 (prerelease)

% gcc -print-search-dirs
install: /usr/libexec/gcc/darwin/ppc/3.1/
programs: =/usr/libexec/gcc/darwin/ppc/3.1/
/usr/libexec/gcc/darwin/ppc-darwin/3.1/../../../../ppc-darwin/bin/ppc/ 3.1/
libraries: =/usr/libexec/gcc/darwin/ppc/3.1/
/usr/libexec/gcc/darwin/ppc-darwin/3.1/../../../../ppc-darwin/lib/ppc/ 3.1/

reply via email to

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