Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get it to work #3

Open
jcbhmr opened this issue Mar 4, 2023 · 25 comments · May be fixed by #4
Open

Get it to work #3

jcbhmr opened this issue Mar 4, 2023 · 25 comments · May be fixed by #4
Assignees
Labels
help wanted Extra attention is needed

Comments

@jcbhmr
Copy link
Member

jcbhmr commented Mar 4, 2023

That means having an actual .wasm file. This could be a while!

@jcbhmr jcbhmr self-assigned this Mar 4, 2023
@jcbhmr jcbhmr added enhancement New feature or request help wanted Extra attention is needed and removed enhancement New feature or request labels Mar 4, 2023
@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

I got farther than I expected before something broke! That's progress!

Here's the error as of now:

https://github.com/jcbhmr/llvm-box/blob/b03d8722317d7e729fcdbebaaf5e5c369e4f01fb/build.sh#L1-L54

./build.sh
-- Performing Test LLVM_LIBSTDCXX_MIN - Failed
CMake Error at cmake/modules/CheckCompilerVersion.cmake:88 (message):
  libstdc++ version must be at least 7.1.
Call Stack (most recent call first):
  cmake/config-ix.cmake:15 (include)
  CMakeLists.txt:857 (include)


-- Configuring incomplete, errors occurred!
emcmake: error: 'cmake -G Ninja -S llvm -B build/llvm-wasm -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=WebAssembly -DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra -DLLVM_ENABLE_DUMP=OFF -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF -DLLVM_ENABLE_BACKTRACES=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_TABLEGEN=build/llvm-native/bin/llvm-tblgen -DCLANG_TABLEGEN=build/llvm-native/bin/clang-tblgen -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-bulk-memory;--experimental-wasm-threads' failed (returned 1)
Full stdout of ./build.sh
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found Python3: /usr/bin/python3.9 (found suitable version "3.9.2", minimum required is "3.6") found components: Interpreter 
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for link.h
-- Looking for link.h - found
-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/param.h
-- Looking for sys/param.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sysexits.h
-- Looking for sysexits.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - found
-- Looking for fenv.h
-- Looking for fenv.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for linux/magic.h
-- Looking for linux/magic.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")  
-- Looking for compress2
-- Looking for compress2 - found
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Looking for xar_open in xar
-- Looking for xar_open in xar - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include  
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Looking for __register_frame
-- Looking for __register_frame - found
-- Looking for __deregister_frame
-- Looking for __deregister_frame - found
-- Looking for __unw_add_dynamic_fde
-- Looking for __unw_add_dynamic_fde - not found
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for setrlimit
-- Looking for setrlimit - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - found
-- Looking for mallinfo2
-- Looking for mallinfo2 - not found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - not found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Failed
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Looking for proc_pid_rusage
-- Looking for proc_pid_rusage - not found
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- Native target X86 is not selected; lli will not JIT code
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.10.1
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- Found Python module pygments
-- Found Python module pygments.lexers.c_cpp
-- Found Python module yaml
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: 
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Failed
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Success
-- Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG
-- Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG - Success
-- Performing Test CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG
-- Performing Test CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG - Success
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR - Failed
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Failed
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FDATA_SECTIONS
-- Performing Test C_SUPPORTS_FDATA_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Linker detection: GNU ld
-- Performing Test HAS_WERROR_GLOBAL_CTORS
-- Performing Test HAS_WERROR_GLOBAL_CTORS - Failed
-- Looking for __x86_64__
-- Looking for __x86_64__ - found
-- Found Git: /usr/local/bin/git (found version "2.39.2") 
-- Targeting WebAssembly
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Clang version: 17.0.0
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
-- Looking for include file sys/inotify.h
-- Looking for include file sys/inotify.h - found
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- Failed to find LLVM FileCheck
-- git version: v0.0.0 normalized to 0.0.0
-- Version: 1.6.0
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done (18.4s)
-- Generating done (3.9s)
-- Build files have been written to: /workspaces/llvm-box/build/llvm-native
[180/257] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o
In file included from /workspaces/llvm-box/llvm/utils/TableGen/CodeGenRegisters.h:26,
                 from /workspaces/llvm-box/llvm/utils/TableGen/CodeGenRegisters.cpp:14:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h: In member function ‘unsigned int llvm::CodeGenRegister::getWeight(const llvm::CodeGenRegBank&) const’:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement<128>::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h: In function ‘bool normalizeWeight(llvm::CodeGenRegister*, std::vector<{anonymous}::UberRegSet>&, std::vector<{anonymous}::UberRegSet*>&, llvm::BitVector&, llvm::CodeGenRegister::RegUnitList&, llvm::CodeGenRegBank&)’:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement<128>::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h: In member function ‘void llvm::CodeGenRegisterClass::buildRegUnitSet(const llvm::CodeGenRegBank&, std::vector<unsigned int, std::allocator<unsigned int> >&) const’:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement<128>::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
