Bug 233723

Summary: PYTHON_VERSION poisoning during chained build of dependencies
Product: Ports & Packages Reporter: rocky
Component: Individual Port(s)Assignee: freebsd-python (Nobody) <python>
Status: Closed FIXED    
Severity: Affects Some People CC: canardo909, chadf, freebsd, heinrich.adam, info, jbeich, john.j.helfrich, justin, lantw44, lwhsu, portmaster, rab, rob, steve.p, vvd, w.schwarzenfeld, wmoreno3
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237795
Bug Depends on: 242614    
Bug Blocks:    

Description rocky 2018-12-02 13:54:24 UTC
mesa-libs as a dependency of libepoxy failed to build: 

===>   libepoxy-1.5.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by libepoxy-1.5.2 for building
===>  Extracting for libepoxy-1.5.2
=> SHA256 Checksum OK for libepoxy-1.5.2.tar.xz.
===>  Patching for libepoxy-1.5.2
===>   libepoxy-1.5.2 depends on executable: meson - found
===>   libepoxy-1.5.2 depends on executable: ninja - found
===>   libepoxy-1.5.2 depends on package: pkgconf>=1.3.0_1 - found
===>   libepoxy-1.5.2 depends on file: /usr/local/bin/python3.6 - found
===>   libepoxy-1.5.2 depends on package: xorgproto>=0 - found
===>   libepoxy-1.5.2 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   libepoxy-1.5.2 depends on shared library: libGL.so - not found
===>  mesa-libs-18.1.9_4 needs Python 2.7 at most, but 3.6 was specified.
*** Error code 1

Suspect that the depends in libepoxy on python is setting the environment for the mesa-libs build, causing the failure:

libepoxy Makefile:

USES=           localbase meson pkgconfig python:3.3+,build tar:xz

Shouldn't there be some degree of isolation in individual port builds within the ports tree though? Should be possible to build ports within ports tree without poudriere or packages surely.

make.conf only has WANT_OPENLDAP_SASL=yes

System is also server based, so no DM. Uses ssh tunneling for some gui access.
Comment 1 Robert James Hernandez 2019-02-01 03:32:32 UTC
I ran into this as well trying to build the cloud-print-connector port inside a new jail, Im on the following commit in the master branch on the ports tree:

commit d3b56095dd0ea2ce90d28d2c8b3915707a7faa09 (origin/master)
Author: lx <lx@FreeBSD.org>
Date:   Tue Jan 29 23:15:55 2019 +0000

    Update to 0.11.2.
    
    PR:     233692
    Submitted by:   Sascha Biberhofer

Failed with the following similar error:

Installing fontconfig-2.12.6,1...
Running fc-cache to build fontconfig cache...                                                                                                                                                                                           
/usr/local/share/fonts: skipping, no such directory                                                                                                                                                                                     
/usr/local/lib/X11/fonts: skipping, no such directory                                                                                                                                                                                   
/var/db/fontconfig: cleaning cache directory                                                                                                                                                                                            
fc-cache: succeeded                                                                                                                                                                                                                     
===>   cairo-1.15.12,2 depends on shared library: libfontconfig.so - found (/usr/local/lib/libfontconfig.so)                                                                                                                            
===>   Returning to build of cairo-1.15.12,2                                                                                                                                                                                            
===>   cairo-1.15.12,2 depends on shared library: libglib-2.0.so - found (/usr/local/lib/libglib-2.0.so)                                                                                                                                
===>   cairo-1.15.12,2 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)                                                                                                                                        
===>   cairo-1.15.12,2 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)                                                                                                                                        
===>   cairo-1.15.12,2 depends on shared library: libGL.so - not found                                                                                                                                                                  
===>  mesa-libs-18.3.2 needs Python 2.7 at most, but 3.6 was specified.                                                                                                                                                                 
*** Error code 1                                                                                                                                                                                                                        
                                                                                                                                                                                                                                        
Stop.                                                                                                                                                                                                                                   
make[5]: stopped in /usr/ports/graphics/mesa-libs                                                                                                                                                                                       
*** Error code 1


