edk2-libc Building Python environment for UEFI


M.T.
 

Hello
First time poster so please accept apologies if this is the wrong group.
I am trying to build the Python environment for UEFI as described in
Py368ReadMe.txt in edk2-libc. I'm doing this on Ubuntu 20.04.4 LTS. I am
able to build everything else just fine, so my setup seems fine, but as
soon as I enable Python368.inf in AppPkg.dsc, and also add socket module, I
am getting missing header errors. This is what I get after I run: build
-a X64 -p AppPkg/AppPkg.dsc

...
Building ...
/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Sockets/WebServer/WebServer.inf
[X64]
"gcc" -MMD -MF
/home/user/Desktop/dev/uefi/Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Python/Python-3.6.8/Python368/OUTPUT/Modules/_bisectmodule.obj.deps
-g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror
-Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections
-fdata-sections -DSTRING_ARRAY_NAME=Python368Strings -m64
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))"
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie
-fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os
-nostdinc -nostdlib -DUEFI_C_SOURCE -c -o
/home/user/Desktop/dev/uefi/Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Python/Python-3.6.8/Python368/OUTPUT/Modules/_bisectmodule.obj
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/_ctypes/libffi_msvc
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_ctypes/libffi_msvc
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_ctypes
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/_ctypes
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/zlib
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/expat
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/cjkcodecs
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_io
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_sha3
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_blake2
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Programs
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Objects
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Objects
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Python
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Python
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Parser
-I/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8
-I/home/user/Desktop/dev/uefi/Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Python/Python-3.6.8/Python368/DEBUG
-I/home/user/Desktop/dev/uefi/edk2-libc/StdLib
-I/home/user/Desktop/dev/uefi/edk2-libc/StdLib/Include
-I/home/user/Desktop/dev/uefi/edk2-libc/StdLib/Include/X64
-I/home/user/Desktop/dev/uefi/edk2/MdePkg
-I/home/user/Desktop/dev/uefi/edk2/MdePkg/Include
-I/home/user/Desktop/dev/uefi/edk2/MdePkg/Test/UnitTest/Include
-I/home/user/Desktop/dev/uefi/edk2/MdePkg/Include/X64
-I/home/user/Desktop/dev/uefi/edk2/MdeModulePkg
-I/home/user/Desktop/dev/uefi/edk2/MdeModulePkg/Include
/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_bisectmodule.c
Building ...
/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Sockets/SetHostName/SetHostName.inf
[X64]
make: Nothing to be done for 'tbuild'.
/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Modules/_bisectmodule.c:7:10:
fatal error: Python.h: No such file or directory
7 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
Building ...
/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Sockets/GetNetByName/GetNetByName.inf
[X64]
make: Nothing to be done for 'tbuild'.
make: *** [GNUmakefile:771:
/home/user/Desktop/dev/uefi/Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Python/Python-3.6.8/Python368/OUTPUT/Modules/_bisectmodule.obj]
Error 1


build.py...
: error 7000: Failed to execute command
make tbuild
[/home/user/Desktop/dev/uefi/Build/AppPkg/DEBUG_GCC5/X64/AppPkg/Applications/Python/Python-3.6.8/Python368]


build.py...
: error F002: Failed to build module

/home/user/Desktop/dev/uefi/edk2-libc/AppPkg/Applications/Python/Python-3.6.8/Python368.inf
[X64, GCC5, DEBUG]

The error is obvious enough, the build system is unable to find Python.h.It
also seems like Python.h should be coming from the included Python
distribution under AppPkg/Applications/Python/Python-3.6.8/However, I do
not see the Include in the build command for it. I am not all that
familiar with the build system yet, but how would I add the Include into
the build system? Unless I am totally wrong about the issue here.

Appreciate any feedback.
Thank you
xp

Join discuss@edk2.groups.io to automatically receive all group messages.