Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 946221 - dev-libs/glib-2.82.2 fails with ModuleNotFoundError: No module named 'distutils.msvccompiler'
Summary: dev-libs/glib-2.82.2 fails with ModuleNotFoundError: No module named 'distuti...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
: 946502 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-12-10 17:50 UTC by Russell Dwiggins
Modified: 2025-03-15 14:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,8.88 KB, text/plain)
2024-12-10 17:50 UTC, Russell Dwiggins
Details
build log (build.log.gz,93.58 KB, application/gzip)
2024-12-10 17:55 UTC, Russell Dwiggins
Details
build log for glib-2.82.4 (build.log.gz,63.80 KB, application/gzip)
2024-12-15 00:49 UTC, Russell Dwiggins
Details
emerge --info (info.txt,5.79 KB, text/plain)
2024-12-15 00:49 UTC, Russell Dwiggins
Details
glib-hack.patch (glib-hack.patch,511 bytes, patch)
2024-12-15 02:48 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Dwiggins 2024-12-10 17:50:06 UTC
Per title.

Attached emerge --info and build log.
Comment 1 Russell Dwiggins 2024-12-10 17:50:51 UTC
Created attachment 913738 [details]
emerge --info
Comment 2 Russell Dwiggins 2024-12-10 17:55:14 UTC
Created attachment 913739 [details]
build log
Comment 3 Midgard 2024-12-12 13:32:14 UTC
Summary to fix: comment out the import, adjust references further down the file, and `emerge -1 dev-libs/gobject-introspection`.

