Error while building static_h for Windows
Bug Description
I try to build a Windows version using the following commands:
- cmake -S hermes -B build_release -G "Visual Studio 17 2022" -T ClangCL -A x64 -DCMAKE_BUILD_TYPE=Release
- cmake --build ./build_release
The first step runs without any error. The second step returns the following error:
C:\Users\louis\projecten\hermes\hermes\external\boost\boost_1_86_0\libs\context\src\asm\make_x86_64_ms_pe_masm.asm(90): error A2008: syntax error :
FRAME [C:\Users\louis\projecten\hermes\build_release\external\boost\boost_1_86_0\libs\context\boost_context_obj.vcxproj]
C:\Users\louis\projecten\hermes\hermes\external\boost\boost_1_86_0\libs\context\src\asm\make_x86_64_ms_pe_masm.asm(92): warning A4020: directive ig
nored outside a procedure [C:\Users\louis\projecten\hermes\build_release\external\boost\boost_1_86_0\libs\context\boost_context_obj.vcxproj]
C:\Users\louis\projecten\hermes\hermes\external\boost\boost_1_86_0\libs\context\src\asm\make_x86_64_ms_pe_masm.asm(162): fatal error A1010: unmatch
ed block nesting : hoost_make_fcontext [C:\Users\louis\projecten\hermes\build_release\external\boost\boost_1_86_0\libs\context\boost_context_obj.vc
xproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets(70,5): error MSB3721: de
opdracht ml64.exe /c /nologo /Fo"boost_context_obj.dir\Debug\make_x86_64_ms_pe_masm.obj" /D"WIN32" /D"_WINDOWS" /D"_CRT_SECURE_NO_DEPRECATE" /D"_CR
T_SECURE_NO_WARNINGS" /D"_CRT_NONSTDC_NO_DEPRECATE" /D"_CRT_NONSTDC_NO_WARNINGS" /D"_SCL_SECURE_NO_DEPRECATE" /D"_SCL_SECURE_NO_WARNINGS" /D"STATIC
_HERMES" /D"HERMES_RELEASE_VERSION="0.12.0"" /D"HERMESVM_GC_HADES" /D"HERMESVM_INDIRECT_THREADING" /D"HERMESVM_LOG_HEAP_SEGMENT_SIZE=22" /D"HERMESV
M_ALLOW_CONCURRENT_GC" /D"HERMESVM_ALLOW_INLINE_ASM" /D"HERMES_ENABLE_UNICODE_REGEXP_PROPERTY_ESCAPES" /D"HERMES_SLOW_DEBUG" /D"HERMES_USE_BOOST_CO
NTEXT=1" /D"USE_WIN10_ICU" /D"CMAKE_INTDIR="Debug"" /I "C:\Users\louis\projecten\hermes\hermes\external" /I "C:\Users\louis\projecten\hermes\hermes
\include" /I "C:\Users\louis\projecten\hermes\build_release\include" /I "C:\Users\louis\projecten\hermes\build_release\lib\config" /I "C:\Users\lou
is\projecten\hermes\hermes\external\icu_decls" /I "C:\Users\louis\projecten\hermes\hermes\external\llvh\include" /I "C:\Users\louis\projecten\herme
s\hermes\external\llvh\gen\include" /I "C:\Users\louis\projecten\hermes\build_release\external\llvh\include" /I "C:\Users\louis\projecten\hermes\he
rmes\external\boost\boost_1_86_0" /W3 /errorReport:prompt -fno-exceptions -fno-rtti /TaC:\Users\louis\projecten\hermes\hermes\external\boost\boost
_1_86_0\libs\context\src\asm\make_x86_64_ms_pe_masm.asm is afgesloten met code 1. [C:\Users\louis\projecten\hermes\build_release\external\boost\boo
st_1_86_0\libs\context\boost_context_obj.vcxproj]
Thanks! We're working on trying to repro locally. We'll get back to you.
We actually don't support compiling static_h with MSVC at the moment. But PRs with fixes are always welcome.
Wait, this is not MSVC
Try setting HERMES_ALLOW_BOOST_CONTEXT to 0
I tried your suggestion and it probably solved the problem. I am not 100% sure. I now do get the following error:
C:\Users\louis\projecten\hermes\hermes\tools\shermes\compile.cpp(20,10): fatal error : 'dlfcn.h' file not found [C:\Users\louis\projecten\hermes\build _release\tools\shermes\shermes.vcxproj]
That is expected, shermes using Unix functions to load the compiled .so for the "-exec" option. That can work on Windows, but would require different APIs. You can comment that code out or add a Windows version.
I have commented the dlfcn code out resulting in a shermes.exe in the debug folder. However, if I try to run shermes quicksort.js, I get the following errors:
clang: error: no such file or directory: 'C' clang: error: no such file or directory: '/Users/louis/projecten/hermes/build_release/lib/Debug' clang: error: no such file or directory: 'C' clang: error: no such file or directory: '/Users/louis/projecten/hermes/build_release/jsi/Debug' clang: error: no such file or directory: 'C' clang: error: no such file or directory: '/Users/louis/projecten/hermes/build_release/tools/shermes/Debug' C:\Program Files\LLVM\bin\clang.exe: execution failed