Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edk2-libc Python UEFI ctypes module build support with GCC tool chain (Bugzilla Bug 4402) #70

Open
tianocore-issues opened this issue Apr 6, 2023 · 5 comments

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 4402

Date: 2023-04-06T01:57:58+00:00
From: Jayaprakash Nevara <<n.jayaprakash>>
To: Jayaprakash Nevara <<n.jayaprakash>>
CC: @lgao4, @kraxel, @lersek, osteffen

Last updated: 2023-10-28T09:57:43+00:00

@tianocore-issues
Copy link
Author

Comment 21331

Date: 2023-04-06 01:57:58 +0000
From: Jayaprakash Nevara <<n.jayaprakash>>

  • Industry Specification: ---
  • Release Observed: EDK II Master
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): Jayaprakash Nevara <<n.jayaprakash>>

The ctypes module builds successfully with MSVC tool chain but it needs some porting effort to compile it with GCC tool chain.

Because of this issue, ctypes module is not included as part of Python UEFI interpreter build with GCC tool chains.

ctypes module's basic functionality is needed for some tools such as Xmlcli used internally within Intel. There may be other use cases as well.

Looking for a Linux expert in tianocore community to help address ctypes modules compilation issues with GCC tool chain.

@tianocore-issues
Copy link
Author

Comment 21415

Date: 2023-04-25 21:49:14 +0000
From: @lgao4

Jayaprakash Nevara will work on it.

@tianocore-issues
Copy link
Author

Comment 22055

Date: 2023-10-26 12:47:20 +0000
From: @lersek

I don't claim to be an "expert" in this area, but still, can you describe what you are trying to do, in much more detail?

My understanding is that "ctypes" is part of the python standard library: <https://docs.python.org/3/library/ctypes.html>.

@tianocore-issues
Copy link
Author

Comment 22084

Date: 2023-10-27 00:28:58 +0000
From: Jayaprakash Nevara <<n.jayaprakash>>

Currently the ctypes module compilation is enabled only with MSFT tool chainsin Python interpreter for UEFI available in the edk2-libc repo.

Ref : https://github.com/tianocore/edk2-libc/blob/master/AppPkg/Applications/Python/Python-3.6.8/Python368.inf

#Modules/ctypes
PyMod-$(PYTHON_VERSION)/Modules/_ctypes/_ctypes.c | MSFT #
Modules/_ctypes/stgdict.c | MSFT #
Modules/_ctypes/libffi_msvc/prep_cif.c | MSFT#
PyMod-$(PYTHON_VERSION)/Modules/_ctypes/malloc_closure.c | MSFT #
PyMod-$(PYTHON_VERSION)/Modules/_ctypes/libffi_msvc/ffi.c | MSFT #
Modules/_ctypes/cfield.c | MSFT #
PyMod-$(PYTHON_VERSION)/Modules/_ctypes/callproc.c | MSFT #
Modules/_ctypes/callbacks.c | MSFT #

[Sources.IA32]
Modules/_ctypes/libffi_msvc/win32.c | MSFT #
PyMod-$(PYTHON_VERSION)/Modules/cpu_ia32.nasm | MSFT #
PyMod-$(PYTHON_VERSION)/Modules/cpu_ia32_gcc.s | GCC #

[Sources.X64]
Modules/_ctypes/libffi_msvc/win64.asm | MSFT #
PyMod-$(PYTHON_VERSION)/Modules/cpu.nasm | MSFT #

We get compilation/linker errors related to some of the function sin libffi. I couldn't do much research on this as I am not a Linux and GCC tool chain expert.
It might be a simple fix for those who have good expertise on this area.

If you could resolve this and get ctypes module compiled with GCC tool chain that would be of great value to the people who primarily work on Linux and use GCC tool chain for tianocore projects.

@tianocore-issues
Copy link
Author

Comment 22095

Date: 2023-10-28 09:57:43 +0000
From: @lersek

I'm not sure what compilation errors you refer to. I tried removing the |MSFT restrictions, and that way I did get compilation errors; however, that is to be expected, given that the source list includes two "libffi_msvc" files, which are not appropriate on a Linux build host.

So this is not a well-contained problem to resolve for Linux build hosts AFAICT -- instead it's the initial python / ctypes / FFI enablement for edk2 on Linux. Sorry, it's quite out of my league, plus I think it will require a good amount of dedicated work from a Linux-based edk2-libc developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant