Bug 263341 - math/Imath builds but does not install
Summary: math/Imath builds but does not install
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: Matthias Andree
URL:
Keywords:
Depends on: 262109
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-16 14:03 UTC by D'Arcy J.M. Cain
Modified: 2023-12-27 19:43 UTC (History)
2 users (show)

See Also:
mandree: maintainer-feedback+
mandree: merge-quarterly+


Attachments
The make.conf from the problem system. (2.96 KB, text/plain)
2022-04-17 04:41 UTC, D'Arcy J.M. Cain
no flags Details
As requested. (25.63 KB, text/plain)
2022-04-17 04:47 UTC, D'Arcy J.M. Cain
no flags Details
Also as requested (14.44 KB, text/plain)
2022-04-17 04:48 UTC, D'Arcy J.M. Cain
no flags Details
Log from test run. (4.65 KB, application/x-xz)
2022-04-17 11:07 UTC, D'Arcy J.M. Cain
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description D'Arcy J.M. Cain 2022-04-16 14:03:56 UTC
The package builds but fails to install due to missing files.  I had to make the following change to install it.  Note that many packages depend on this one.

index 04ff9e1bd567..09855703871f 100644
--- a/math/Imath/pkg-plist
+++ b/math/Imath/pkg-plist
@@ -87,6 +87,4 @@ libdata/pkgconfig/Imath.pc
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so.%%VER%%
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so.%%VER%%.%%MINVER%%.%%PLVER%%
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/imath.so
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/imathnumpy.so
 %%PYTHON%%libdata/pkgconfig/PyImath.pc
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2022-04-16 14:45:27 UTC
D'Arcy,

thanks for the report. However, I cannot reproduce it. I need more details on your build, environment, settings, /etc/make.conf, options, logs, how exactly are you building, ...   are you sure there are no previous errors reported that get missed in a restarted build, or when a "make install" is run in spite of a failing "make"?

Also be sure that your Python installation and the configured default Python is consistent. You cannot build Imath on a system that does not have pyXXX-numpy for your default Python.

Try to update the entire ports tree, rebuild and reinstall all ports that Imath depends on, and then

unset NOCLEANDEPENDS 2>/dev/null || :
sed -i '' -e '/NOCLEANDEPENDS/d'  /etc/make.conf
make clean
make DEVELOPER=yes test 
make DEVELOPER=yes check-plist
make DEVELOPER=yes package

If that reproduces the crash, please provide all information and reopen the bug.
Comment 2 Matthias Andree freebsd_committer freebsd_triage 2022-04-16 16:41:32 UTC
Alternatively, you can deselect the PYTHON option, then clean and build.
Comment 3 D'Arcy J.M. Cain 2022-04-16 17:36:58 UTC
NOCLEANDEPENDS is not in my environment or in my make.conf.
Checked and py39-numpy is installed.
make DEVELOPER=yes test passed with zero errors.
make DEVELOPER=yes check-plist failed:

====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: local/%%PYTHON_SITELIBDIR%%/imath.so
Error: Orphaned: local/%%PYTHON_SITELIBDIR%%/imathnumpy.so
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%PYTHON_SITELIBDIR%%/imath.so
Error: Missing: %%PYTHON_SITELIBDIR%%/imathnumpy.so
===> Error: Plist issues found.
*** Error code 1
Comment 4 Matthias Andree freebsd_committer freebsd_triage 2022-04-16 20:24:11 UTC
Now we're getting closer. The port uses whatever would be the port system's default Python, which currently is 3.8, but your system uses 3.9. No FLAVORS currently.

Are you setting Python 3.9 as your system's default (through make.conf or otherwise through DEFAULT_VERSIONS)?
Comment 5 Matthias Andree freebsd_committer freebsd_triage 2022-04-16 21:44:48 UTC
D'Arcy, please help me help you. 