I had the same error (with glib and with other packages). With `equery b` you can see that the offending file /usr/lib64/gobject-introspection/giscanner/ccompiler.py is owned by dev-libs/gobject-introspection. I tried updating that package first with `emerge -1 dev-libs/gobject-introspection`, but it starts building glib first. Because MVSCCompiler (Microsoft Visual C/C++ Compiler) isn't relevant for Gentoo, I decided that commenting out the offending import and adjusting the references further down the file wouldn't hurt. glib and gobject-introspection have built succesfully, overwriting /usr/lib64/gobject-introspection/giscanner/ccompiler.py so my hotfix has been erased and in the new version MVSCCompiler has been removed from the file altogether.
Comment 4 Midgard 2024-12-12 13:33:51 UTC
(For completeness, I updated to =dev-libs/gobject-introspection-1.82.0-r1)
Comment 5 Russell Dwiggins 2024-12-13 21:27:24 UTC
(In reply to Midgard from comment #3)
> Summary to fix: comment out the import, adjust references further down the
> file, and `emerge -1 dev-libs/gobject-introspection`.
> 
> I had the same error (with glib and with other packages). With `equery b`
> you can see that the offending file
> /usr/lib64/gobject-introspection/giscanner/ccompiler.py is owned by
> dev-libs/gobject-introspection. I tried updating that package first with
> `emerge -1 dev-libs/gobject-introspection`, but it starts building glib
> first. Because MVSCCompiler (Microsoft Visual C/C++ Compiler) isn't relevant
> for Gentoo, I decided that commenting out the offending import and adjusting
> the references further down the file wouldn't hurt. glib and
> gobject-introspection have built succesfully, overwriting
> /usr/lib64/gobject-introspection/giscanner/ccompiler.py so my hotfix has
> been erased and in the new version MVSCCompiler has been removed from the
> file altogether.

Just attempted your workaround, but I got the same failure. Perhaps I missed a couple lines.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-14 14:26:00 UTC
I don't yet get what's happening here. https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/a2139dba59eac283a7f543ed737f038deebddc19 is in 1.82.0.

When hitting this, what version of gobject-introspection is installed?

i.e. Please show emerge -pvO dev-libs/glib dev-libs/gobject-introspection.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-14 15:53:08 UTC
OK, I get it.
Comment 8 Larry the Git Cow gentoo-dev 2024-12-14 15:58:10 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfe67c6d2d4e15989aa16764a92c36e284457712

commit cfe67c6d2d4e15989aa16764a92c36e284457712
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-12-14 15:55:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-12-14 15:57:40 +0000

    dev-libs/glib: fix finding just-built g-ir-scanner
    
    Without PKG_CONFIG_PATH having the just-built paths prepended, meson
    will find binaries from gobject-introspection on the system instead
    which may be:
    a) old (which is a problem anyway, unclear if that's guaranteed to work,
       and weird given we just built one), or
    b) too old (where gobject-introspection on the system is older than the
       fixed versions for bug #865183)
    
    Fix that by prepending the right paths.
    
    Bug: https://bugs.gentoo.org/865183
    Closes: https://bugs.gentoo.org/946221
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/glib/glib-2.80.5.ebuild | 5 ++++-
 dev-libs/glib/glib-2.82.2.ebuild | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
Comment 9 Russell Dwiggins 2024-12-15 00:29:46 UTC
Just ran into the same error with dev-libs/glib-2.82.4.

Is there something that needs to be done prior to emerging this package?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 00:44:42 UTC
(In reply to Russell Dwiggins from comment #9)
> Just ran into the same error with dev-libs/glib-2.82.4.
> 
> Is there something that needs to be done prior to emerging this package?

No, it should work as-is. Please show me build.log + emerge --info.
Comment 11 Russell Dwiggins 2024-12-15 00:49:22 UTC
Created attachment 914066 [details]
build log for glib-2.82.4
Comment 12 Russell Dwiggins 2024-12-15 00:49:43 UTC
Created attachment 914067 [details]
emerge --info
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 01:07:11 UTC
Thanks.

```
Traceback (most recent call last):
  File "/var/tmp/portage/dev-libs/glib-2.82.4/temp/usr/lib64/pkgconfig/../../bin/g-ir-scanner", line 103, in <module>
    from giscanner.scannermain import scanner_main
  File "/usr/lib64/gobject-introspection/giscanner/scannermain.py", line 35, in <module>
    from giscanner.ast import Include, Namespace
  File "/usr/lib64/gobject-introspection/giscanner/ast.py", line 29, in <module>
    from .sourcescanner import CTYPE_TYPEDEF, CSYMBOL_TYPE_TYPEDEF
  File "/usr/lib64/gobject-introspection/giscanner/sourcescanner.py", line 25, in <module>
    from .ccompiler import CCompiler
  File "/usr/lib64/gobject-introspection/giscanner/ccompiler.py", line 29, in <module>
    from distutils.msvccompiler import MSVCCompiler
```

Note the first line is right, but then it loads the Python modules from the system. I'll look more.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 01:53:19 UTC
Hmmmmmm, in g-ir-scanner:
```
# Detect and set datadir, pylibdir, etc as applicable
# Similar to the method used in gdbus-codegen
filedir = os.path.dirname(__file__)

# Try using relative paths first so that the installation prefix is relocatable
datadir = os.path.abspath(os.path.join(filedir, '..', 'share'))
# Fallback to hard-coded paths if the relocatable paths are wrong
if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
    datadir = "/usr/share"

builtins.__dict__['DATADIR'] = datadir

gir_dir = os.path.abspath(os.path.join(filedir, '..', 'share', 'gir-1.0'))
# Fallback to hard-coded paths if the relocatable paths are wrong
if not os.path.isdir(gir_dir):
    gir_dir = "/usr/share/gir-1.0"

builtins.__dict__['GIR_DIR'] = gir_dir

# Again, relative paths first so that the installation prefix is relocatable
pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
```
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 02:12:31 UTC
I wonder if this will ever work for Gentoo in the relocatable case:
```
# Again, relative paths first so that the installation prefix is relocatable
pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
```

It's at lib64 for you. Are you able to try a patch if I give you one shortly?
Comment 16 Russell Dwiggins 2024-12-15 02:32:18 UTC
(In reply to Sam James from comment #15)
> I wonder if this will ever work for Gentoo in the relocatable case:
> ```
> # Again, relative paths first so that the installation prefix is relocatable
> pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib',
> 'gobject-introspection'))
> ```
> 
> It's at lib64 for you. Are you able to try a patch if I give you one shortly?

Yes. This evening or tomorrow.
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 02:48:11 UTC
Created attachment 914072 [details, diff]
glib-hack.patch

Can you apply this patch to the ebuild itself (i.e. modify the ebuild in /var/db/repos/gentoo)? (Not in /etc/portage/patches)
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 02:48:31 UTC
(In reply to Sam James from comment #17)
> Created attachment 914072 [details, diff] [details, diff]
> glib-hack.patch
> 
> Can you apply this patch to the ebuild itself (i.e. modify the ebuild in
> /var/db/repos/gentoo)? (Not in /etc/portage/patches)

err, /usr/portage in your case.
Comment 19 Russell Dwiggins 2024-12-15 02:50:48 UTC
(In reply to Sam James from comment #18)
> (In reply to Sam James from comment #17)
> > Created attachment 914072 [details, diff] [details, diff] [details, diff]
> > glib-hack.patch
> > 
> > Can you apply this patch to the ebuild itself (i.e. modify the ebuild in
> > /var/db/repos/gentoo)? (Not in /etc/portage/patches)
> 
> err, /usr/portage in your case.

Thanks for the poke. I'll migrate this machine too. 

Will do ASAP.
Comment 20 Russell Dwiggins 2024-12-15 08:55:19 UTC
(In reply to Sam James from comment #17)
> Created attachment 914072 [details, diff] [details, diff]
> glib-hack.patch
> 
> Can you apply this patch to the ebuild itself (i.e. modify the ebuild in
> /var/db/repos/gentoo)? (Not in /etc/portage/patches)

Success!
Comment 21 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 09:39:57 UTC
Thank you!! I'll tidy this up into something proper and commit it later today.
Comment 22 Larry the Git Cow gentoo-dev 2024-12-15 10:50:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c858ac4e4f97acc5a373e6de9191fe5e1b10e08c

commit c858ac4e4f97acc5a373e6de9191fe5e1b10e08c
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-12-15 10:48:34 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-12-15 10:49:49 +0000

    dev-libs/glib: further fixes for using just-built gobject-introspection
    
    g-ir-scanner has some relocatable logic but it searches for 'lib', not 'lib64',
    so it can't find itself and eventually falls back to the system installation.
    
    Followup to cfe67c6d2d4e15989aa16764a92c36e284457712.
    
    Closes: https://bugs.gentoo.org/946221
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/glib/glib-2.80.5.ebuild | 5 +++++
 dev-libs/glib/glib-2.82.2.ebuild | 5 +++++
 dev-libs/glib/glib-2.82.4.ebuild | 5 +++++
 3 files changed, 15 insertions(+)
Comment 23 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-15 11:32:58 UTC
*** Bug 946502 has been marked as a duplicate of this bug. ***