Skip to content

Lua and FreeType submodule#3195

Merged
illwieckz merged 3 commits intomasterfrom
illwieckz/submodules/sync
Jan 6, 2025
Merged

Lua and FreeType submodule#3195
illwieckz merged 3 commits intomasterfrom
illwieckz/submodules/sync

Conversation

@illwieckz
Copy link
Member

@illwieckz illwieckz commented Nov 18, 2024

It is written against the Saigo branch:

Requires:

There is no submodule yet, one has to clone:

  • https://github.com/lua/lua as libs/lua
  • https://gitlab.freedesktop.org/freetype/freetype.git as daemon/libs/freetype

It works with dll, exe and nexe (PNaCl). Saigo is not tested yet.

When USE_SYSTEM_LIBS is set to ON, system libraries are used instead of submodules for native builds (engine, dll or exe game).

See this issue for the motivation behind it:

@illwieckz illwieckz marked this pull request as draft November 18, 2024 21:11
@illwieckz
Copy link
Member Author

It now works with dll cgame.

@illwieckz
Copy link
Member Author

With this Lua patch, PNaCl can also build the nexe:

diff --git a/luaconf.h b/luaconf.h
index 33bb580d..a30e6314 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -122,7 +122,9 @@
 /*
 @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
 */
+#if !defined(LUA_32BITS)
 #define LUA_32BITS	0