I have changed my Python default to 3.9 in make.conf (DEFAULT_VERSIONS+=python3=3.9 python=3.9)

then rebuilt/reinstalled python and python3

then successfully built math/Imath with PYTHON option enabled.

Can you please show me your /etc/make.conf and any environment options you set to influence the build?

Can you also check your Imath configure and build stages for warnings? If you cannot make heads or tails of them, "make clean" and "make |& tee build.log", then xz build.log and attach the build.log.xz.

I suspect something is hosed about parallel Python versions, or the default configuration is not set properly, and if cmake messes up the Python detection on your system, it does not on mine, so I cannot find the bug or a workaround.

TIA.
Comment 6 Matthias Andree freebsd_committer freebsd_triage 2022-04-16 21:48:27 UTC
I should have mentioned that I would also like to see these files after your failed "make":

work/.build/CMakeFiles/CMakeOutput.log

work/.build/CMakeFiles/CMakeError.log (or is it CMakeErrors.log?) - this may be missing

work/.build/CMakeCache.txt

It may take a few days before I can debug more.
Comment 7 D'Arcy J.M. Cain 2022-04-17 04:41:17 UTC
Created attachment 233265 [details]
The make.conf from the problem system.
Comment 8 D'Arcy J.M. Cain 2022-04-17 04:47:49 UTC
Created attachment 233267 [details]
As requested.
Comment 9 D'Arcy J.M. Cain 2022-04-17 04:48:31 UTC
Created attachment 233268 [details]
Also as requested

Could not find any Errors log.
Comment 10 Matthias Andree freebsd_committer freebsd_triage 2022-04-17 07:19:32 UTC
I have run out of ideas for now, I see no differences in the files you posted and mine if I use your make.conf with minimal adaptations to my file paths and with permitting a MAKE_JOBS_NUMBER.

can you please do:

cd /usr/ports/math/Imath
make clean
make pretty-print-config # <- keep the output
make DEVELOPER=yes check-plist package &| tee make.log

then please attache the make.log (feel free to xz or gzip it) and paste the output from make pretty-print-config here (it's fine if you put it in the attachment's comment).
Comment 11 Matthias Andree freebsd_committer freebsd_triage 2022-04-17 07:20:56 UTC
Apologies for a typo, make that one line (pipe THEN ampersand):

make clean
make DEVELOPER=yes check-plist package |& tee make.log
Comment 12 D'Arcy J.M. Cain 2022-04-17 11:07:11 UTC
Created attachment 233271 [details]
Log from test run.
Comment 13 Matthias Andree freebsd_committer freebsd_triage 2022-04-17 21:21:09 UTC
Thanks for the make.log. There is something fishy about the Python sitelib path in your output. The "Will install to:" is a relative path starting with local/lib/... (for me it is lib/...) and then you get the double /usr/local/local/... on installation of the two Python .so modules -- for some reason I cannot currently explain. I would suggest you go find out where that comes from. Is /usr/local or /usr/local/local a symlink or null mount on your computer?

Here are relevant snippets from the log:

