From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A3F2B2195407C for ; Mon, 24 Apr 2017 07:21:57 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2017 07:21:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,244,1488873600"; d="scan'208";a="849218900" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2017 07:21:57 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 24 Apr 2017 07:21:57 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.246]) by fmsmsx116.amr.corp.intel.com ([169.254.2.225]) with mapi id 14.03.0319.002; Mon, 24 Apr 2017 07:21:56 -0700 From: "Carsey, Jaben" To: KT , "edk2-devel@lists.01.org" CC: "edk2-lists@mc2research.org" Thread-Topic: [edk2] Python issue in UEFI shell Thread-Index: AQHSvPbT9PqIsOQUp0+5qnENqeYN4aHUki8g Date: Mon, 24 Apr 2017 14:21:55 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzJlM2JmNmQtOWJiNS00MjZhLThlMTYtMDg1Mjk1MjE3ZmI3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjNGMVJNa3l1Y2ptQ242TTFRYnpBd0QzKzl5ZjVqSzZsWFJyV25SV3lGUjA9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: Python issue in UEFI shell X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 14:21:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I am not sure here, but I think that you may have issues running multiple t= hreads in the UEFI environment. Have you tried not using multiple threadS? > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of KT > Sent: Monday, April 24, 2017 5:32 AM > To: edk2-devel@lists.01.org > Cc: edk2-lists@mc2research.org > Subject: Re: [edk2] Python issue in UEFI shell > Importance: High >=20 > Hello, > Can someone please shed some light on this issue? >=20 > Thanks >=20 > Thanks > On Tue, Apr 18, 2017 at 2:56 PM, KT wrote: >=20 > > Hi experts, > > > > I am experimenting python scripts in UEFI shell and as part of the firs= t > > step I tried compiling python as per the instructions in > > edk2\AppPkg\Applications\Python\PythonReadMe.txt. However when I > run my > > script, I noticed that it required third-party modules (requests, urlli= b3 > > etc). So I manually copied these under the \EFI\StdLib\lib\python.27\si= te- > packages > > folder (not sure if that is the correct way). That said currently my sc= ript > > is failing as follows: > > > > Traceback (most recent call last): > > File "rest_json.py", line 11, in > > import requests > > File "\Efi\StdLib\lib\python.27\site-packages/requests/__init__.p= y", > > line 60, in > > from .packages.urllib3.exceptions import DependencyWarning > > File "\Efi\StdLib\lib\python.27\site- > packages/requests/packages/__init__.py", > > line 29, in > > import urllib3 > > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/__init__.py= ", > > line 8, in > > from .connectionpool import ( > > File "\Efi\StdLib\lib\python.27\site- > packages/urllib3/connectionpool.py", > > line 28, in > > from .packages.six.moves import queue > > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/si= x.py", > > line 203, in load_module > > mod =3D mod._resolve() > > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/si= x.py", > > line 115, in _resolve > > return _import_module(self.mod) > > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/si= x.py", > > line 82, in _import_module > > __import__(name) > > File "\Efi\StdLib\lib\python.27/Queue.py", line 7, in > > import dummy_threading as _threading > > File "\Efi\StdLib\lib\python.27/dummy_threading.py", line 45, in > > > > import threading > > ImportError: No module named threading > > > > > > > > I understand that the script is now looking for the threading module an= d > > after investigating further I realized I may have to turn on the thread= ing > > module as part of compiling python. So I modified the > > \edk2\AppPkg\Applications\Python\X64\pyconfig.h file to change '#undef > > WITH_THREAD' to '#define WITH_THREAD', but this is giving the following > > compiling error. Any pointers please? > > > > "C:\Program Files (x86)\Microsoft Visual Studio > > 11.0\Vc\bin\x86_amd64\cl.exe" > /Foc:\users\user\documents\dev\uefi\edk2\edk > > 2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\Pytho > > n\PythonCore\OUTPUT\.\AutoGen.obj /nologo /c /WX /GS- /W4 /Gs32768 > /D > > UNICODE /O1ib2s /GL / > > Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Oi- /wd4018 /wd4054 /wd4055 > > /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 > /wd4310 > > /wd4389 / > > wd4701 /wd4702 /wd4706 /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\AppPkg\Applications\Python\X64 > /Ic:\users\user\documents\de > > v\uefi\edk2\edk2\AppPkg\Applications\Python\Efi > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications > > \Python\Python-2.7.2\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI > > /DXML_STATIC /X /Zc:wchar_t /D UEFI_C_SOURCE > /Ic:\users\user\documents\dev\ > > uefi\edk2_ > > livecode_3_6_2016\edk2\AppPkg\Applications\Python\Python- > 2.7.2\Modules\zlib > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\A > > pplications\Python\Python-2.7.2\Modules\expat > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applicat > > ions\Python\PyMod-2.7.2 > > \Modules\expat /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\AppPkg\Applications\Python\Python- > 2.7.2\Modules\cjkcodecs > > /Ic:\users > > > \user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\Python\Pytho > n-2.7.2\Modules\_io > > /Ic:\users\user\documents\dev\uefi\edk2 > > _livecode_3_6_2016\edk2\AppPkg\Applications\Python\Python- > 2.7.2\Modules > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Appli > > cations\Python\PyMod-2.7.2\Modules /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Objects > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applicat > > ions\Python\PyMod-2.7.2\Objects /Ic:\users\user\documents\dev\uefi > > \edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Python > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\A > > pplications\Python\PyMod-2.7.2\Python /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Parser > > > /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\Pyth > on\Efi > > /Ic:\users\user\documents\dev\uefi\edk2_livecode > > _3_6_2016\edk2\AppPkg\Applications\Python > /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Ap > > plications\Python\PythonCore\DEBUG > /Ic:\users\user\documents\dev\uefi\edk2\edk2\StdLib > > /Ic:\users\user\documents\dev\uefi\edk > > 2_livecode_3_6_2016\edk2\StdLib\Include > /Ic:\users\user\documents\dev\ > > uefi\edk2\edk2\StdLib\Include\X64 /Ic:\users\user\docum > > ents\dev\uefi\edk2\edk2\MdePkg > /Ic:\users\user\documents\dev\uefi\edk2\edk2\MdePkg\Include > > /Ic:\users\user\ > > documents\dev\uefi\edk2\edk2\MdePkg\Include\X64 > > c:\users\user\documents\dev\uefi\edk2\edk2\Build\AppPkg\DEBUG_VS > > > 2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\AutoGen.c > > cl : Command line warning D9025 : overriding '/Oi' with '/Oi-' > > AutoGen.c > > "C:\Program Files (x86)\Microsoft Visual Studio > > 11.0\Vc\bin\x86_amd64\lib.exe" /NOLOGO /LTCG > /OUT:c:\users\user\documents\d > > ev\uefi\edk2_live > > code_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\A > > pplications\Python\PythonCore\OUTPUT\Python.lib > > @c:\users\user\documents\dev\uefi\edk2_l > > ivecode_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPk > > g\Applications\Python\PythonCore\OUTPUT\object_files.lst > > "C:\Program Files (x86)\Microsoft Visual Studio > > 11.0\Vc\bin\x86_amd64\link.exe" > /OUT:c:\users\user\documents\dev\uefi\edk2 > > \edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\P > > ython\PythonCore\DEBUG\Python.dll /NOLOGO /NODEFAULTLIB > /IGNORE:4001 > > /OPT:REF /OPT:ICF=3D10 / > > MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG > /DLL > > /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO > > /BASE > > :0 /DRIVER /DEBUG @c:\users\user\documents\dev\u > > efi\edk2\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applic > > ations\Python\PythonC > > ore\OUTPUT\static_library_files.lst > > Python.lib(ceval.obj) : error LNK2001: unresolved external symbol > > PyThread_acquire_lock > > Python.lib(ceval.obj) : error LNK2001: unresolved external symbol > > PyThread_allocate_lock > > Python.lib(ceval.obj) : error LNK2001: unresolved external symbol > > PyThread_get_thread_ident > > Python.lib(ceval.obj) : error LNK2001: unresolved external symbol > > PyThread_release_lock > > Python.lib(signalmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_ReInitTLS > > Python.lib(pystate.obj) : error LNK2001: unresolved external symbol > > PyThread_delete_key > > Python.lib(pystate.obj) : error LNK2001: unresolved external symbol > > PyThread_create_key > > Python.lib(pystate.obj) : error LNK2001: unresolved external symbol > > PyThread_set_key_value > > Python.lib(pystate.obj) : error LNK2001: unresolved external symbol > > PyThread_delete_key_value > > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual > > Studio 11.0\Vc\bin\x86_amd64\link.exe"' : return code '0x460' > > PStop. > > ython.lib(pystate.obj) : error LNK2001: unresolved external symbol > > PyThread_get_key_value > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_free_lock > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_get_stacksize > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_exit_thread > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_init_thread > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_set_stacksize > > Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbo= l > > PyThread_start_new_thread > > c:\users\user\documents\dev\uefi\edk2\edk2\Build\AppPkg\DEBU > > > G_VS2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\Pytho > n.dll > > : fatal error LNK1120: 16 unresolved externals > > > > build... > > : error 7000: Failed to execute command > > C:\Program Files (x86)\Microsoft Visual Studio > > 11.0\Vc\bin\nmake.exe /nologo tbuild [c:\users\user\documents\dev\u > > efi\edk2 > > \edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\P > > ython\PythonCore] > > > > build... > > : error F002: Failed to build module > > > c:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\Pytho > n\PythonCore.inf > > [X64, VS2012x86, DEBUG] > > > > > > > > Note that I also has to modify > \edk2\AppPkg\Applications\Python\Efi\config.c > > to uncomment "{"thread", initthread}," and edit > > \edk2\AppPkg\Applications\Python\PythonCore.inf to add > > 'Python-$(PYTHON_VERSION)/Modules/threadmodule.c'. > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel