Open liudonghua123 opened 1 year ago
Thanks, @liudonghua123 for trying out LPython!!
Currently, we don't support building the LPython using minGW
, can you try MSVC
?
If MSVC
is already installed on your system, try calling the following in the mini forge command prompt:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
(See: https://github.com/lcompilers/lpython#windows).
Or you can also try installing lpython using conda on Windows and see if that helps.
Yes, I forget to execute call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
.
And I also got the following errors after I use MSVC build tools even I execute chcp 65001
.
......
[5/83] Building CXX object src\libasr\CMakeFiles\asr.dir\codegen\asr_to_x86.cpp.obj
FAILED: src/libasr/CMakeFiles/asr.dir/codegen/asr_to_x86.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe /nologo /TP -DHAVE_TARGET_X86=1 -DHAVE_WHEREAMI=1 -DHAVE_ZLIB=1 -DLCOMPILERS_FAST_ALLOC=1 -ID:\code\python\lpython\src\libasr\.. -external:ID:\apps\mambaforge\envs\lp\Library\include -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG -std:c++17 /GR- /showIncludes /Fosrc\libasr\CMakeFiles\asr.dir\codegen\asr_to_x86.cpp.obj /Fdsrc\libasr\CMakeFiles\asr.dir\asr.pdb /FS -c D:\code\python\lpython\src\libasr\codegen\asr_to_x86.cpp
cl : Command line warning D9025 : overriding '/GR' with '/GR-'
D:\code\python\lpython\src\libasr\..\libasr/location.h(18): warning C4267: 'return': conversion from 'size_t' to 'uint32_t', possible loss of data
D:\code\python\lpython\src\libasr\..\libasr/location.h(19): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data
D:\code\python\lpython\src\libasr\..\libasr/location.h(201): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data
D:\code\python\lpython\src\libasr\..\libasr/alloc.h(70): warning C4101: 'e': unreferenced local variable
D:\code\python\lpython\src\libasr\..\libasr/asr.h(5702): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6533): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6549): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6559): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6605): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6622): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6666): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6732): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6752): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6760): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6824): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6862): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6950): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(6988): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(7049): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(7125): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(7151): error C2001: newline in constant
D:\code\python\lpython\src\libasr\..\libasr/asr.h(7280): error C2001: newline in constant
......
TO FIX THIS error C2001: newline in constant
ERROR, I NEED TO CHECK Beta: Use Unicode UTF-8 for worldwide language support
.
Now I have build it successfully. Thanks! :)
......
[81/82] Install the project...-- Install configuration: "Release"
-- Installing: D:/code/python/lpython/inst/bin/msvcp140.dll
-- Installing: D:/code/python/lpython/inst/bin/msvcp140_1.dll
-- Installing: D:/code/python/lpython/inst/bin/msvcp140_2.dll
-- Installing: D:/code/python/lpython/inst/bin/msvcp140_atomic_wait.dll
-- Installing: D:/code/python/lpython/inst/bin/msvcp140_codecvt_ids.dll
-- Installing: D:/code/python/lpython/inst/bin/vcruntime140_1.dll
-- Installing: D:/code/python/lpython/inst/bin/vcruntime140.dll
-- Installing: D:/code/python/lpython/inst/bin/concrt140.dll
-- Up-to-date: D:/code/python/lpython/inst/bin
-- Installing: D:/code/python/lpython/inst/bin/lpython.exe
-- Installing: D:/code/python/lpython/inst/share/lpython/lib/lpython_runtime.lib
-- Installing: D:/code/python/lpython/inst/bin/lpython_runtime.dll
-- Installing: D:/code/python/lpython/inst/share/lpython/lib/lpython_runtime_static.lib
However, I got the following errors when I tried to execute Tests and examples
. Did I forget something?
ctest
inst\bin\lpython examples\expr2.py
inst\bin\lpython examples\expr2.py -o a.out
a.out
(lp) D:\code\python\lpython>ctest
Test project D:/code/python/lpython
Start 1: test_stacktrace
1/2 Test #1: test_stacktrace .................. Passed 0.04 sec
Start 2: test_lpython
2/2 Test #2: test_lpython ..................... Passed 0.18 sec
100% tests passed, 0 tests failed out of 2
Total Test time (real) = 0.23 sec
(lp) D:\code\python\lpython>inst\bin\lpython examples\expr2.py
semantic error: Could not find the module 'lpython'. If an import path is available, please use the `-I` option to specify it
--> examples\expr2.py:1:1
|
1 | from lpython import i32
| ^^^^^^^^^^^^^^^^^^^^^^^
Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
(lp) D:\code\python\lpython>inst\bin\lpython examples\expr2.py -o a.out
semantic error: Could not find the module 'lpython'. If an import path is available, please use the `-I` option to specify it
--> examples\expr2.py:1:1
|
1 | from lpython import i32
| ^^^^^^^^^^^^^^^^^^^^^^^
Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
(lp) D:\code\python\lpython>
Happy that you were able to build successfully!!! Recently someone had the same issue, check out: https://github.com/lcompilers/lpython/issues/2234. Let us know, if it fixes the problem.
Hi, I tried to build lpython following the readme doc. But when I execute
call build1.bat
, it failed with some errors which I could not find.The last logs are belows.
See the following for full logs.
Details
``` D:\code\python\lpython>conda activate lp (lp) D:\code\python\lpython>call build0.bat xonsh ./build0_win.xsh Assuming default values of Python.asdl and python_ast.py Assuming default values of wasm_instructions.txt and wasm_visitor.h D:\code\python\lpython\src\lpython\parser D:\code\python\lpython D:\code\python\lpython D:\code\python\lpython\src\lpython\parser D:\code\python\lpython D:\code\python\lpython (lp) D:\code\python\lpython>call build1.bat cmake -DCMAKE_BUILD_TYPE=Release -DWITH_LLVM=yes -DLPYTHON_BUILD_ALL=yes -DWITH_STACKTRACE=no -DCMAKE_PREFIX_PATH="D:\apps\mambaforge\envs\lp" -DCMAKE_INSTALL_PREFIX=D:\code\python\lpython/inst . -G "Ninja" -- The C compiler identification is GNU 12.1.0 -- The CXX compiler identification is GNU 12.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found ZLIB: D:/apps/mambaforge/envs/lp/Library/lib/z.lib (found version "1.2.13") -- Found LLVM 11.1.0 -- Using LLVMConfig.cmake in: D:/apps/mambaforge/envs/lp/Library/lib/cmake/llvm Configuration results --------------------- LPYTHON_VERSION: 0.19.0-65-gd335252c2 CPACK_PACKAGE_FILE_NAME: lpython-0.19.0-65-gd335252c2-Windows C compiler : C:/msys64/mingw64/bin/cc.exe C++ compiler : C:/msys64/mingw64/bin/c++.exe Build type: Release C compiler flags : -O3 -DNDEBUG C++ compiler flags : -Wall -Wextra -O3 -march=native -funroll-loops -DNDEBUG Installation prefix: D:/code/python/lpython/inst WITH_LFORTRAN_ASSERT: no LPYTHON_STATIC_BIN: no LPYTHON_BUILD_TO_WASM: no WITH_STACKTRACE: no WITH_RUNTIME_STACKTRACE: WITH_UNWIND: no WITH_BFD: no WITH_DWARFDUMP: no WITH_LINKH: no WITH_MACHO: no HAVE_LFORTRAN_DEMANGLE: yes WITH_LLVM: yes WITH_XEUS: no WITH_JSON: no WITH_LSP: no WITH_FMT: no WITH_LFORTRAN_BINARY_MODFILES: YES WITH_RUNTIME_LIBRARY: YES WITH_WHEREAMI: yes WITH_ZLIB: yes WITH_TARGET_AARCH64: no WITH_TARGET_X86: yes -- Configuring done (20.7s) -- Generating done (0.2s) -- Build files have been written to: D:/code/python/lpython cmake --build . --config Release -j8 --target install [7/87] Building CXX object src/libasr/CMakeFiles/asr.dir/codegen/asr_to_wasm.cpp.obj In file included from D:/code/python/lpython/src/libasr/exception.h:29, from D:/code/python/lpython/src/libasr/assert.h:7, from D:/code/python/lpython/src/libasr/alloc.h:10, from D:/code/python/lpython/src/libasr/asr.h:6, from D:/code/python/lpython/src/libasr/codegen/asr_to_wasm.cpp:8: In constructor 'LCompilers::diag::Span::Span(LCompilers::diag::Span&&)', inlined from 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = LCompilers::diag::Span; _Args = {LCompilers::diag::Span}; _Tp = LCompilers::diag::Span]' at C:/msys64/mingw64/include/c++/12.1.0/bits/new_allocator.h:175:4, inlined from 'static void std::allocator_traits