-- Found Python: /usr/local/bin/python3.9 (found suitable exact version "3.9.12") found components: Interpreter Development Development.Module Development.Embed 
-- Found Python3: /usr/bin/python3 (found suitable exact version "3.9.12") found components: Interpreter Development Development.Module Development.Embed 
-- Found Python 3.9.12
-- Found Python3 libraries: 39
-- Will install to: local/lib/python3.9/site-packages
...
-- Installing: /usr/obj/usr/ports/math/Imath/work/stage/usr/local/lib/libPyImath_Python3_9-3_1.so.29
-- Set runtime path of "/usr/obj/usr/ports/math/Imath/work/stage/usr/local/lib/libPyImath_Python3_9-3_1.so.29.4.0" to "/usr/local/lib"
-- Installing: /usr/obj/usr/ports/math/Imath/work/stage/usr/local/lib/libPyImath_Python3_9-3_1.so
-- Installing: /usr/obj/usr/ports/math/Imath/work/stage/usr/local/local/lib/python3.9/site-packages/imath.so
-- Set runtime path of "/usr/obj/usr/ports/math/Imath/work/stage/usr/local/local/lib/python3.9/site-packages/imath.so" to "/usr/local/lib"
-- Installing: /usr/obj/usr/ports/math/Imath/work/stage/usr/local/local/lib/python3.9/site-packages/imathnumpy.so
-- Set runtime path of "/usr/obj/usr/ports/math/Imath/work/stage/usr/local/local/lib/python3.9/site-packages/imathnumpy.so" to "/usr/local/lib"
/usr/bin/strip /usr/obj/usr/ports/math/Imath/work/stage/usr/local/lib/libImath-3_1.so
Comment 14 D'Arcy J.M. Cain 2022-04-25 14:26:06 UTC
I just noticed something odd.  Most Python scripts are in pkg-plist as "%%PYTHON_SITELIBDIR%%/xxx.py" but this package has these two as "%%PYTHON%%%%PYTHON_SITELIBDIR%%/xxx.py".  Tried this change but it still fails.

diff --git a/math/Imath/pkg-plist b/math/Imath/pkg-plist
index 04ff9e1bd567..baf6b6847da8 100644
--- a/math/Imath/pkg-plist
+++ b/math/Imath/pkg-plist
@@ -87,6 +87,6 @@ libdata/pkgconfig/Imath.pc
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so.%%VER%%
 %%PYTHON%%lib/libPyImath_Python%%PYVER%%-%%MAJORVER%%.so.%%VER%%.%%MINVER%%.%%PLVER%%
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/imath.so
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/imathnumpy.so
+%%PYTHON_SITELIBDIR%%/imath.so
+%%PYTHON_SITELIBDIR%%/imathnumpy.so
 %%PYTHON%%libdata/pkgconfig/PyImath.pc

But still, are these lines as weird as they look to me?
Comment 15 Matthias Andree freebsd_committer freebsd_triage 2022-04-25 16:17:52 UTC
Hi D'Arcy,

