AmigaLabs / webkitty

The AmigaOS 4 WebKit port
9 stars 3 forks source link

JSC: native Linux build #2

Closed walkero-gr closed 12 months ago

walkero-gr commented 2 years ago
walkero-gr commented 2 years ago

Started working on that and right now I am getting the following error

[147/1611] Building CXX object Source/WTF/wtf/CMakeFiles/WTF.dir/posix/ThreadingPOSIX.cpp.o
FAILED: Source/WTF/wtf/CMakeFiles/WTF.dir/posix/ThreadingPOSIX.cpp.o 
/usr/bin/ccache /usr/bin/g++-10  -DBUILDING_JSCONLY__ -DBUILDING_WITH_CMAKE=1 -DBUILDING_WTF -DHAVE_CONFIG_H=1 -DPAS_BMALLOC=1 -I. -IWTF/DerivedSources -I../../Source/WTF -I../../Source/WTF/wtf -I../../Source/WTF/wtf/dtoa -I../../Source/WTF/wtf/persistence -I../../Source/WTF/wtf/text -I../../Source/WTF/wtf/text/icu -I../../Source/WTF/wtf/threads -I../../Source/WTF/wtf/unicode -fdiagnostics-color=always -Wextra -Wall -pipe -Wno-expansion-to-defined -Wno-odr -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -O2 -fPIC -fno-strict-aliasing -fno-exceptions -fno-rtti -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=c++2a -MD -MT Source/WTF/wtf/CMakeFiles/WTF.dir/posix/ThreadingPOSIX.cpp.o -MF Source/WTF/wtf/CMakeFiles/WTF.dir/posix/ThreadingPOSIX.cpp.o.d -o Source/WTF/wtf/CMakeFiles/WTF.dir/posix/ThreadingPOSIX.cpp.o -c ../../Source/WTF/wtf/posix/ThreadingPOSIX.cpp
../../Source/WTF/wtf/posix/ThreadingPOSIX.cpp: In static member function ‘static WTF::Thread& WTF::Thread::initializeTLS(WTF::Ref<WTF::Thread>&&)’:
../../Source/WTF/wtf/posix/ThreadingPOSIX.cpp:589:5: error: ‘FindTask’ was not declared in this scope
  589 |     FindTask(NULL)->tc_UserData = &threadInTLS;
      |     ^~~~~~~~
[152/1611] Building CXX object Source/WTF/wtf/CMakeFiles/WTF.dir/posix/FileSystemPOSIX.cpp.o

Compiled with both gcc-9 and gcc-10.

walkero-gr commented 2 years ago

The above seems to be an addition for MorphOS as it is not in original WebKit source, and possibly will be needed for AmigaOS as well. For now, I skipped that line by including it in

if OS(MORPHOS) ... #endif

walkero-gr commented 2 years ago

Got myself into one more failure

[815/1611] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp.o
FAILED: Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp.o 
/usr/bin/ccache /usr/bin/g++  -DBUILDING_JSCONLY__ -DBUILDING_JavaScriptCore -DBUILDING_WITH_CMAKE=1 -DHAVE_CONFIG_H=1 -DJavaScriptCore_EXPORTS -DPAS_BMALLOC=1 -DSTATICALLY_LINKED_WITH_WTF -IJavaScriptCore/Headers -I. -I../../Source/JavaScriptCore -I../../Source/JavaScriptCore/API -I../../Source/JavaScriptCore/assembler -I../../Source/JavaScriptCore/b3 -I../../Source/JavaScriptCore/b3/air -I../../Source/JavaScriptCore/bindings -I../../Source/JavaScriptCore/builtins -I../../Source/JavaScriptCore/bytecode -I../../Source/JavaScriptCore/bytecompiler -I../../Source/JavaScriptCore/dfg -I../../Source/JavaScriptCore/disassembler -I../../Source/JavaScriptCore/disassembler/ARM64 -I../../Source/JavaScriptCore/disassembler/zydis/Zydis -I../../Source/JavaScriptCore/domjit -I../../Source/JavaScriptCore/ftl -I../../Source/JavaScriptCore/heap -I../../Source/JavaScriptCore/debugger -I../../Source/JavaScriptCore/inspector -I../../Source/JavaScriptCore/inspector/agents -I../../Source/JavaScriptCore/inspector/augmentable -I../../Source/JavaScriptCore/inspector/remote -I../../Source/JavaScriptCore/interpreter -I../../Source/JavaScriptCore/jit -I../../Source/JavaScriptCore/llint -I../../Source/JavaScriptCore/parser -I../../Source/JavaScriptCore/profiler -I../../Source/JavaScriptCore/runtime -I../../Source/JavaScriptCore/tools -I../../Source/JavaScriptCore/wasm -I../../Source/JavaScriptCore/wasm/js -I../../Source/JavaScriptCore/yarr -IJavaScriptCore/DerivedSources -IJavaScriptCore/DerivedSources/inspector -IJavaScriptCore/DerivedSources/runtime -IJavaScriptCore/DerivedSources/yarr -IWTF/Headers -fdiagnostics-color=always -Wextra -Wall -pipe -Wno-expansion-to-defined -Wno-odr -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -O2 -fPIC -fno-strict-aliasing -fno-exceptions -fno-rtti -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -ffp-contract=off -std=c++2a -MD -MT Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp.o -MF Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp.o.d -o Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp.o -c JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp
In file included from JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-30.cpp:5:
../../Source/JavaScriptCore/runtime/Options.cpp: In static member function ‘static bool JSC::Options::isAvailable(JSC::Options::ID, JSC::Options::Availability)’:
../../Source/JavaScriptCore/runtime/Options.cpp:169:15: error: ‘traceLLIntExecutionID’ was not declared in this scope; did you mean ‘traceLLIntExecution’?
  169 |     if (id == traceLLIntExecutionID)
      |               ^~~~~~~~~~~~~~~~~~~~~
      |               traceLLIntExecution
