From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 99BD221A04823 for ; Tue, 18 Apr 2017 12:56:33 -0700 (PDT) Received: by mail-yw0-x229.google.com with SMTP id k13so1612788ywk.1 for ; Tue, 18 Apr 2017 12:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=J+HGFmD+gqfEB9lqDhxd6Iu4WfvDIa4RsuZkrlL2ka0=; b=h4wyphkA6s7w8TZMIUQ0n8x2abJsQGj48bGBQk52EIoeEgJUwJe2rx4BJop5DUZgiB wBr0ndRVPXYZdwmLeUoHM3YGyPOyYCj14pSe/LcLhccnlQWDyw+pTYs0b/YlVZSfSJPB qMjtlXOxO+KEnsBosfwaUp4Izpx9DIpYLoZqURzWVQYkaYLWOQSMHskcHA+lK0cubICB T2Lo/x+lZiYdxkZ7pOuc3L02BN7YlzbDvhdiqFOm/Itx0ae1F1vZlE64uY7HtLxd8OYJ CQlFovAPxZ5Dhjo7FZKBfbcRjivnFQC2wm+gbtNK8WRm6FsCzkNEzlMvQIs9aAyKhq0x ml7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=J+HGFmD+gqfEB9lqDhxd6Iu4WfvDIa4RsuZkrlL2ka0=; b=iHSPvO0MvnC0qN1JDpKMCIWJg1ibFlxjdhlCBJUeCyzYxtt8hVOQIvZBm2ztBUIVEM ocbbQhFrEI5FmMXRK0+0HKuonZxMovGzjZQxThl0Ym7UVpXla3IgdJsUMtlzNenebBPY a2LKGoMtshzNgx22HMcOLmAbpmJME7d53F1iR/wxi5V7FisONZPnJcAdx5x62+kZJucM ejKCLmT0dJ2msQMCaxiKaZ8JxD/sUQ66jLm3NGb40u+K8Uc1ix/GZ3KauCZS/2pXGJ/e V5bbX0wwJY4J+ZVZ9UXQx4efFJ4ifI5NqvTXFFzccV5dq3X3h5HM/f1br6Mo1Eebqqdd 0UNg== X-Gm-Message-State: AN3rC/50yoa6eTnDYU38zLKBrTCau8wEQm1gR1KcWZ0eAofx4lgFYIDq 0vQ4bvQrqoqw4fvgubMikpTve52VPEpQ X-Received: by 10.129.44.66 with SMTP id s63mr22564768yws.64.1492545392501; Tue, 18 Apr 2017 12:56:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.122.68 with HTTP; Tue, 18 Apr 2017 12:56:12 -0700 (PDT) From: KT Date: Tue, 18 Apr 2017 14:56:12 -0500 Message-ID: To: edk2-devel@lists.01.org Cc: edk2-lists@mc2research.org X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Python issue 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: Tue, 18 Apr 2017 19:56:34 -0000 Content-Type: text/plain; charset=UTF-8 Hi experts, I am experimenting python scripts in UEFI shell and as part of the first 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, urllib3 etc). So I manually copied these under the \EFI\StdLib\lib\python.27\site-packages folder (not sure if that is the correct way). That said currently my script 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__.py", 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/six.py", line 203, in load_module mod = mod._resolve() File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/six.py", line 115, in _resolve return _import_module(self.mod) File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/six.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 and after investigating further I realized I may have to turn on the threading 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\Python\ 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\ Applications\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\Python-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\ Applications\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\Python\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\ dev\uefi\edk2_live code_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\ AppPkg\Applications\Python\PythonCore\OUTPUT\Python.lib @c:\users\user\documents\dev\uefi\edk2_l ivecode_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\ AppPkg\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\Python\PythonCore\DEBUG\Python.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 / 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\uefi\edk2\edk2\Build\AppPkg\ DEBUG_VS2012x86\X64\AppPkg\Applications\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 symbol 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 symbol PyThread_free_lock Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol PyThread_get_stacksize Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol PyThread_exit_thread Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol PyThread_init_thread Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol PyThread_set_stacksize Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol PyThread_start_new_thread c:\users\user\documents\dev\uefi\edk2\edk2\Build\AppPkg\ DEBUG_VS2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\Python.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\uefi\edk2 \edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\Python\ PythonCore] build... : error F002: Failed to build module c:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\ Applications\Python\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'.