Opened 10 years ago

Closed 10 years ago

#149 closed defect (fixed)

review: auto detect libpython fails for netbsd and linux

Reported by: jinmei Owned by: jreed
Priority: low Milestone:
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: Add Hours to Ticket:
Total Hours: Internal?:

Description

We currently use the result of "python*-config --ldflags" to identify the necessary ldflag (specifically a -L option) to build bind10 with libpython.

Unfortunately it didn't work (at least some flavor of) NetBSD and Linux. This can be worked around by specifying LDFLAGS by hand before performing ./configure, but it's not intuitive.

There doesn't seem to be a perfect solution to this problem out there, but we could introduce one more hack: using python*-config --prefix/lib. From a quick check this worked for Linux. Should also be the case for NetBSD.

Subtickets

Change History (5)

comment:1 in reply to: ↑ description Changed 10 years ago by jinmei

  • Summary changed from auto detect libpython fails for netbsd and linux to review: auto detect libpython fails for netbsd and linux

I implemented this in the branches/trac149 branch. Please review.

Note: as I explained before, you don't have to checkout the whole branch for a quick check. In many cases this should suffice:

% cd trunk
% svn update
% svn switch svn+ssh://bind10.isc.org/svn/bind10/branches/trac149
(try it)
% svn switch svn+ssh://bind10.isc.org/svn/bind10/trunk

Likewise, to see diff this should be sufficient:

% svn diff svn+ssh://bind10.isc.org/svn/bind10/trunk svn+ssh://bind10.isc.org/svn/bind10/branches/trac149

Replying to jinmei:

We currently use the result of "python*-config --ldflags" to identify the necessary ldflag (specifically a -L option) to build bind10 with libpython.

Unfortunately it didn't work (at least some flavor of) NetBSD and Linux. This can be worked around by specifying LDFLAGS by hand before performing ./configure, but it's not intuitive.

There doesn't seem to be a perfect solution to this problem out there, but we could introduce one more hack: using python*-config --prefix/lib. From a quick check this worked for Linux. Should also be the case for NetBSD.

comment:2 follow-up: Changed 10 years ago by jreed

patch has:
+ # add any '-L..." flags to PYTHON_INCLUDES
Should that say PYTHON_LDFLAGS instead?

Also is that -L from python-config actually provide location that provides correct needed library?
(For example, my library is under the $prefix/lib and it is different from what is under the config directory.)

comment:3 in reply to: ↑ 2 ; follow-up: Changed 10 years ago by jinmei

  • Owner changed from jinmei to jreed
  • Status changed from new to assigned

Replying to jreed:

patch has:
+ # add any '-L..." flags to PYTHON_INCLUDES
Should that say PYTHON_LDFLAGS instead?

Good catch, fixed in r1732.

Also is that -L from python-config actually provide location that provides correct needed library?
(For example, my library is under the $prefix/lib and it is different from what is under the config directory.)

I don't understand the question...

  • which one do you mean by -L from python-config? from python-config --ldflags? or from --pefix (+ /lib?)
  • whether it's "correct" or not is in general a difficult question when we do auto-detect things, because ultimately only the user know what's "correct". at least the configure script perfroms AC_CHECK_LIB() with the identified parameters. and for the script, the definition of "correct" is the AC_CHECK_LIB() test passes. Do you mean it's not sufficient? Or do you mean we need an explicit switch so that the user can specify the "really correct" path?

comment:4 in reply to: ↑ 3 ; follow-up: Changed 10 years ago by jreed

Also is that -L from python-config actually provide location that provides correct needed library?
(For example, my library is under the $prefix/lib and it is different from what is under the config directory.)

I don't understand the question...

  • which one do you mean by -L from python-config? from python-config --ldflags? or from --pefix (+ /lib?)

Yes for python3.1-config --ldflags.

I was concerned that path like -L/opt/python3.1.1/lib/python3.1/config was wrong. But that appears to work for me.

Or do you mean we need an explicit switch so that the user can specify the "really correct" path?

We may not need that since my tests seem to be working.

You may commit this to trunk. Thank you!

comment:5 in reply to: ↑ 4 Changed 10 years ago by jinmei

  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to jreed:

You may commit this to trunk. Thank you!

Okay, committed. closing.

Note: See TracTickets for help on using tickets.