../../Source/JavaScriptCore/runtime/Options.cpp:171:15: error: ‘traceLLIntSlowPathID’ was not declared in this scope; did you mean ‘traceLLIntSlowPath’?
  171 |     if (id == traceLLIntSlowPathID)
      |               ^~~~~~~~~~~~~~~~~~~~
      |               traceLLIntSlowPath
[822/1611] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-26.cpp.o
ninja: build stopped: subcommand failed.
Compiling jsc failed!
javierdlr commented 2 years ago

maybe when building you need to "disable" some stuff: -DENABLE_JIT_JSC:BOOL=OFF \ -DBUILD_SHARED_LIBS="NO"

or/and maybe other options shoul be (dis)enabled

this is the cmake build for amigaos4 Oddyssey: cmake .. \ -DCMAKE_CROSSCOMPILING=ON \ -DCMAKE_TOOLCHAIN_FILE=./amigaos4.cmake \ -DCMAKE_MODULE_PATH=../cmake \ -DUSE_GRAPHICS="MORPHOS" \ -DUSE_FONTS="FREETYPE" \ -DUSE_TIMER="MORPHOS" \ -DBUILD_SHARED_LIBS="NO" \ -DUSE_THREADS="MORPHOS" \ -DWITH_OWB_CONFIG_DIR="PROGDIR:owb.conf" \ -DENABLE_MULTIPLE_THREADS=OFF \ -DENABLE_ACCESSIBILITY:BOOL=ON \ -DENABLE_BLOB:BOOL=ON \ -DENABLE_DATALIST:BOOL=ON \ -DENABLE_DOM_STORAGE:BOOL=ON \ -DENABLE_EVENTSOURCE:BOOL=ON \ -DENABLE_FILE_SYSTEM:BOOL=ON \ -DENABLE_FILTERS:BOOL=ON \ -DENABLE_ICONDATABASE:BOOL=ON \ -DENABLE_INSPECTOR:BOOL=ON \ -DENABLE_JIT_JSC:BOOL=OFF \ -DENABLE_MATHML:BOOL=ON \ -DENABLE_MEDIA_STATISTICS:BOOL=ON \ -DENABLE_METER_TAG:BOOL=ON \ -DENABLE_NOTIFICATIONS:BOOL=ON \ -DENABLE_NPAPI:BOOL=ON \ -DENABLE_OFFLINE_DYNAMIC_ENTRIES:BOOL=ON \ -DENABLE_OFFLINE_WEB_APPLICATIONS:BOOL=ON \ -DENABLE_PROGRESS_TAG:BOOL=ON \ -DENABLE_REQUEST_ANIMATION_FRAME:BOOL=ON \ -DENABLE_RUBY:BOOL=ON \ -DENABLE_SANDBOX:BOOL=ON \ -DENABLE_SQL_DATABASE:BOOL=ON \ -DENABLE_SVG:BOOL=ON \ -DENABLE_SVG_ANIMATION:BOOL=ON \ -DENABLE_SVG_AS_IMAGE:BOOL=ON \ -DENABLE_SVG_FONTS:BOOL=ON \ -DENABLE_SVG_FOREIGN_OBJECT:BOOL=ON \ -DENABLE_SVG_USE_ELEMENT:BOOL=ON \ -DENABLE_WEB_SOCKETS:BOOL=ON \ -DENABLE_WEB_TIMING:BOOL=ON \ -DENABLE_XPATH:BOOL=ON \ -DENABLE_XSLT:BOOL=ON \ -DENABLE_TESTS:BOOL=OFF \ -DENABLE_TESTS_CPPUNIT:BOOL=OFF \ -DENABLE_YARR:BOOL=ON

walkero-gr commented 2 years ago

@javierdlr This build is native x86 and has nothing to do with the amiga port yet.

walkero-gr commented 2 years ago

