Bug 195803

Summary: dns/unbound build fails on python support
Product: Ports & Packages Reporter: Jeroen <freebsd>
Component: Individual Port(s)Assignee: Sergey Matveychuk <sem>
Status: Closed FIXED    
Severity: Affects Only Me CC: freebsd, sem
Priority: --- Flags: bugzilla: maintainer-feedback? (sem)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
config.log
none
Proposed patch (since 374343 revision)
none
The poudriere testport log (FreeBSD 10 amd64, with all options enabled)
none
manual conftest compilation
none
Proposed patch (since 374343 revision)
none
Proposed patch (since 374408 revision) none

Description Jeroen 2014-12-08 09:38:28 UTC
Created attachment 150341 [details]
config.log

When upgrading my unbound port, I have run into a problem with its python support. As far as I know I do not have any special python configuration. 

unbound/ $ sudo make
===>  License BSD4CLAUSE accepted by the user
===>  Found saved configuration for unbound-1.4.22_4
===>   unbound-1.5.0 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by unbound-1.5.0 for building
===>  Extracting for unbound-1.5.0
=> SHA256 Checksum OK for unbound-1.5.0.tar.gz.
===>  Patching for unbound-1.5.0
===>   unbound-1.5.0 depends on executable: swig - found
===>   unbound-1.5.0 depends on file: /usr/local/lib/libcrypto.so.8 - found
===>   unbound-1.5.0 depends on executable: gmake - found
===>   unbound-1.5.0 depends on file: /usr/local/bin/python2.7 - found
===>   unbound-1.5.0 depends on shared library: libexpat.so - found (/usr/local/lib/libexpat.so.6.0.0)
===>   unbound-1.5.0 depends on shared library: libldns.so - found (/usr/local/lib/libldns.so.1.6.17)

[....]

checking for python... /usr/local/bin/python2.7
checking for the distutils Python package... yes
checking for Python include path... -I/usr/local/include/python2.7
checking for Python library path... -L. -lpython2.7
checking for Python site-packages path... /usr/local/lib/python2.7/site-packages
checking consistency of all components of python development environment... no
configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

===>  Script "configure" failed unexpectedly.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-08 09:38:28 UTC
Auto-assigned to maintainer sem@FreeBSD.org
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-12-09 02:18:07 UTC
A commit references this bug:

Author: sem
Date: Tue Dec  9 02:18:02 UTC 2014
New revision: 374343
URL: https://svnweb.freebsd.org/changeset/ports/374343

Log:
  - Upgrade to 1.5.1. It fixes CVE-2014-8602.
  - Mark python support as broken: does not build.

  PR:		195814, 195803
  Submitted by:	Kenji Rikitake, Jeroen

Changes:
  head/dns/unbound/Makefile
  head/dns/unbound/distinfo
Comment 3 Sergey Matveychuk freebsd_committer freebsd_triage 2014-12-09 02:54:28 UTC
Not fixed really. Python support marked broken. Wait for a python guru to fix.
Comment 4 lightside 2014-12-09 12:16:32 UTC
Created attachment 150397 [details]
Proposed patch (since 374343 revision)

Hello.

Does attached patch works for you?

- Added ${PYTHON_LIBDIR} to LDFLAGS
- Strip ${PYTHON_SITELIBDIR}/_unbound.so, to fix warning
- Fixed pkg-plist
Comment 5 lightside 2014-12-09 12:17:17 UTC
Created attachment 150398 [details]
The poudriere testport log (FreeBSD 10 amd64, with all options enabled)
Comment 6 Jeroen 2014-12-09 13:43:35 UTC
The proposed patch does not work for me, it complains that there is an error at line 107.

If I leave out that part, and only add the LDFLAGS, it also does not work on my system.

For completeness sake I removed the three different python packages that I had installed (python, python2 and python27), and attempted to build unbound again. This started with installing python27, before continuing to build unbound, and then fail in the same place.


Furthermore, I did some testing on my own, playing with some flags, see attachment manual-conftest.txt.
Comment 7 Jeroen 2014-12-09 13:44:03 UTC
Created attachment 150399 [details]
manual conftest compilation
Comment 8 lightside 2014-12-09 15:03:50 UTC
Created attachment 150400 [details]
Proposed patch (since 374343 revision)

The usual place for libpython2.7.so is inside of /usr/local/lib:
# ls /usr/local/lib | grep libpython2.7.so

The result of following command:
# pkg which /usr/local/lib/libpython2.7.so
/usr/local/lib/libpython2.7.so was installed by package python27-2.7.8_6

If it is, then you could try to use
LDFLAGS+=-L${LOCALBASE}/lib

for PORT_OPTIONS:MPYTHON case.
Comment 9 Sergey Matveychuk freebsd_committer freebsd_triage 2014-12-09 15:05:23 UTC
reopen
Comment 10 Sergey Matveychuk freebsd_committer freebsd_triage 2014-12-09 17:07:10 UTC
LDFLAGS should be added as a configure parameter. Then it works. But I dislike 'strip' part. I will try to do it better.
Comment 11 commit-hook freebsd_committer freebsd_triage 2014-12-09 17:12:34 UTC
A commit references this bug:

Author: sem
Date: Tue Dec  9 17:11:48 UTC 2014
New revision: 374408
URL: https://svnweb.freebsd.org/changeset/ports/374408

Log:
  - Fix build with python
  - Fix plist

  PR:		195803

Changes:
  head/dns/unbound/Makefile
  head/dns/unbound/pkg-plist
Comment 12 Jeroen 2014-12-09 19:24:02 UTC
I've just updated to rev 374408 and successfully built and installed the port.
Comment 13 lightside 2014-12-10 09:39:46 UTC
Created attachment 150425 [details]
Proposed patch (since 374408 revision)

(In reply to Jeroen from comment #12)
> I've just updated to rev 374408 and successfully built and installed the
> port.

Ok, then it was related to used compiler.

The attached patch contains more correct fixes:
- Moved CPPFLAGS and LDFLAGS to global scope
- Removed pkgconfig from LIBEVENT uses
- Returned strip command for ${STAGEDIR}${PYTHON_SITELIBDIR}/_unbound.so, which actually works
- Fix portlint warning, by not muting the INSTALL_SCRIPT command