Bug 248488 - devel/llvm11: fails to package when both python37 and python38 installed
Summary: devel/llvm11: fails to package when both python37 and python38 installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-05 17:43 UTC by John Hein
Modified: 2020-08-05 23:49 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments
[patch] allow cmake to look for a specific python version (1.78 KB, patch)
2020-08-05 18:17 UTC, John Hein
no flags Details | Diff
[patch] allow cmake to look for a specific python version [v2] (635 bytes, patch)
2020-08-05 22:02 UTC, John Hein
jcfyecrayz: maintainer-approval? (brooks)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2020-08-05 17:43:37 UTC
If you have both python37 and python38 installed and you are using the current default settings (python37 is the current default), devel/llvm11 fails check-plist:

 .
 .
====> Running Q/A tests (stage-qa)
Error: /usr/loc/llvm11/lib/liblldb.so.11.0.0 is linked to /usr/loc/lib/libpython3.8.so.1.0 from lang/python38 but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libpython3.8.so:lang/python38
/!\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/__init__.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/_lldb.so
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/embedded_interpreter.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/Logger.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/__init__.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/attrib_fromdict.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/cache.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/cpp/__init__.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/cpp/gnu_%%LUA_LIBDIR%%stdcpp.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/cpp/%%LUA_LIBDIR%%cxx.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/metrics.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/formatters/synth.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/lldb-argdumper
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/utils/__init__.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/utils/in_call_stack.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/lldb/utils/symbolication.py
Error: Orphaned: llvm11/%%LUA_LIBDIR%%/python3.8/site-packages/six.py
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/__init__.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/_lldb.so
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/embedded_interpreter.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/Logger.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/__init__.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/attrib_fromdict.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/cache.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/cpp/__init__.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/cpp/gnu_%%LUA_LIBDIR%%stdcpp.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/cpp/%%LUA_LIBDIR%%cxx.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/metrics.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/formatters/synth.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/lldb-argdumper
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/utils/__init__.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/utils/in_call_stack.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/lldb/utils/symbolication.py
Error: Missing: llvm11/%%PYTHON_SITELIBDIR%%/six.py
===> Error: Plist issues found.



CMakeLists.txt changed from llvm10 to llvm11.  The difference at configure time shows up as:

for llvm10:
-- Found PythonInterp: /usr/local/bin/python3.7 (found version "3.7.8") 

for llvm11:
-- Found Python3: /usr/local/bin/python3.8 (found version "3.8.5") found components: Interpreter 


Passing in -DPYTHON_EXECUTABLE, etc., is no longer enough it seems.  I don't yet see a way to pass the "EXACT" version to the find_package() cmake command that is used in the llvm11 flavor or CMakeLists.txt (without patching).
Comment 1 John Hein 2020-08-05 17:45:41 UTC
See also upstream cmake discussion: https://gitlab.kitware.com/cmake/cmake/-/issues/19492
Comment 2 John Hein 2020-08-05 18:17:49 UTC
Created attachment 217033 [details]
[patch] allow cmake to look for a specific python version

Here's a patch that allows CMakeLists.txt to use EXACT_PYTHON_VERSION if defined.

QA tested with poudriere with both python37 and python38 installed.  PYTHON_VER is 3.7, and now configure indicates that it finds python3.7 instead of python3.8.  And now check-plist passes.

This could be upstreamed to llvm while we both wait for cmake to figure out what it wants to do.

https://gitlab.kitware.com/cmake/cmake/-/issues/19492
Comment 3 John Hein 2020-08-05 22:02:46 UTC
Created attachment 217040 [details]
[patch] allow cmake to look for a specific python version [v2]

Here's a different change that does not require a CMakeLists.txt patch.

It passes -DPython3_EXECUTABLE=${PYTHON_CMD} to cmake (case is important - note not all upper PYTHON).  For the cmake configuration in llvm11, you also don't need to pass -DPYTHON_INCLUDE_DIR nor -DPYTHON_LIBRARY, so those are removed as well.

It works with the current cmake port as is (no waiting for any upstream cmake change), and I think should work even with any of the contemplated upstream cmake changes regarding the issue described in comment 1.

QA tested in poudriere also.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-08-05 23:48:59 UTC
A commit references this bug:

Author: brooks
Date: Wed Aug  5 23:48:30 UTC 2020
New revision: 544253
URL: https://svnweb.freebsd.org/changeset/ports/544253

Log:
  Fix build with more than one version of Python 3.x installed. [0]

  Fix C++ library selection with certain targets. [1]

  PR:		248386 [1], 248488 [0]
  Submitted by:	Greg V [1], John Hein [0]

Changes:
  head/devel/llvm11/Makefile
  head/devel/llvm11/files/clang/patch-D77776
Comment 5 Brooks Davis freebsd_committer freebsd_triage 2020-08-05 23:49:33 UTC
Thanks!