[213/257] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterInfoEmitter.cpp.o
In file included from /workspaces/llvm-box/llvm/utils/TableGen/CodeGenRegisters.h:26,
                 from /workspaces/llvm-box/llvm/utils/TableGen/RegisterInfoEmitter.cpp:16:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h: In member function ‘void llvm::SparseBitVector<ElementSize>::SparseBitVectorIterator::AdvanceToFirstNonZero() [with unsigned int ElementSize = 128]’:
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/workspaces/llvm-box/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement<128>::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
[257/257] Linking CXX executable bin/clang-tblgen
configure: cmake -G Ninja -S llvm -B build/llvm-wasm -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=WebAssembly -DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra -DLLVM_ENABLE_DUMP=OFF -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF -DLLVM_ENABLE_BACKTRACES=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_TABLEGEN=build/llvm-native/bin/llvm-tblgen -DCLANG_TABLEGEN=build/llvm-native/bin/clang-tblgen -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-bulk-memory;--experimental-wasm-threads
-- The ASM compiler identification is unknown
-- Found assembler: /usr/local/emsdk/upstream/emscripten/emcc
-- Warning: Did not find file Compiler/-ASM
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is enabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found Python3: /usr/bin/python3.9 (found suitable version "3.9.2", minimum required is "3.0") found components: Interpreter 
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Failed
CMake Error at cmake/modules/CheckCompilerVersion.cmake:88 (message):
  libstdc++ version must be at least 7.1.
Call Stack (most recent call first):
  cmake/config-ix.cmake:15 (include)
  CMakeLists.txt:857 (include)


-- Configuring incomplete, errors occurred!
emcmake: error: 'cmake -G Ninja -S llvm -B build/llvm-wasm -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=WebAssembly -DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra -DLLVM_ENABLE_DUMP=OFF -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF -DLLVM_ENABLE_BACKTRACES=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_TABLEGEN=build/llvm-native/bin/llvm-tblgen -DCLANG_TABLEGEN=build/llvm-native/bin/clang-tblgen -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-bulk-memory;--experimental-wasm-threads' failed (returned 1)

So, what do I do? I paste the error into ChatGPT and ask it to tell me more about what went wrong, of course! https://sharegpt.com/c/IR1eZ1H

The error message is indicating that there is a problem with the version of the C++ standard library being used. Specifically, it states that the version of libstdc++ being used is less than 7.1, which is not sufficient for the build process.

This error is likely to occur during the build process of an application that requires a newer version of the C++ standard library than what is currently installed on the system. In this case, it is preventing the successful configuration of the project and causing the build to fail.

To resolve this issue, the user may need to update the C++ standard library to a version that is compatible with the project's requirements or modify the project's configuration to use a different version of the library. Another possible solution is to modify the code to remove any dependencies on features that require a newer version of the library.

@jprendes I think you're wayyyyyyy more well versed in C++ world than I am. Any ideas? (you can ignore this if you don't want to get involved with my debugging; that's OK too)

If I were to guess, I'd say that my GitHub Codespaces (the env where I'm working) is using some kind of outdated apt repo or Ubuntu install?

@jcbhmr ➜ /workspaces/llvm-box (main) $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

@jcbhmr ➜ /workspaces/llvm-box (main) $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

@jcbhmr ➜ /workspaces/llvm-box (main) $ uname -r
5.4.0-1103-azure

And I think Debian 11 (bullseye) is pretty recent...

image

Hmm...

What if I do (below) like ChatGPT suggests in another thread? https://sharegpt.com/c/IisVeFy

@jcbhmr ➜ /workspaces/llvm-box (main) $ sudo apt-get install libstdc++-7-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package libstdc++-7-dev
E: Couldn't find any package by regex 'libstdc++-7-dev'

OHHH BUT WAIT! What if I first run sudo apt update? Would that fix it?

