Kode / Krom

Other
96 stars 23 forks source link

Linux compile error #129

Closed TheImaginaryOne closed 4 years ago

TheImaginaryOne commented 5 years ago

Arch Linux, clang 8.0.0

Steps: Clone the repository and run node Kore/make --compiler clang --compile.

Eventually compilation fails with the following error

clang  -O2 -I./ -I../../Chakra/Build/prebuilt/Linux -I../../Chakra/lib/Common -I../../Chakra/lib/Common/PlaceHolder -I../../Chakra/lib/Runtime -I../../Chakra/lib/Runtime/ByteCode -I../../Chakra/lib/Runtime/Math -I../../Chakra/lib/Jsrt -I../../Chakra/lib/Parser -I../../Chakra/lib/Backend -I../../Chakra/lib/WasmReader -I../../Chakra/lib/wabt/chakra -I../../Chakra/lib/Backend/amd64 -I../../Chakra/lib -I../../Chakra/lib/Runtime/Debug -I../../Chakra/lib/Runtime/Base -I../../Chakra/bin/ChakraCore -I../../Chakra/bin/NativeTests -I../../Chakra/bin/External -I../../Chakra/lib/Runtime/PlatformAgnostic -I../../Chakra/lib/Common/Memory -I../../Chakra/lib/Runtime/Language -I../../Chakra/lib/wabt -I../../Chakra/lib/wabt/chakra/windows -I../../Chakra/pal -I../../Chakra/pal/inc -I../../Chakra/pal/inc/rt -I../../Chakra/pal/src/include -I../../Kore/Sources -I../../Kore/Backends/System/Linux/Sources -I../../Kore/Backends/System/POSIX/Sources -I../../Kore/Backends/Graphics4/OpenGL/Sources -I../../Kore/Backends/Graphics5/G5onG4/Sources -I../../Kore/Backends/Audio3/A3onA2/Sources  -DUNICODE -DNOMINMAX -DUSE_EDGEMODE_JSRT -DCOM_STDMETHOD_CAN_THROW -DUSE_STATIC_RUNTIMELIB -D_CHAKRACOREBUILD -DTARGET_64 -DPLATFORM_UNIX -DFEATURE_PAL -DPLATFORM_UNIX=1 -D_M_X64 -D_M_AMD64 -D_AMD64_ -D_SAFECRT_USE_CPP_OVERLOADS=1 -D__STDC_WANT_LIB_EXT1__=1 -DCLANG_HAS_DISABLE_TAIL_CALLS=1 -DBIT64=1 -DSTACK_ALIGN=16 -DLP64COMPATIBLE=1 -DFEATURE_PAL=1 -DPIC=1 -D_FILE_OFFSET_BITS=64 -D_WIN64=1 -DNO_PAL_MINMAX -D_ENABLE_DYNAMIC_THUNKS=1 -D__LINUX__=1 -DLINUX64 -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LINUX -DKORE_OPENGL -DKORE_POSIX -DKORE_G4 -DKORE_G5 -DKORE_G5ONG4 -DKORE_A3   -c ../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S -o amd64_thunks.o -static-libgcc -static-libstdc++ -pthread -lasound -ldl -lGL -lX11 -lXinerama -lXi
clang-8: warning: -lasound: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: -ldl: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: -lGL: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: -lX11: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: -lXinerama: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: -lXi: 'linker' input unused [-Wunused-command-line-argument]
clang-8: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument]
clang-8: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:215:21: error: unknown token in expression
        sub rsp, 40h
                    ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:217:23: error: unknown token in expression
        mov [rsp + 28h], r12
                      ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:218:23: error: unknown token in expression
        mov [rsp + 30h], r13
                      ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:230:21: error: unknown token in expression
        add rsi, 68h
                    ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:243:23: error: unknown token in expression
        mov [rsp + 00h], rdi
                      ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:256:21: error: unknown token in expression
        sub rsp, 20h
                    ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:257:26: error: unknown token in expression
        movups [rsp + 10h], xmm0
                         ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:258:28: error: unknown token in expression
        lea r12, [rsp + 10h]
                           ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:264:28: error: unknown token in expression
        mov r12, [rsp + 28h]
                           ^
../../Chakra/lib/Runtime/Language/amd64/amd64_Thunks.S:265:28: error: unknown token in expression
        mov r13, [rsp + 30h]
                           ^
make: *** [makefile:659: amd64_thunks.o] Error 1
make: *** Waiting for unfinished jobs....
27 warnings generated.
Compilation failed.

UPDATE: Clang 8 doesn't seem to support this h syntax (like 40h). There is a difference between this file and the current master in microsoft/ChakraCore: syntax like 40h is replaced with 0x40.

RobDangerous commented 5 years ago

Clang should just forward that to your assembler, it's not a C file. Is that an x86 or a x64 Linux?

TheImaginaryOne commented 5 years ago

I have x64 Linux. However, there is a relevant commit here from April 24, which fixes an issue relevant to Clang 8 that I strongly suspect to be the cause of the error: https://github.com/microsoft/ChakraCore/commit/20b819a5a7ff09577a61582059259f67729cde0c

Is it possible to update the Kode/ChakraCore branch to match the microsoft/ChakraCore?

RobDangerous commented 5 years ago

But that's an llvm-as issue, not a clang issue, such a bad commit title. But yes, of course, will update Chakra at some point.

RobDangerous commented 4 years ago

I updated Chakra. That hopefully fixes everything.