System info:
# uname -r
11.2-RELEASE-p4

No make.conf
Comment 2 Justin Honold 2019-02-04 21:54:51 UTC
Also encountered via chain from /usr/ports/games/minecraft-client on a clean 12.0-RELEASE (i386) installation with a portsnap from Feb 4 2019. Busted at mesa-libs.
Comment 3 steve.p 2019-02-14 19:54:46 UTC
Firefox fails on this also
Comment 4 John Helfrich 2019-02-16 03:40:13 UTC
Also encountered via the sway port at /usr/ports/x11-wm/sway/
Clean 12.0-RELEASE (amd64)

Stopped at ===>  mesa-libs-18.3.2 needs Python 2.7 at most, but 3.6 was specified.
Comment 5 Jan Beich freebsd_committer 2019-02-16 09:56:01 UTC
Looks like a framework issue. Switching mesa-* to USES=python:build doesn't help.

$ make clean all -C /usr/ports/graphics/libepoxy
[...]
===>   mesa-libs-18.3.2 depends on package: llvm60>=3.9.0_4 - not found
===>  llvm60-6.0.1_6 needs Python 2.7 at most, but 3.6 was specified.
*** Error code 1
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2019-02-16 11:09:12 UTC
Cc: maintainer of x11-wm/sway .
Comment 7 Antoine Brodin freebsd_committer 2019-02-16 15:29:42 UTC
Try removing DEPENDS_ARGS line from python.mk
Comment 8 William Elasio Moreno Albarracin 2019-02-17 12:07:45 UTC
Hello, I had have this issue when I tried to install via ports:

cd /usr/ports/net-p2p/monero-cli/
make install clean

I solved this issue by:

cd /usr/ports/graphics/mesa-libs/
make install clean

All install ready and return to:

cd /usr/ports/net-p2p/monero-cli/
mahe install clean