@jcbhmr ➜ /workspaces/llvm-box (main) $ sudo apt update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]         
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8,183 kB]
Get:6 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [229 kB]
Get:7 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Get:8 https://dl.yarnpkg.com/debian stable/main all Packages [10.9 kB]
Get:9 https://dl.yarnpkg.com/debian stable/main amd64 Packages [10.9 kB]
Fetched 8,674 kB in 2s (5,649 kB/s)                         
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
@jcbhmr ➜ /workspaces/llvm-box (main) $ sudo apt-get install libstdc++-7-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package libstdc++-7-dev
E: Couldn't find any package by regex 'libstdc++-7-dev'

Nope. 😢

I will post updates as I debug this

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

For posterity, here's my gcc and clang versions:

@jcbhmr ➜ /workspaces/llvm-box (main) $ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@jcbhmr ➜ /workspaces/llvm-box (main) $ clang --version
clang version 17.0.0 (https://github.com/llvm/llvm-project df82394e7a2d06506718cafa347bf7827c79fc4f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/emsdk/upstream/bin

I note that GCC seems to be a bit outdated? v10 vs v12 current if I read it right

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

For more posterity, here's what my Codespaces /usr/lib and friends (I think they're friends?) look like:

@jcbhmr ➜ /workspaces/llvm-box (main) $ ls /usr/
bin  games  include  lib  lib32  libexec  local  sbin  share  src

@jcbhmr ➜ /workspaces/llvm-box (main) $ ls /usr/lib
apt          binfmt-support  cmake      debug  emacsen-common  git-core  gnupg2   groff    locale  mime     os-release  pkg-config.multiarch  python3    sasl2  sudo      systemd  tmpfiles.d  valgrind
bfd-plugins  clang           compat-ld  dpkg   gcc             gnupg     gold-ld  llvm-11  man-db  openssh  pkgconfig   python2.7             python3.9  ssl    sysctl.d  tc       udev        x86_64-linux-gnu

@jcbhmr ➜ /workspaces/llvm-box (main) $ ls /usr/local/lib
python3.9

@jcbhmr ➜ /workspaces/llvm-box (main) $ ls /usr/lib32
gconv  libgcc_s.so.1  libstdc++.so.6  libstdc++.so.6.0.28

@jcbhmr ➜ /workspaces/llvm-box (main) $ ls /usr/lib/x86_64-linux-gnu | grep c++
libmpdec++.so.2.5.1
libmpdec++.so.3
libstdc++.so.6
libstdc++.so.6.0.28

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

I'll try reverting to the "known good commit" referenced in the original

https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/build-llvm.sh#L27-L29

    # This is the last tested commit of llvm-project.
    # Feel free to try with a newer version
    git reset --hard d5a963ab8b40fcf7a99acd834e5f10a1a30cc2e5

See if that works? I made a new branch origin/last-tested or https://github.com/jcbhmr/llvm-box/tree/d5a963ab8b40fcf7a99acd834e5f10a1a30cc2e5

It's from Oct 27, 2022 so not that old

Testing now...

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Same error 😡

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Maybe I need to run it in the Docker container just like "build-with-docker.sh" does in the original?

https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/build-with-docker.sh#L14-L22

docker run \
    -it --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $(pwd):$(pwd) \
    -v $(pwd)/build/emsdk_cache:/emsdk/upstream/emscripten/cache \
    -u $(id -u):$(id -g) \
    $(id -G | tr ' ' '\n' | xargs -I{} echo --group-add {}) \
    emception_build:latest \
    bash -c "cd $(pwd) && ./build.sh"

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Still fails... 😡 But for a different reason... 🤔

@jcbhmr ➜ /workspaces/llvm-box (last-tested) $ ./build-with-docker.sh 
/workspaces/llvm-box/docker /workspaces/llvm-box
[+] Building 1.1s (7/7) FINISHED                                                                                                                                                                                                                                                                                      
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                0.4s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                  0.1s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                             0.5s
 => => transferring dockerfile: 774B                                                                                                                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/emscripten/emsdk:3.1.24                                                                                                                                                                                                                                               0.4s
 => [1/3] FROM docker.io/emscripten/emsdk:3.1.24@sha256:41a295159bab31f36261e6f3616dc44efc1207bc396e488a30530e40085d8cfe                                                                                                                                                                                         0.0s
 => CACHED [2/3] RUN DEBIAN_FRONTEND=noninteractive apt --no-install-recommends -qy update &&     DEBIAN_FRONTEND=noninteractive apt --no-install-recommends -qy install     docker.io     pkg-config     ninja-build     jq     brotli     autoconf     autoconf-archive     automake     zlib1g-dev            0.0s
 => CACHED [3/3] RUN mkdir -p /.npm && chmod a+rwx /.npm                                                                                                                                                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                                                                                                                                           0.2s
 => => exporting layers                                                                                                                                                                                                                                                                                          0.0s
 => => writing image sha256:d1e9367d0fcb80cd060ac10d1126b1ac9aa4469d23b5bc6abb9d5e76c493e938                                                                                                                                                                                                                     0.0s
 => => naming to docker.io/library/emception_build                                                                                                                                                                                                                                                               0.0s