+#endif
 
 
 /*

@illwieckz illwieckz changed the title WIP: lua submodule WIP: lua and freetype submodule Nov 19, 2024
@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch 2 times, most recently from 90789c2 to e9af38b Compare November 19, 2024 01:16
@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

Everything works with PNaCl, but I get Saigo crashing when building Lua for the amd64 nexe:

make: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[1]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
[ 11%] Built target src-sgame-entities.yaml
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
[ 22%] Performing build step for 'nacl-vms-amd64'
make[3]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[4]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
[ 38%] Built target srclibs-rmlui
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
[ 39%] Building C object CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj
fatal error: error in backend: Cannot select: t15: ch = brind t7, t14
  t14: i32,ch = load<(invariant load (s32) from %ir.indirect.goto.dest.in)> t0, t13, undef:i32, Unvanquished/libs/lua/lvm.c:0
    t13: i32 = add t18, t12, Unvanquished/libs/lua/lvm.c:0
      t18: i32 = X86ISD::WrapperRIP TargetGlobalAddress:i32<ptr @luaV_execute.disptab> 0, Unvanquished/libs/lua/lvm.c:0
        t17: i32 = TargetGlobalAddress<ptr @luaV_execute.disptab> 0, Unvanquished/libs/lua/lvm.c:0
      t12: i32 = shl t9, Constant:i8<2>, Unvanquished/libs/lua/lvm.c:0
        t9: i32 = and t5, Constant:i32<127>, Unvanquished/libs/lua/lvm.c:0
          t5: i32,ch = load<(load (s32) from %ir.i.0.in)> t0, t2, undef:i32, Unvanquished/libs/lua/lvm.c:0
            t2: i32,ch = CopyFromReg t0, Register:i32 %1072, Unvanquished/libs/lua/lvm.c:0
              t1: i32 = Register %1072
            t4: i32 = undef
          t8: i32 = Constant<127>
        t16: i8 = Constant<2>
    t4: i32 = undef
In function: luaV_execute
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang -DARCH_STRING=nacl -DDAEMON_ARCH_nacl -DDAEMON_BUILD_RelWithDebInfo -DDAEMON_USE_ARCH_INTRINSICS=1 -DDAEMON_USE_ARCH_INTRINSICS_nacl=1 -DDAEMON_USE_COMPILER_CUSTOMIZATION=1 -DDAEMON_USE_COMPILER_INTRINSICS=1 -DGLM_FORCE_EXPLICIT_CTOR -DLUA_32BITS=1 -DNACL_ARCH_STRING=nacl -DNACL_BUILD_ARCH=x86 -DNACL_BUILD_SUBARCH=64 -DRC_MAX_LAYERS_DEF=63 -DRC_MAX_NEIS_DEF=16 -DTHIS_IS_NOT_A_DEBUG_BUILD @CMakeFiles/srclibs-lua.dir/includes_C.rsp -std=gnu89 -ffast-math -fvisibility=hidden -fno-strict-aliasing -pthread -fno-strict-overflow -Wstack-protector -fPIE -O2 -g -DNDEBUG -g3 -D_FORTIFY_SOURCE=2 -MD -MT CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -MF CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj.d -o CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -c Unvanquished/libs/lua/lvm.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'Unvanquished/libs/lua/lvm.c'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@luaV_execute'
 #0 0x00007b90531c78b7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c78b7)
 #1 0x00007b90531c540e llvm::sys::RunSignalHandlers() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c540e)
 #2 0x00007b90531c6c73 llvm::sys::CleanupOnSignal(unsigned long) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c6c73)
 #3 0x00007b90531048d8 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #4 0x00007b905310486f llvm::CrashRecoveryContext::HandleExit(int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x210486f)
 #5 0x00007b90531c1747 llvm::sys::Process::Exit(int, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c1747)
 #6 0x000063a55c0026c2 (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x146c2)
 #7 0x00007b9053116fc6 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2116fc6)
 #8 0x00007b9053d30189 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d30189)
 #9 0x00007b9053d2f0f9 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d2f0f9)
#10 0x00007b90558d93ad (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#11 0x00007b9053d2435f llvm::SelectionDAGISel::DoInstructionSelection() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d2435f)
#12 0x00007b9053d23320 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d23320)
#13 0x00007b9053d20cb3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d20cb3)
#14 0x00007b9053d1e064 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d1e064)
#15 0x00007b9053d1b976 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d1b976)
#16 0x00007b90536ee681 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x26ee681)
#17 0x00007b905338273b llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x238273b)
#18 0x00007b905338ab51 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x238ab51)
#19 0x00007b9053383205 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2383205)
#20 0x00007b90598600b3 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x32600b3)
#21 0x00007b9059cb669b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x36b669b)
#22 0x00007b9058248587 clang::ParseAST(clang::Sema&, bool, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x1c48587)
#23 0x00007b905a9fa860 clang::FrontendAction::Execute() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x43fa860)
#24 0x00007b905a9678bf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x43678bf)
#25 0x00007b905aa91f5c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x4491f5c)
#26 0x000063a55c0021dc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x141dc)
#27 0x000063a55bffec8d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x00007b905a52b499 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#29 0x00007b905310480d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x210480d)
#30 0x00007b905a52ab9f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3f2ab9f)
#31 0x00007b905a4e34bf clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3ee34bf)
#32 0x00007b905a4e3777 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3ee3777)
#33 0x00007b905a5058d7 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3f058d7)
#34 0x000063a55bffe1b1 clang_main(int, char**, llvm::ToolContext const&) (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x101b1)
#35 0x000063a55c00ec77 main (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x20c77)
#36 0x00007b9050c2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#37 0x00007b9050c2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#38 0x000063a55bffc5fa _start (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0xe5fa)
x86_64-nacl-clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.0.0git (https://chromium.googlesource.com/a/native_client/nacl-llvm-project-v10.git e25355fddbdece2ef08747ead05b7f69f3bc6dca)
Target: x86_64-unknown-nacl
Thread model: posix
InstalledDir: /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin
Build config: +assertions
x86_64-nacl-clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
x86_64-nacl-clang: note: diagnostic msg: /tmp/lvm-a3572e.c
x86_64-nacl-clang: note: diagnostic msg: /tmp/lvm-a3572e.sh
x86_64-nacl-clang: note: diagnostic msg: 

********************
make[5]: *** [CMakeFiles/srclibs-lua.dir/build.make:527: CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj] Error 1
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[4]: *** [CMakeFiles/Makefile2:161: CMakeFiles/srclibs-lua.dir/all] Error 2
make[4]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[3]: *** [Makefile:156: all] Error 2
make[3]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-amd64'
make[2]: *** [CMakeFiles/nacl-vms-amd64.dir/build.make:86: nacl-vms-amd64-prefix/src/nacl-vms-amd64-stamp/nacl-vms-amd64-build] Error 2
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/nacl-vms-amd64.dir/all] Error 2
make[1]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make: *** [Makefile:91: all] Error 2
make: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'

@illwieckz
Copy link
Member Author

When building Lua for the i686 nexe with Saigo, the error message is more meaningful:

make: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[1]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
[ 11%] Built target src-sgame-entities.yaml
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[2]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
[ 22%] Performing build step for 'nacl-vms-i686'
make[3]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[4]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
[ 38%] Built target srclibs-rmlui
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[5]: Entering directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
[ 39%] Building C object CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj
error: Not enough scratch registers when expanding indirect jump.
1 error generated.
make[5]: *** [CMakeFiles/srclibs-lua.dir/build.make:527: CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj] Error 1
make[5]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[4]: *** [CMakeFiles/Makefile2:161: CMakeFiles/srclibs-lua.dir/all] Error 2
make[4]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[3]: *** [Makefile:156: all] Error 2
make[3]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl-vms-i686'
make[2]: *** [CMakeFiles/nacl-vms-i686.dir/build.make:86: nacl-vms-i686-prefix/src/nacl-vms-i686-stamp/nacl-vms-i686-build] Error 2
make[2]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/nacl-vms-i686.dir/all] Error 2
make[1]: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'
make: *** [Makefile:91: all] Error 2
make: Leaving directory 'build/game/default-linux-amd64-nacl-nolto-reldeb-nexe'

@slipher
Copy link
Contributor

slipher commented Nov 19, 2024

Everything works with PNaCl, but I get Saigo crashing when building Lua for the amd64 nexe:

You have -fPIE in there. I thought you were going to disable that?

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from e9af38b to c066b6d Compare November 19, 2024 01:58
@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

Right, this should be disabled, some other commits from master brought it back.

Anyway with this command line I get the crash as well:

build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang -DARCH_STRING=nacl -DDAEMON_ARCH_nacl -DDAEMON_BUILD_Debug -DDAEMON_USE_ARCH_INTRINSICS=1 -DDAEMON_USE_ARCH_INTRINSICS_nacl=1 -DDAEMON_USE_COMPILER_CUSTOMIZATION=1 -DDAEMON_USE_COMPILER_INTRINSICS=1 -DDEBUG_BUILD -DGLM_FORCE_EXPLICIT_CTOR -DLUA_32BITS=1 -DNACL_ARCH_STRING=nacl -DNACL_BUILD_ARCH=x86 -DNACL_BUILD_SUBARCH=64 -DRC_MAX_LAYERS_DEF=63 -DRC_MAX_NEIS_DEF=16 @CMakeFiles/srclibs-lua.dir/includes_C.rsp -std=gnu89 -ffast-math -fvisibility=hidden -fno-strict-aliasing -pthread -g -g3 -MD -MT CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -MF CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj.d -o CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -c Unvanquished/libs/lua/lvm.c

@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

Actually I got this kind of error in the past, with either cgame or sgame, I don't remember what fixed it, maybe that was that PIE thing, but removing it doesn't fix Lua.

@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

Just doing that crashes Saigo:

cd nacl-vms-amd64; build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang -v -o CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -c ../../../../Unvanquished/libs/lua/lvm.c

@illwieckz
Copy link
Member Author

Here is the output:

clang version 19.0.0git (https://chromium.googlesource.com/a/native_client/nacl-llvm-project-v10.git e25355fddbdece2ef08747ead05b7f69f3bc6dca)
Target: x86_64-unknown-nacl
Thread model: posix
InstalledDir: /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin
Build config: +assertions
 (in-process)
 "/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/clang-19" -cc1 -triple x86_64-unknown-nacl -emit-obj -mrelax-relocations=no -disable-free -clear-ast-before-backend -main-file-name lvm.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -fno-jump-tables -fno-optimize-sibling-calls -target-cpu x86-64 -tune-cpu generic -mllvm -align-all-functions=5 -mllvm -x86-disallow-bt=true -debugger-tuning=gdb -fdebug-compilation-dir=build/game/default-linux-amd64-nacl-nolto-debug-nexe/nacl-vms-amd64 -v -fcoverage-compilation-dir=build/game/default-linux-amd64-nacl-nolto-debug-nexe/nacl-vms-amd64 -resource-dir /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/lib/clang/19 -internal-isystem /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/lib/clang/19/include -internal-isystem /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../x86_64-nacl/usr/include -internal-isystem /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../x86_64-nacl/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -x c ../../../../Unvanquished/libs/lua/lvm.c
clang -cc1 version 19.0.0git based upon LLVM 19.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../x86_64-nacl/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/lib/clang/19/include
 /home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../x86_64-nacl/include
End of search list.
fatal error: error in backend: Cannot select: t3: ch = brind t0, t2
  t2: i32,ch = CopyFromReg t0, Register:i32 %113
    t1: i32 = Register %113
In function: luaV_execute
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang -v -o CMakeFiles/srclibs-lua.dir/libs/lua/lvm.c.obj -c ../../../../Unvanquished/libs/lua/lvm.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '../../../../Unvanquished/libs/lua/lvm.c'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@luaV_execute'
 #0 0x00007892febc78b7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c78b7)
 #1 0x00007892febc540e llvm::sys::RunSignalHandlers() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c540e)
 #2 0x00007892febc6c73 llvm::sys::CleanupOnSignal(unsigned long) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c6c73)
 #3 0x00007892feb048d8 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #4 0x00007892feb0486f llvm::CrashRecoveryContext::HandleExit(int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x210486f)
 #5 0x00007892febc1747 llvm::sys::Process::Exit(int, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x21c1747)
 #6 0x0000614f0b2a26c2 (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x146c2)
 #7 0x00007892feb16fc6 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2116fc6)
 #8 0x00007892ff730189 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d30189)
 #9 0x00007892ff72f0f9 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d2f0f9)
#10 0x00007893012d93ad (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#11 0x00007892ff72435f llvm::SelectionDAGISel::DoInstructionSelection() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d2435f)
#12 0x00007892ff723320 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d23320)
#13 0x00007892ff720cb3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d20cb3)
#14 0x00007892ff71e064 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d1e064)
#15 0x00007892ff71b976 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2d1b976)
#16 0x00007892ff0ee681 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x26ee681)
#17 0x00007892fed8273b llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x238273b)
#18 0x00007892fed8ab51 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x238ab51)
#19 0x00007892fed83205 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x2383205)
#20 0x00007893052600b3 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x32600b3)
#21 0x00007893056b669b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x36b669b)
#22 0x0000789303c48587 clang::ParseAST(clang::Sema&, bool, bool) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x1c48587)
#23 0x00007893063fa860 clang::FrontendAction::Execute() (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x43fa860)
#24 0x00007893063678bf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x43678bf)
#25 0x0000789306491f5c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x4491f5c)
#26 0x0000614f0b2a21dc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x141dc)
#27 0x0000614f0b29ec8d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000789305f2b499 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#29 0x00007892feb0480d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM.so.19.0git+0x210480d)
#30 0x0000789305f2ab9f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3f2ab9f)
#31 0x0000789305ee34bf clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3ee34bf)
#32 0x0000789305ee3777 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3ee3777)
#33 0x0000789305f058d7 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/illwieckz/dev/native_client/workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.19.0git+0x3f058d7)
#34 0x0000614f0b29e1b1 clang_main(int, char**, llvm::ToolContext const&) (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x101b1)
#35 0x0000614f0b2aec77 main (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0x20c77)
#36 0x00007892fc62a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#37 0x00007892fc62a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#38 0x0000614f0b29c5fa _start (build/deps/linux-amd64-default_10/saigo_newlib/bin/x86_64-nacl-clang+0xe5fa)

@illwieckz
Copy link
Member Author

I had to use LUA_USE_JUMPTABLE=0, now Lua and the whole cgame builds and links with Saigo, but I don't get it running:

Loading VM module cgame-amd64.nexe... 
Using loader args:  build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl_helper_bootstrap build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/nacl_loader --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -v -B build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/irt_core-amd64.nexe -e -i 100:58 -- build/game/default-linux-amd64-nacl-nolto-reldeb-nexe/cgame-amd64.nexe 100 
][Detaching after vfork from child process 1803269]
Loaded cgame VM module in 87 msec 
Loading Lua plugin using a new Lua state. 
Loaded font face 'unifont' [regular] from 'fonts/unifont.ttf'. 
Loaded font face 'Roboto' [bold] from 'fonts/Roboto-Bold.ttf'. 
Loaded font face 'Roboto' [italic, bold] from 'fonts/Roboto-BoldItalic.ttf'. 
Loaded font face 'Roboto' [italic] from 'fonts/Roboto-Italic.ttf'. 
Loaded font face 'Roboto' [regular] from 'fonts/Roboto-Regular.ttf'. 
Loaded font face 'FontAwesome' [regular] from 'fonts/fontawesome-webfont.ttf'. 
Loaded font face 'DejaVu Sans' [regular] from 'fonts/DejaVuSansCondensed.ttf'. 
Loaded font face 'Material Icons' [regular] from 'fonts/MaterialIcons-Regular.ttf'. 
Warn: Error during initialization: IPC: Timed out while waiting for VM message 

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch 2 times, most recently from 623d1ed to 6e8af57 Compare November 19, 2024 03:02
@illwieckz
Copy link
Member Author

@slipher do you know how to extend that timeout? It is very annoying. Maybe it works but something is slower…

@illwieckz
Copy link
Member Author

Hmm, maybe that's rootChannel.SetRecvTimeout(std::chrono::seconds(2)) in VirtualMachine.cpp, but setting it to 10 doesn't fix it. Maybe we hit some infinite loop with Saigo build? How to know what is the code currently running when such timeout occurs?

@illwieckz
Copy link
Member Author

After spamming some logs, it looks like the loop in CG_Rocket_Init to parse rocket.txt in cg_rocket.cpp never breaks.

@illwieckz
Copy link
Member Author

Rocket_LoadDocument( "ui/options_ui.rml" ); never returns in misc parser:

Rocket_LoadDocument( token );

@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

In rocket_documents.cpp when calling Rocket_LoadDocument() it is stuck when doing menuContext->LoadDocument().

@illwieckz
Copy link
Member Author

The ui/options_ui.rml file has a Lua script and some on* calls, deleting then doesn't fix it, so that's not because of some Lua bug in that.

@illwieckz
Copy link
Member Author

In libs/RmlUi/Source/Core/Context.cpp, function Context::LoadDocument(Stream* stream), it is stuck at ElementPtr element = Factory::InstanceDocumentStream(this, stream, GetDocumentsBaseTag()); line.

@illwieckz
Copy link
Member Author

It is stuck in Factory::InstanceDocumentStream(), not in GetDocumentsBaseTag().

@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

In libs/RmlUi/Source/Core/Factory.cpp, function Factory::InstanceDocumentStream(), it is stuck in parser.Parse(stream); line (parser is an XMLParser object).

@illwieckz
Copy link
Member Author

In libs/RmlUi/Source/Core/BaseXMLParser.cpp, function BaseXMLParser::Parse(), the code is fully executed, but the function never returns. This very weird. I added a logger after the source_url = nullptr; line (the last one of the block), and it is executed, but the function never return.

@illwieckz
Copy link
Member Author

illwieckz commented Nov 19, 2024

I did that:

In src/cgame/cg_rocket.cpp I added loggers to CG_Rocket_Init() this way:

		if ( !Q_stricmp( token, "misc" ) )
		{
			token = COM_Parse2( &text_p );

			if ( *token != '{' )
			{
				Sys::Drop( "Error parsing %s. Expecting \"{\" but found \"%c\".", rocket_menuFile.Get(), *token );
			}

			while ( 1 )
			{
				Log::Warn("iterating misc loop");
				token = COM_Parse2( &text_p );

				if ( *token == '}' )
				{
					break;
				}

				if ( !*token )
				{
					Sys::Drop( "Error parsing %s. Unexpected end of file. Expecting closing '}'.", rocket_menuFile.Get() );
				}

				// Skip non-RML files
				if ( Q_stricmp( token + strlen( token ) - 4, ".rml" ) )
				{
					Log::Warn( "Non-RML file listed in %s: \"%s\" . Skipping.", rocket_menuFile.Get(), token );
					continue;
				}

				Log::Warn("Load misc document: %s", token);
				Rocket_LoadDocument( token );
				Log::Warn("Loaded misc document: %s", token);
			}

			continue;
		}

In libs/RmlUi/Source/Core/Factory.cpp I added loggers this way:

// Instances a element tree based on the stream
ElementPtr Factory::InstanceDocumentStream(Context* context, Stream* stream, const String& document_base_tag)
{
	RMLUI_ZoneScoped;

	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 0");

	ElementPtr element = Factory::InstanceElement(nullptr, document_base_tag, document_base_tag, XMLAttributes());
	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 1");
	if (!element)
	{
		Log::Message(Log::LT_ERROR, "Failed to instance document, instancer returned nullptr.");
		return nullptr;
	}

	ElementDocument* document = rmlui_dynamic_cast< ElementDocument* >(element.get());
	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 2");
	if (!document)
	{
		Log::Message(Log::LT_ERROR, "Failed to instance document element. Found type '%s', was expecting derivative of ElementDocument.", rmlui_type_name(*element));
		return nullptr;
	}

	document->context = context;

	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 3");
	XMLParser parser(element.get());
	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 4");
	parser.Parse(stream);
	Log::Message(Log::LT_INFO, "Factory::InstanceDocumentStream 5");

	return element;
}

In libs/RmlUi/Source/Core/BaseXMLParser.cpp I added loggers this way, and even added an extraneous return at the end, just to be explicit:

// Parses the given stream as an XML file, and calls the handlers when
// interesting phenomenon are encountered.
void BaseXMLParser::Parse(Stream* stream)
{
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 0");
	source_url = &stream->GetSourceURL();

	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 1");
	xml_source.clear();

	// We read in the whole XML file here.
	// TODO: It doesn't look like the Stream interface is used for anything useful. We
	//   might as well just use a span or StringView, and get completely rid of it.
	// @performance Otherwise, use the temporary allocator.
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 2");
	const size_t source_size = stream->Length();
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 3");
	stream->Read(xml_source, source_size);

	xml_index = 0;
	line_number = 1;
	line_number_open_tag = 1;

	inner_xml_data = false;
	inner_xml_data_terminate_depth = 0;
	inner_xml_data_index_begin = 0;

	// Read (er ... skip) the header, if one exists.
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 4");
	ReadHeader();
	// Read the XML body.
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 5");
	ReadBody();

	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 6");
	xml_source.clear();
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 7");
	source_url = nullptr;
	Log::Message(Log::LT_INFO, "BaseXMLParser::Parse 8");
	return;
}

I get this output:

Warn: iterating misc loop
Warn: Load misc document: ui/options_mouse.rml
Factory::InstanceDocumentStream 0
Factory::InstanceDocumentStream 1
Factory::InstanceDocumentStream 2
Factory::InstanceDocumentStream 3
Factory::InstanceDocumentStream 4
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 6
BaseXMLParser::Parse 7
BaseXMLParser::Parse 8
BaseXMLParser::Parse 6
BaseXMLParser::Parse 7
BaseXMLParser::Parse 8
Factory::InstanceDocumentStream 5
Warn: Loaded misc document: ui/options_mouse.rml
Warn: iterating misc loop
Warn: Load misc document: ui/options_sound.rml
Factory::InstanceDocumentStream 0
Factory::InstanceDocumentStream 1
Factory::InstanceDocumentStream 2
Factory::InstanceDocumentStream 3
Factory::InstanceDocumentStream 4
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 6
BaseXMLParser::Parse 7
BaseXMLParser::Parse 8
BaseXMLParser::Parse 6
BaseXMLParser::Parse 7
BaseXMLParser::Parse 8
Factory::InstanceDocumentStream 5
Warn: Loaded misc document: ui/options_sound.rml
Warn: iterating misc loop
Warn: Load misc document: ui/options_ui.rml
Factory::InstanceDocumentStream 0
Factory::InstanceDocumentStream 1
Factory::InstanceDocumentStream 2
Factory::InstanceDocumentStream 3
Factory::InstanceDocumentStream 4
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 0
BaseXMLParser::Parse 1
BaseXMLParser::Parse 2
BaseXMLParser::Parse 3
BaseXMLParser::Parse 4
BaseXMLParser::Parse 5
BaseXMLParser::Parse 6
BaseXMLParser::Parse 7
BaseXMLParser::Parse 8
Warn: Error during initialization: IPC: Timed out while waiting for VM message

So it is like if BaseXMLParser::Parse() never return to Factory::InstanceDocumentStream().

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from 1e2961a to 7df34f5 Compare November 23, 2024 22:34
@illwieckz
Copy link
Member Author

@slipher would know what is happening with the MSVC build and why it fails?

The current native MSVC build is assumed to make it use the external deps like before (because of USE_SYSTEM_LIBS being enabled by default).

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from 7df34f5 to 1c07673 Compare November 23, 2024 22:45
@illwieckz
Copy link
Member Author

Hmm, of course this is when I ask for help I find a mistake I did… Maybe that's fixed.

@illwieckz
Copy link
Member Author

That's fixed.

@illwieckz illwieckz changed the title WIP: lua and freetype submodule Lua and freetype submodule Nov 23, 2024
@illwieckz illwieckz changed the title Lua and freetype submodule Lua and FreeType submodule Nov 23, 2024
@illwieckz illwieckz marked this pull request as ready for review November 23, 2024 23:16
@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from 1c07673 to 5b1acdc Compare December 5, 2024 09:19
@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch 2 times, most recently from bc13066 to 8b679c8 Compare December 18, 2024 00:51
@illwieckz
Copy link
Member Author

If there is no comment about mistakes to fix, I will merge it in two days.

See this comment for the reasons why I want and need FreeType to be a submodule:

@illwieckz
Copy link
Member Author

illwieckz commented Dec 19, 2024

How to build with Saigo:

  1. Use Linux (there is only a Linux build of Saigo for now)
  2. Download and extract https://dl.illwieckz.net/b/saigo/preview/saigo_newlib_20241119.txz
  3. Store the saigo_newlib folder as external_deps/linux-amd64-default_10/saigo_newlib
  4. Make sure submodules are up to date
  5. Configure CMake with -DUSE_NACL_SAIGO=ON
  6. Build as usual

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from 8b679c8 to 99392b0 Compare December 19, 2024 15:31
@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch 2 times, most recently from 975dfa0 to de93c4c Compare December 29, 2024 22:09
@illwieckz
Copy link
Member Author

I noticed that on the Lua submodule I used the latest tagged version for our master, but on Freetype I used the current upstream master at the time of the clone.

What would you recommend? I can reset FreeType to the latest release tag (which is a bit older).

@illwieckz
Copy link
Member Author

It looks ready to me, modulo the decision about what submodule reference to commit.

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from de93c4c to aa1a58f Compare December 29, 2024 23:29
@illwieckz
Copy link
Member Author

illwieckz commented Dec 31, 2024

It looks ready to me, modulo the decision about what submodule reference to commit.

I've reset the FreeType submodule to the VER-2-13-3 release tag.

CMakeLists.txt Outdated
${CGAMELIST}
LIBS
RMLUI_LIB
${RMLUI_LIBRARY}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this {$RMLUI_LIBRARY} stuff? I don't like the extra indirection when a simple library name works well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a <NAME>_LIBRARY variable is usually what we do that with other libraries (with variant of <NAME>_LIBRARIES when more than one libraries).

Actually the capitalized name without being a variable looks like a typo as some other place in CMake can parse variable names without ${}, here RMLUI_LIB looked like a variable name but was the file name. We don't do that nowhere else.

If we don't want to use a variable, then it better be named srclibs-rmlui but not RMLUI_LIB, the last one is very confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my new commit for an alternative hardcoding srclibs-rmlui instead.

if (BUILDING_ANY_GAMELOGIC)
if (BUILD_CGAME)
# Freetype
# Freetype (RmlUi dependency), already found for a native game when the client is built.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does something bad happen if you do prefer_package again for one that was searched earlier? Would be nicer not to care about that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to fully understand what you mean, but replacing some existing stuff with prefer_package should not have more drawbacks than replacing the same existing stuff by something else written by hand. If there is a drawback, then we would have to handle it anyway.

But I doubt that using a submodule after a search is problematic, I made efforts for the submodules using the same variable names as the search, so one should fully replace the other. I haven't got any problem by turning on and off the PREFER_EXTERNAL_LIBS option. And if one day we face a cmake error, that would be one we cannot avoid anyway (i.e. a CMake bug or design limitation).

I don't see anything to do more.

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch 3 times, most recently from ed210d0 to 926daf9 Compare January 5, 2025 15:21
@illwieckz
Copy link
Member Author

I'm going to merge this, if there is something we think we can do better, we can do it later.

@illwieckz illwieckz force-pushed the illwieckz/submodules/sync branch from 926daf9 to 13a58ab Compare January 6, 2025 15:57
@illwieckz illwieckz merged commit 13a58ab into master Jan 6, 2025
@illwieckz illwieckz deleted the illwieckz/submodules/sync branch January 6, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants