-   Linux From Scratch (
-   -   LFS 9.1 i386 no-systemd 6.9 Glibc-2.31 'No module named msvcrt' (

rsmereka 05-24-2020 12:53 PM

LFS 9.1 i386 no-systemd 6.9 Glibc-2.31 'No module named msvcrt'
Hi All,

I am building LFS 9.1 i386 on a Lenovo x61s using MX Linux 18 i386 as the host. Chapter 5 built fine, no errors. I am near the beginning of chapter 6, building Glibc from section 6.9. I mounted the virtual file systems correctly from section 6.2.2. and chrooted correctly from 6.4.

I am getting what looks like a Python module ('') reporting 'msvcrt' module as not found. It appears as though the system type is being mis-identified. I have applied the Glibc patch and applied the case switch for LSB compliance, created the 'build' sub-directory and 'cd'ed into the build directory. In addition, I ran the 'configure' command without any errors.

The compile log output is:

make -r PARALLELMFLAGS="" -C .. objdir=`pwd` all
make[1]: Entering directory '/sources/glibc-2.31'

type "make help" for help with common glibc makefile targets

make  subdir=csu -C csu ..=../ subdir_lib
make[2]: Entering directory '/sources/glibc-2.31/csu'
python3 -B ../scripts/ --cc="gcc -ffile-prefix-map=/tools=/usr -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -fmerge-all-constants -frounding-math -fstack-protector-strong -Wstrict-prototypes -Wold-style-definition -fmath-errno    -ftls-model=initial-exec      -I../include -I/sources/glibc-2.31/build/csu  -I/sources/glibc-2.31/build  -I../sysdeps/unix/sysv/linux/i386/i686  -I../sysdeps/i386/i686/nptl  -I../sysdeps/unix/sysv/linux/i386  -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/i386/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/i386  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/i386/i686/fpu/multiarch  -I../sysdeps/i386/i686/fpu  -I../sysdeps/i386/i686/multiarch  -I../sysdeps/i386/i686  -I../sysdeps/i386/fpu  -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu  -I../sysdeps/i386  -I../sysdeps/x86  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /tools/lib/gcc/i686-pc-linux-gnu/9.2.0/include -isystem /tools/lib/gcc/i686-pc-linux-gnu/9.2.0/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /sources/glibc-2.31/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h      -DTOP_NAMESPACE=glibc -DGEN_AS_CONST_HEADERS \
                  -MD -MP -MF /sources/glibc-2.31/build/tcb-offsets.h.dT \
                  -MT '/sources/glibc-2.31/build/tcb-offsets.h.d /sources/glibc-2.31/build/tcb-offsets.h'" \
          ../sysdeps/i386/nptl/tcb-offsets.sym > /sources/glibc-2.31/build/tcb-offsets.hT
Traceback (most recent call last):
  File "/tools/lib/python3.8/", line 64, in <module>
    import msvcrt
ModuleNotFoundError: No module named 'msvcrt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../scripts/", line 28, in <module>
    import glibcextract
  File "/sources/glibc-2.31/scripts/", line 22, in <module>
    import subprocess
  File "/tools/lib/python3.8/", line 69, in <module>
    import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
make[2]: *** [../Makerules:271: /sources/glibc-2.31/build/tcb-offsets.h] Error 1
make[2]: Leaving directory '/sources/glibc-2.31/csu'
make[1]: *** [Makefile:470: csu/subdir_lib] Error 2
make[1]: Leaving directory '/sources/glibc-2.31'
make: *** [Makefile:9: all] Error 2

I would greatly appreciate any insights/suggestions as to how to correct this (if it is correctable).

hendrickxm 05-25-2020 01:28 AM

I suggest to rebuild python3 first as per chapter 5 first and try glibc as in chapter 6 again. You don't have to exit the chroot.

rsmereka 05-25-2020 10:38 AM


Originally Posted by hendrickxm (Post 6126982)
I suggest to rebuild python3 first as per chapter 5 first and try glibc as in chapter 6 again. You don't have to exit the chroot.

Thanks for that,

Worked well for me.


richt 06-07-2020 02:07 PM

I had a similar problem with Section 6.9 related to Python 3 as I received the following error when executing the configure command:


checking for python3... no
checking for python... no
configure: error:
*** These critical programs are missing or too old: python
*** Check the INSTALL file for required versions.

I thought the proposed solution of rebuilding python 3 as in Chapter 5 could also solve my problem. I changed to the sources directory, executed "tar -xvf Python-3.8.1.tar.xz", changed to the new Python-3.8.1 directory, and executed the sed and configure commands in Section 5.30. All seemed to go well with the configure command and the Makefile was created. However, when I executed the make command, I received a lot of the following kind of output:


(lfs chroot) root:/sources/Python-3.8.1# make
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c

... and ending with:

IndentationError: expected an indented block
make: *** [Makefile:614: sharedmods] Error 1

I expect rebuilding python may well solve my problem as it did the OP, but I'm clearly not rebuilding it correctly.

Any suggestions?

spiky0011 06-07-2020 03:45 PM

Hi richt

Are you by any chacce using a pdf copy of the book? if so use an html version, pdf has issue with copy and paste

richt 06-07-2020 07:30 PM

Hello Spiky0011,
I am using the pdf book, but yes learned that lesson early on the hard way. Now I'm always careful to copy and paste multiple line commands to a text editor first to clean it up. Then I scroll back up in the terminal just to confirm.

spiky0011 06-08-2020 11:08 AM

Just try copy and paste from html because that error looks like spacing in command error

richt 06-09-2020 07:03 PM

Well spiky0011, yet another humbling learning experience! I can't identify the difference between the commands I carefully cut and checked from the pdf and then again from the html page today, but it seems to have worked.

When I was reinstalling Python-3.8.1 following Section 5.30, after executing "make" I still received a number of lines of the following which suggested to me that I failed as before:


gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.

However, I received the notification that "Python build finished successfully!" rather than the "Indentation Error" I'd received before. And this time I was able to execute make and make install.

Hoping I had successfully reinstalled python following 5.30, I went back to Section 6.9 to again try installing Glibc-2.31 (which had been my original problem as with this OP) and sure enough was able to complete it this time!

Thanks again!

All times are GMT -5. The time now is 03:23 PM.