/workspaces/llvm-box
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Native target X86 is not selected; lli will not JIT code
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.10.0
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Building with -fPIC
-- Targeting WebAssembly
-- Clang version: 16.0.0
-- Not building amdgpu-arch: hsa-runtime64 not found
-- Registering Bye as a pass plugin (static build: OFF)
-- Failed to find LLVM FileCheck
-- git version: v0.0.0 normalized to 0.0.0
-- Version: 1.6.0
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/llvm-box/build/llvm-native
ninja: error: '/usr/lib/x86_64-linux-gnu/libtinfo.so', needed by 'bin/llvm-tblgen', missing and no known rule to make it

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

@jprendes
Copy link

jprendes commented Mar 4, 2023

What emscripten version are you running in your original environ?

As for the new error, it sounds like you are trying to use the tblgen built in the original environment inside the container. You should build tblgen inside the container as well to ensure all the host library dependencies are correct.

As a first step, check the emscripten version. It looks like you might be using the version in the ubuntu repositories. Try installing a recent version following the instructions in the emscripten website.

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

/re @jprendes

What emscripten version are you running in your original environ?

In my Codespaces devcontainer, this feature https://github.com/ebaskoro/devcontainer-features/tree/main/src/emscripten installed emscripten v3.1.32 which is newer than the one used in the Docker container which was emscripten/emsdk:3.1.24

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.32 (eab98adf462c39f3c31d348331c4830bcaa36949)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As for the new error, it sounds like you are trying to use the tblgen built in the original environment inside the container. You should build tblgen inside the container as well to ensure all the host library dependencies are correct.

I'll do that and report back (sorry if I keep pinging you with updates; I noticed you "watch"-ed this repo 😜 you can un-watch if you don't want to listen to my mini-blog issue log)

As a first step, check the emscripten version. It looks like you might be using the version in the ubuntu repositories. Try installing a recent version following the instructions in the emscripten website.

Sounds good! I think I am on a pretty latest version https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md but it is different in the Dockerfile that I'm trying from the https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/docker/Dockerfile

# This is the last tested version of emscripten.
# Feel free to try with a newer version
FROM emscripten/emsdk:3.1.24

RUN DEBIAN_FRONTEND=noninteractive apt --no-install-recommends -qy update && \
    DEBIAN_FRONTEND=noninteractive apt --no-install-recommends -qy install \
    docker.io \
    pkg-config \
    ninja-build \
    jq \
    brotli \
    autoconf \
    autoconf-archive \
    automake \
    zlib1g-dev

# Add to PATH the clang version that ships with emsdk
ENV PATH="${EMSDK}/upstream/bin:${PATH}"

# When running the contianer with a custom user/group, we need to provide that user with
# access to ~/.npm (in this case, /.npm).
# The easiest is to give access to everyone.
RUN mkdir -p /.npm && chmod a+rwx /.npm

@jprendes
Copy link

jprendes commented Mar 4, 2023

Could be that something changes in either llvm or emscripten that causes the error. I can try look into it tomorrow.

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

/re @jprendes

Could be that something changes in either llvm or emscripten that causes the error. I can try look into it tomorrow.

Thanks! Don't feel obligated to do so if its too much work. I'm sure I'll figure it out. I can always ask on StackOverflow or Reddit or something.

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

