hermes icon indicating copy to clipboard operation
hermes copied to clipboard

Error while building static_h for Windows

Open louisvangeldrop opened this issue 10 months ago • 6 comments

Bug Description

I try to build a Windows version using the following commands:

  1. cmake -S hermes -B build_release -G "Visual Studio 17 2022" -T ClangCL -A x64 -DCMAKE_BUILD_TYPE=Release
  2. 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]

louisvangeldrop avatar Feb 20 '25 13:02 louisvangeldrop

Thanks! We're working on trying to repro locally. We'll get back to you.

davedets avatar Feb 24 '25 17:02 davedets

We actually don't support compiling static_h with MSVC at the moment. But PRs with fixes are always welcome.

tmikov avatar Feb 24 '25 18:02 tmikov

Wait, this is not MSVC

tmikov avatar Feb 24 '25 18:02 tmikov

Try setting HERMES_ALLOW_BOOST_CONTEXT to 0

tmikov avatar Feb 24 '25 18:02 tmikov

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]

louisvangeldrop avatar Feb 24 '25 22:02 louisvangeldrop

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.

tmikov avatar Feb 25 '25 00:02 tmikov

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

louisvangeldrop avatar Mar 13 '25 20:03 louisvangeldrop