what you have observed is in working shape for me, and the explanation is:
- the %%PYTHON%% goes back to the OPTIONS_DEFINE=PYTHON/OPTIONS_SUB=yes stuff,  and expands in the pkg-plist to either empty (if the PYTHON option is enabled) or @comment (if the PYTHON option is disabled), 
- and only the %%PYTHON_SITELIBDIR%% is what goes between the prefix and the remainder of the pkg-plist line.
Comment 16 Matthias Andree freebsd_committer freebsd_triage 2022-04-25 16:43:00 UTC
Anything about my /usr/local/local... finding in your logs?
Comment 17 Seneca Cunningham 2022-07-12 01:51:39 UTC
(In reply to Matthias Andree from comment #16)

I'm not D'Arcy, but I have access to that one particular computer with the failing builds.  There's some weirdness in there, specifically the presence of Python symlinks.  That computer normally has /usr/bin/python and /usr/bin/python3 as symlinks to /usr/local/bin/python3.9.  Remove the symlinks and Imath builds whilst the python scripts that have their roots in antiquity fail.  It looks like I should be able to explicitly provide the full path to the real python interpreter, but I'm not all that familiar with the details of how best to prod cmake into doing what I want.

I had found quite a few extra "local"s in the generated cmake_install.cmake files for the Python modules (e.g. PyImath_Python3_SITEARCH_REL was stated to be 'local/lib/python3.9/site-packages' in CMakeCache.txt).  These path names came to be because the "python" found was one of the /usr/bin symlinks and that base directory of "/usr/bin" when combined with the returned site-packages of "/usr/local/lib/python3.9/site-packages" resulted in cmake computing an incorrect site-packages path.
Comment 18 Matthias Andree freebsd_committer freebsd_triage 2022-07-12 16:38:37 UTC
reopening fur further investigation based on new information
Comment 19 Matthias Andree freebsd_committer freebsd_triage 2022-07-12 19:19:12 UTC
Seneca,

thanks for the concrete hint to reproducing the issue, namely:

ln -sfn /usr/local/bin/python3 /usr/bin/python3
ln -sfn /usr/local/bin/python3 /usr/bin/python

allowed me to reproduce the issue.

I will now fix this by setting Python_EXECUTABLE to ${PYTHON_CMD}, which fixes the issue for me.
Comment 20 commit-hook freebsd_committer freebsd_triage 2022-07-12 19:20:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d443494a71b73dc543cc0eddec69a01d6280ce02

commit d443494a71b73dc543cc0eddec69a01d6280ce02
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-07-12 19:06:08 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-07-12 19:20:13 +0000

    math/Imath: ensure PYTHON build with /usr/bin/python[3] links

    When /usr/bin/python[3] symlinks are present (which is nonstandard), the
    FindPython logic inside cmake will grab it over $PREFIX/bin/python[3],
    but still identify (by default) /usr/local/lib/... as the sitelib path,
    but goof up when calculating the relative path in case of /usr/bin vs
    /usr/local/bin mismatch.

    Fix: Provide ${PYTHON_CMD} through the cmake Python_EXECUTABLE
    variable to avoid any ambiguities and pin the right executable.

    I believe it should be safe to NOT bump PORTREVISION,
    but I will fetch far and err on the safe side and bump it, because that
    is easier than researching all possible paths how and where
    Python paths might find their way into the resulting package.

    The detailed report by Seneca helped identify and solve this issue, so:
    Thanks to:      Seneca Cunningham <seneca@vybenetworks.com>

    PR:             263341
    Reported by:    D'Arcy J.M. Cain <darcy@druid.net>
    Reported by:    Seneca Cunningham <seneca@vybenetworks.com>
    MFH:            2022Q3

 math/Imath/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 21 commit-hook freebsd_committer freebsd_triage 2022-07-12 19:27:55 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=50aed9b03a2ccb85c7a5f45866d914e97f2ef42d

commit 50aed9b03a2ccb85c7a5f45866d914e97f2ef42d
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-07-12 19:06:08 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-07-12 19:20:52 +0000

    math/Imath: ensure PYTHON build with /usr/bin/python[3] links

    When /usr/bin/python[3] symlinks are present (which is nonstandard), the
    FindPython logic inside cmake will grab it over $PREFIX/bin/python[3],
    but still identify (by default) /usr/local/lib/... as the sitelib path,
    but goof up when calculating the relative path in case of /usr/bin vs
    /usr/local/bin mismatch.

    Fix: Provide ${PYTHON_CMD} through the cmake Python_EXECUTABLE
    variable to avoid any ambiguities and pin the right executable.

    I believe it should be safe to NOT bump PORTREVISION,
    but I will fetch far and err on the safe side and bump it, because that
    is easier than researching all possible paths how and where
    Python paths might find their way into the resulting package.

    The detailed report by Seneca helped identify and solve this issue, so:
    Thanks to:      Seneca Cunningham <seneca@vybenetworks.com>

    PR:             263341
    Reported by:    D'Arcy J.M. Cain <darcy@druid.net>
    Reported by:    Seneca Cunningham <seneca@vybenetworks.com>
    MFH:            2022Q3

    (cherry picked from commit d443494a71b73dc543cc0eddec69a01d6280ce02)

 math/Imath/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 22 Matthias Andree freebsd_committer freebsd_triage 2022-07-12 19:29:49 UTC
Fixed as of 3.1.5_1.
Comment 23 Joel Rodriguez 2023-12-27 19:43:27 UTC
Yeah, I had the same problem after I rebuilt python without debug support so that a couple of other ports would build.

I rebuilt py-numpy and the Imath installed.

fyi