And all OK
Comment 9 Tobias Kortkamp freebsd_committer 2019-07-05 09:57:04 UTC
*** Bug 238871 has been marked as a duplicate of this bug. ***
Comment 10 Ralph Bacolod 2019-07-14 13:59:04 UTC
ran into same issue with X11/kde5
misc/iso-codes stops with "needs Python 3.4 at least, but 2.7 was specified"
got around it by going into iso-code and building it directly.
Comment 11 Mohammad S. Babaei 2019-08-12 23:38:29 UTC
(In reply to Ralph Bacolod from comment #10)
Thanks, I tried installing LLVM90 and faced the same issue. Your solution worked for me.
Comment 12 Walter Schwarzenfeld freebsd_triage 2019-08-14 13:47:11 UTC
*** Bug 239852 has been marked as a duplicate of this bug. ***
Comment 13 VVD 2019-09-13 12:30:13 UTC
(In reply to Jan Beich from comment #5)
Just build mesa-libs and mesa-dri with python 3.7 installed only - without other versions of the python: no errors during build.
12.0 i386.
I can test on 12.0 amd64 if somebody want.
Comment 14 Chris Hutchinson 2019-12-11 07:04:14 UTC
(In reply to VVD from comment #13)
So if one must remove the other python versions installed.
What happens to the ports that depended on those removed
python versions?
This does not appear to be a solution. :(

--Chris
Comment 15 VVD 2019-12-11 14:32:05 UTC
(In reply to Chris Hutchinson from comment #14)
Why "must"?
I think you misunderstand me.
I said that it build fine without other python versions installed too.
With python 2.7 installed it build fine too.
Tested with installed pythons:
1) 3.6
2) 3.7
3) 2.7 + 3.7
In all cases build without errors.
Comment 16 Chris Hutchinson 2019-12-11 20:29:06 UTC
(In reply to VVD from comment #15)
Maybe I did. But if I understand you correctly,
it will build so long as there is only one version
of python installed.
So it must be the first port built. As building
other ports before it will likely install more than
one version of python. Which appears to cause it to
fail. :(
Thank you for your efforts.

--Chris
Comment 17 Chris Hutchinson 2019-12-11 22:22:43 UTC
python is no longer supported by ports(7):

ENV:
fresh build/install of world/kernel

FreeBSD eleventhree 11.3-RELEASE-p5 FreeBSD 11.3-RELEASE-p5 #0 r355580:
Tue Dec 10 13:22:30 PST 2019
root@eleventhree:/usr/obj/usr/src/sys/ELEVENTHREE  amd64

empty make.conf(5)

pkg delete -a
cd /var/db/ports
rm -r ./*
cd /usr/ports/ports-mgmt/pkg
make; make deinstall && make reinstall
cd /usr/ports/graphics/mesa-dri
make
accept all default options

RESULTS:
===>   mesa-dri-18.3.2_9 depends on package: wayland-protocols>=1.8 - found
===>   mesa-dri-18.3.2_9 depends on file: /usr/local/libdata/pkgconfig/pthread-stubs.pc - found
===>   mesa-dri-18.3.2_9 depends on executable: bison - found
===>   mesa-dri-18.3.2_9 depends on executable: msgfmt - found
===>   mesa-dri-18.3.2_9 depends on executable: gmake - found
===>   mesa-dri-18.3.2_9 depends on package: pkgconf>=1.3.0_1 - found
===>   mesa-dri-18.3.2_9 depends on file: /usr/local/bin/python2.7 - found
===>   mesa-dri-18.3.2_9 depends on package: llvm80>=3.9.0_4 - not found
===>  llvm80-8.0.1_3 needs Python 3.6 at least, but 2.7 was specified.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/llvm80
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/mesa-dri
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/mesa-dri

There's no escaping it. Python is no longer properly supported
in the ports tree. :(

--Chris
Comment 18 Antoine Brodin freebsd_committer 2019-12-11 22:30:03 UTC
Did anyone try what was suggested in comment #7 instead of complaining?
Comment 19 Chris Hutchinson 2019-12-12 00:01:11 UTC
(In reply to Antoine Brodin from comment #18)
Funny you should ask. I was just going to ask if anyone
knew of a python.mk version that worked.
It appears the last (most recent) change, was to
add version 3.8.

BTW *which* DEPENDS_ARGS line?
Walter Schwarzenfeld alludes to lines 457-465 being
the problem:
    457 # Pass PYTHON_VERSION down the dependency chain. This ensures that
    458 # port A -> B -> C all will use the same python version and do not
    459 # try to find a different one, if the passed version fits into
    460 # the supported version range.
    461 PYTHON_VERSION?=        python${_PYTHON_VERSION}
    462 .if !defined(PYTHON_NO_DEPENDS) && \
    463     ${PYTHON_VERSION} != python${PYTHON_DEFAULT}
    464 DEPENDS_ARGS+=          PYTHON_VERSION=${PYTHON_VERSION}
    465 .endif
in 237795. Which *also* contains DEPENDS_ARGS. But given this
is part of a larger conditional. It will require nuking the
rest of it.

As to "just complaining"; I'm attempting to eliminate possibilities
in an effort to narrow things down to a direct cause/solution.

Thanks for the input! :)

--Chris
Comment 20 Chris Hutchinson 2019-12-12 00:30:42 UTC
(In reply to Chris Hutchinson from comment #19)
OK I've found it.
I'm making a patch now. Will post it shortly.

--Chris
Comment 21 Chris Hutchinson 2019-12-12 00:31:57 UTC
(In reply to Chris Hutchinson from comment #19)
OK I've found it.
I'm making a patch now. Will post it shortly.

--Chris
Comment 22 Chris Hutchinson 2019-12-12 01:49:21 UTC
OK I've created a patch that cures the problem.
Please see:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237795#c20
for the solution.

Thanks for all the comments!

--Chris
Comment 23 Walter Schwarzenfeld freebsd_triage 2020-01-26 09:26:00 UTC
(In reply to Chris Hutchinson from comment #19)
The conditional is removed in ports r522485.