I got farther! I did rm -rf build then rebuilt it to avoid the cross-interference of local build files vs in-docker build files (since it's mounted to $(pwd)) then it got pretty far!

Run Build Command(s):/usr/bin/ninja cmTC_8f8ee && [1/2] Building CXX object CMakeFiles/cmTC_8f8ee.dir/src.cxx.o
cache:INFO: generating system headers: sysroot_install.stamp... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot_install.stamp" for subsequent builds)
cache:INFO:  - ok
[2/2] Linking CXX executable cmTC_8f8ee.js
FAILED: cmTC_8f8ee.js 
: && /emsdk/upstream/emscripten/em++  -Dwait4=__syscall_wait4 -DLLVM_LIBSTDCXX_MIN  -std=c++0x -O3 -DNDEBUG  -s LLD_REPORT_UNDEFINED=1     -s ALLOW_MEMORY_GROWTH=1     -s EXPORTED_FUNCTIONS=_main,_free,_malloc     -s EXPORTED_RUNTIME_METHODS=FS,PROXYFS,ERRNO_CODES,allocateUTF8     -lproxyfs.js     --js-library=/emlib/fsroot.js CMakeFiles/cmTC_8f8ee.dir/src.cxx.o  -o cmTC_8f8ee.js   && :
em++: error: '--js-library=/emlib/fsroot.js': file not found: '/emlib/fsroot.js'
ninja: build stopped: subcommand failed.

That's the new error-to-beat

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

I think I solved it! Maybe. I found the root cause though by

  1. Running it in Dockerfile mode (use the build-with-docker.sh)
  2. That when it errored in a different? Same? Something, whatever; when it errored it referenced a new file that I didn't know existed: build/llvm-wasm/CMakeFiles/CMakeError.log
  3. That then pointed me to the error: em++: error: '--js-library=/emlib/fsroot.js': file not found: '/emlib/fsroot.js'
  4. That seemed to originate from the emception project which prompted me to look at the build command...
  5. Which led me to this dumb mistake:

image

Note that $SRC in there? That var I deleted. It's now pointing to /emlib/fsroot.js instead of ./emlib/fsroot.js 🤦‍♂️

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

So yeah I need to add this file: https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/emlib/fsroot.js and in theory that MAY solve it?

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

To standardize the version of LLVM that we work with, I think we should use the latest version tag from LLVM and try to stay in sync with it... Key is try.

Currently, that's 8dfdcc7 from llvm@8dfdcc7 https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.7

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

btw this was the key to me figuring out that the cmakeerror.log existed:

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Getting farther! Fixing that fsroot.js issue went a long way! In the docker container, I got past the libstdc++ v7 check or whatever, so now I'm waiting 20min+ to see if it builds

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

🎉 Something happened!

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Now we'll see if I can replicate that success in the main branch...

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

main is now at https://github.com/llvm/llvm-project/tree/release/15.x and then we can extend from there

at the time, that's https://github.com/llvm/llvm-project/tree/llvmorg-15.0.7

v15.0.7

that's the current testing target for LLVM stuff

@jcbhmr jcbhmr linked a pull request Mar 4, 2023 that will close this issue
@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 4, 2023

Success on building it with v15.0.7!

image

@jprendes you don't need to debug it anymore, just go to https://github.com/jcbhmr/llvm-box/tree/2f4745b31ed17a08815f570c1fb32737cfbeac4d and click Code -> Codespaces -> new codespace on get-it-working. Hopefully it works for you too! 🎉

image

As you can tell I'm very happy 😊 that I got it working.


BUT there's still more to do. That's only up to the cmake part of the second build part. There's the actual invoking of the cmake generated Ninja script that still needs to pass...

https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/build-llvm.sh#L75-L96

    # Make sure we build js modules (.mjs).
    # The patch-ninja.sh script assumes that.
    sed -i -E 's/\.js/.mjs/g' $LLVM_BUILD/build.ninja

    # The mjs patching is over zealous, and patches some source JS files rather than just output files.
    # Undo that.
    sed -i -E 's/(pre|post|proxyfs|fsroot)\.mjs/\1.js/g' $LLVM_BUILD/build.ninja

    # Patch the build script to add the "llvm-box" target.
    # This new target bundles many executables in one, reducing the total size.
    pushd $SRC
    TMP_FILE=$(mktemp)
    ./patch-ninja.sh \
        $LLVM_BUILD/build.ninja \
        llvm-box \
        $BUILD/tooling \
        clang lld llvm-nm llvm-ar llvm-objcopy llc \
        > $TMP_FILE
    cat $TMP_FILE >> $LLVM_BUILD/build.ninja
    popd
fi
cmake --build $LLVM_BUILD/ -- llvm-box

namely with https://github.com/jprendes/emception/blob/366065547b1a59cb58011ed19aedce70c3bcbd2b/patch-ninja.sh stuff

@jprendes
Copy link

jprendes commented Mar 4, 2023

If you run it at this point without that patch, you should get clang.js-15 (for some reason the version is AFTER the extension...), lld.js, and friends (whatever you may have enabled with LLVM_ENABLE_PROJECTS)

@jcbhmr
Copy link
Member Author

jcbhmr commented Mar 10, 2023

Thanks @conartist6 for the idea of posting literally everything to issue logs. 🙏 I just reread all this today and thank goodness I wrote it all down or I'd have forgotten what I did and how I solved it. Thanks for your inspiration! ♥️

TODO: solve the ninja patch script thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants