delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/11/02:58:46

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <48F04E7A.44187926@dessent.net>
Date: Fri, 10 Oct 2008 23:58:02 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Linker Search Directories
References: <003f01c92b6b$4840a160$4001a8c0 AT mycomputer>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

John Emmas wrote:

> I'm trying to build a project (using make) that needs python.  Python's link
> library is in /lib/python2.5/config/ but unfortunately, 'make' doesn't seem
> to be aware of this and fails with the message:-

make doesn't know anything about linker search directories.  It just
executes commands that are listed in the Makefile, it has no knowledge
of their semantics.

So the answer depends on how the Makefile was written.  In projects that
use autoconf, you can define variables when you run configure, e.g. 

./configure LDFLAGS="-L/usr/lib/python2.5/config" --enable-foo
--with-bar ...

If there is no configure script you can still override variables when
invoking make, but it becomes less obvious what the correct values are
since you have to look at the Makefile to find out what the variable
currently contains so that you can know what to set it to.

For example, if the final value of LDFLAGS in the Makefile after
everything is substituted works out to "-lfoo -lbar -lpython2.5", then
you would override it to add the necessary flag, e.g.

make LDFLAGS="-lfoo -lbar -L/usr/lib/python2.5/config -lpython2.5"

This is a pain, it's much simpler with the autoconf method because the
starting value of LDFLAGS is empty and autoconf adds on things to the
user's setting.  With make overrides you have to include the full final
value with your addition added on, which can be nontrivial to figure out
as you have to read through the whole Makefile.  And in the autoconf
world anyway the configure script is supposed to do the job of
determining all of this automatically -- both of which are reasons why
shipping a bare Makefile without a configure script is not very portable
and unfriendly.

I also note that this is supposed to be covered by the python-config
script, such that autoconf scripts or Makefiles can query the set of
required flags to be added to LDFLAGS/LIBS/CPPFLAGS/etc by the output of
python-config.  However it seems the Cygwin packaging of python is
broken because A) the python-config shebang points to a bogus
#!/tmp/python.6884/usr/bin/python2.5.exe, and B) it doesn't include the
necessary -L anyway.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019