#Compiling the impossible (compiling hermes to wasm)

1 messages · Page 1 of 1 (latest)

tardy tusk
#
  Run Build Command(s):/usr/bin/ninja cmTC_46f5a && [1/2] Building CXX object CMakeFiles/cmTC_46f5a.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_46f5a
    FAILED: cmTC_46f5a 
    : && /home/theo/my-config/scripts/bin/zigcxxwasi   CMakeFiles/cmTC_46f5a.dir/testCXXCompiler.cxx.o -o cmTC_46f5a   && :
    wasm-ld: error: entry symbol not defined (pass --no-entry to suppress): _start
    ninja: build stopped: subcommand failed.
    

It seems like zig c++ doesn't compile with wasm32-freestanding-musl with cmake because of this wasm-ld error. It says I need to use build-lib in the zig docs, but that's not an option with cmake and zig c++...
I also tried using wasm32-wasi but it complains that it can't find /usr/include files even though it should be using a different target than my native system.

#

Zig no longer passes --no-entry to the linker for executables. If you want --no-entry then use build-lib.

#

also, this error occurs when cmake tries to test the c++ compiler to see if it is a valid compiler.... so its not even building hermes yet

#!/bin/sh

exec zig c++ -target wasm32-freestanding-musl -Oz "$@"
#

ok i found a flag for cmake, -DCMAKE_CXX_COMPILER_WORKS=1 to bypass the executable linking step for now

#

hmm now it cant find a c++ standard library

tardy tusk
#

hmmmm

#

still no stdlib though

#

/home/theo/dev/wasmos/build/_deps/googletest-src/googletest/include/gtest/gtest.h:52:10: fatal error: 'cstddef' file not found
#include <cstddef>
^~~~~~~~~

tardy tusk
#

ugh

#
wasm-ld: error: yoga/CMakeFiles/yogacore.dir/Utils.cpp.o: undefined symbol: __cxa_allocate_exception
wasm-ld: error: yoga/CMakeFiles/yogacore.dir/Utils.cpp.o: undefined symbol: __cxa_throw
``` this too (with wasi)
tardy tusk
#

Somehow wasi-sdk 20 works fine but zig doenst