For the traceLLIntExecutionID and traceLLIntSlowPathID problem, I tried to find info about it but could find where or how these are defined. In MorphOS port those are skipped, so for the native build I decided to skip them as well, by changing line https://github.com/walkero-gr/webkitty/blob/amigaos_2.36.8/Source/JavaScriptCore/runtime/Options.cpp#L168 to #if !OS(MORPHOS) && !OS(LINUX)

By doing this change it compiled just fine and I will attach here the tests results

walkero-gr commented 2 years ago

So far the compilation is done, but I am getting the following failure

C-API tests in C++ had 2 failures
ASSERTION FAILED: !testCAPIViaCpp(filter)
../../Source/JavaScriptCore/API/tests/testapi.c(1417) : main
testapi completed with rc=134 (254)

** The following JSC test binaries failures have been introduced:
        testapi

Results for JSC test binaries:
    1 failure found.

Skipping upload to results database since no report URL was specified
make: *** [Makefile:31: jscore-native] Error 254
javierdlr commented 2 years ago

shouldn't you indicate an argument/filter/url? Or is such testcase executed automatically for testing pourposes? ... const char* filter = argc > 1 ? argv[1] : NULL; ... RELEASE_ASSERT(!testCAPIViaCpp(filter)); ...

walkero-gr commented 2 years ago

@javierdlr Actually this is not needed.

I managed to have the tests passing

====================================================================
 JavaScriptCore is now built (16m:34s). 
====================================================================
testmasm completed with rc=0 (0)

testair completed with rc=0 (0)

testb3 completed with rc=0 (0)

testdfg completed with rc=0 (0)

testapi completed with rc=0 (0)

Which seems that the native compilation looks fine.

javierdlr commented 2 years ago

GREAT!!! What did you change to make it work?!?!

walkero-gr commented 2 years ago

I removed some libraries I installed that seemed that conflict, and rebuild everything. I will document all the necessary steps and software I installed for this task, as soon as I am 100% sure that is complete.

walkero-gr commented 2 years ago

Right now I paused that, and the reason is that I am getting the following error, although the code compiles fine.

It is on tests, and it seems is missing the sunspider tool, which has to do with javascript tests. I can't find it anywhere available for Linux systems.

Running: /usr/bin/env ruby Tools/Scripts/run-jsc-stress-tests -j /opt/code/webkitty/WebKitBuild/Release/bin/jsc -o /opt/code/webkitty/WebKitBuild/Release/bin/jsc-stress-results --arch x86_64 PerformanceTests/SunSpider/tests/sunspider-1.0 PerformanceTests/JetStream/cdjs/cdjs-tests.yaml PerformanceTests/ARES-6/Air/airjs-tests.yaml PerformanceTests/ARES-6/Basic/basic-tests.yaml JSTests/executableAllocationFuzz.yaml JSTests/exceptionFuzz.yaml PerformanceTests/SunSpider/no-architecture-specific-optimizations.yaml PerformanceTests/SunSpider/shadow-chicken.yaml PerformanceTests/SunSpider/with-baseline-code-sharing.yaml PerformanceTests/SunSpider/tests/v8-v6 JSTests/stress JSTests/microbenchmarks JSTests/slowMicrobenchmarks.yaml PerformanceTests/SunSpider/profiler-test.yaml LayoutTests/jsc-layout-tests.yaml JSTests/typeProfiler.yaml JSTests/controlFlowProfiler.yaml JSTests/es6.yaml JSTests/modules.yaml JSTests/complex.yaml JSTests/ChakraCore.yaml JSTests/wasm.yaml JSTests/mozilla/mozilla-tests.yaml --

Warning: cannot identify JSC framework, doing generic VM copy.
Tools/Scripts/run-jsc-stress-tests:2233:in `realpath': No such file or directory @ rb_check_realpath_internal - PerformanceTests/SunSpider/tests/sunspider-1.0 (Errno::ENOENT)
        from Tools/Scripts/run-jsc-stress-tests:2233:in `realpath'
        from Tools/Scripts/run-jsc-stress-tests:2233:in `prepareCollection'
        from Tools/Scripts/run-jsc-stress-tests:2332:in `handleCollectionDirectory'
        from Tools/Scripts/run-jsc-stress-tests:2354:in `handleCollection'
        from Tools/Scripts/run-jsc-stress-tests:2450:in `block in prepareBundle'
        from Tools/Scripts/run-jsc-stress-tests:2448:in `each'
        from Tools/Scripts/run-jsc-stress-tests:2448:in `prepareBundle'
        from Tools/Scripts/run-jsc-stress-tests:3143:in `prepareArtifacts'
        from /opt/code/webkitty/Tools/Scripts/webkitruby/jsc-stress-test/executor.rb:115:in `loop'
        from Tools/Scripts/run-jsc-stress-tests:3238:in `runNormal'
        from Tools/Scripts/run-jsc-stress-tests:3280:in `<main>'
make: *** [Makefile:31: jscore-native] Error 1