Skip to content

Merging my work #19

Open
Open

Activity

  1. illwieckz commented on Jun 27, 2026

    @illwieckz
    MemberAuthor
  2. slipher commented on Jun 27, 2026

    @slipher
    Member

    I've been trying to get the Windows build running using the Chromium toolchains for a couple days, so that I can test whether there are any regressions. It's a bit slow going since there some annoying issues. For example the non-Linux toolchain lists were deleted, so I have to restore them by reverting that commit.

    I also tried to set it up with your Saigo toolchain build, but the Windows executables didn't seem to work (reported on the other repo).

  3. illwieckz commented on Jun 27, 2026

    @illwieckz
    MemberAuthor

    I also tried to set it up with your Saigo toolchain build, but the Windows executables didn't seem to work

    I suspect the Windows build went wrong: the tarball is way smaller than some of my previous builds. I'll retry them.

    (reported on the other repo).

    Link?

  4. slipher commented on Jun 27, 2026

    @slipher
    Member
  5. slipher commented on Jun 30, 2026

    @slipher
    Member

    Finally got Windows builds going good with Scons so I can run the tests. There were a lot of build system mysteries to unravel.

    Why are there two build systems? The GN build system is/was used to build NaCl for Chromium. But it mostly
    doesn't have any tests. So the Scons build continued being maintained for CI and testing purposes. (The reliability of testing with a different build is questionable though, as this software is extremely sensitive to compiler/linker/etc. flag changes!)

    How are you even supposed to build with MSVC? There were a few layers of bit rot:

    • --no-clang must always be specified or it will use a nonexistent Clang path.
    • In 2023 non-Linux builds were shut down. So there are a few changes afterward that add MSVC-incompatible flags that need to be fixed.
    • Before that, there was a commit that modifies MSVC builds so that they only work with a special file on Google's build bot.
    • The vendored Scons must not be used since it is too old to recognize recent MSVC toolchains.

    I learned from commit 406521b that as of 2020, cl.exe (regular MSVC compiler) uses were mostly removed from Chromium builds. They are using clang-cl instead. The Scons file can also be made to work with clang-cl with very minor modifications.

  6. slipher commented on Jul 1, 2026

    @slipher
    Member

    I've run across a potential issue with using MinGW. A crash handling routine in src/trusted/service_runtime/win/exception_patch/intercept.S assumes the "native" ABI for thread-local storage. Most current MinGW toolchains are using a different one, "emutls". Apparently the option to use the native ABI was recently added with GCC 16, but it wouldn't be available in many distros yet. It sounds like this is something that must be configured, so just because a MinGW toolchain updated to GCC 16 doesn't necessarily mean it's using the new ABI.

    This is the kind of stuff I'm talking about when I say running the tests with a different build would provide a lot less value for this software in particular. I think my external crash test should be able to catch this one, however. Could you try that with a MinGW build?

  7. slipher commented on Jul 1, 2026

    @slipher
    Member

    Note that clang-cl is said to already use the native TLS ABI, so that could be alternative to MinGW if cross-compiling is desired, though there is the annoying bit of needing to download a non-libre Microsoft SDK to get the headers. As mentioned above Chromium built everything with clang-cl; the MSVC build which is working now on the slipher/fixed-upstream branch can be modified to use clang-cl with a patch of less than 10 lines. (Cross-compiling with clang-cl would be somewhat more involved though.)

  8. illwieckz commented on Jul 1, 2026

    @illwieckz
    MemberAuthor

    Thanks for those investigations! That's very helpful! ❤️

    It looks like we will have good quality Native Client… 🙂️

  9. illwieckz commented on Jul 1, 2026

    @illwieckz
    MemberAuthor

    I think my external DaemonEngine/Daemon#1785 should be able to catch this one, however. Could you try that with a MinGW build?

    I'll do, but probably not before some days.

  10. illwieckz commented on Jul 9, 2026

    @illwieckz
    MemberAuthor

    @slipher Right now when I attempt to run the nacl loader on Wine it fails:

    Using loader args:  nacl_loader-amd64.exe -v -B irt_core-amd64.nexe -e -i 100:388 -- cgame-amd64.nexe 100
    ^3Warn: Error during initialization: IPC: Failed to receive message: Broken pipe
    

    I tried a pnacl and a saigo nexe build, in both case it was using the loader built with mingw.

    I don't know how to run the crash_test.py tool but I wanted to test a simple run before.

    One can test building the game with mingw-built nacl_loader and saigo using the illwieckz/deps engine branch (preview packages are provided).

    I attempted to run by hand my old helloworld (likely built with PNaCl at the time), and it didn't printed “hello world“”:

    $ wine 'nacl_loader-amd64.exe' -v -B 'irt_core-amd64.nexe' -e -i 100:388 -- 'helloworld-amd64.nexe' 100
    sel_ldr argument list:
    nacl_loader-amd64.exe -v -B irt_core-amd64.nexe -e -i 100:388 -- helloworld-amd64.nexe 100
    [288,292:19:49:06.365000] NaClHostDescOpen: CreateFileA(path=irt_core-amd64.nexe, desired_access=0xa0000000, share_mode=ALL, security_attributes=NULL, creation_disposition=3, flags_and_attributes=16777217, template_file=NULL)
    [288,292:19:49:06.366000] NaClPerfCounterInterval(SelMain __start__:SnapshotBlob): 7933 microsecs
    [288,292:19:49:06.366000] NaClHostDescOpen: CreateFileA(path=helloworld-amd64.nexe, desired_
    access=0xa0000000, share_mode=ALL, security_attributes=NULL, creation_disposition=3, flags_and_attributes=16777344, template_file=NULL)
    [288,292:19:49:06.427000] NaClPerfCounterInterval(NaClAppLoadFile __start__:PreAllocAddrSpace): 169 microsecs
    [288,292:19:49:06.570000] Native Client module will be loaded at base address 0x000000ff00000000
    [288,292:19:49:07.123000] NaClPerfCounterInterval(NaClAppLoadFile PreAllocAddrSpace:*AllocAddrSpace): 695356 microsecs
    [288,292:19:49:07.156000] NaClPerfCounterInterval(NaClAppLoadFile *AllocAddrSpace:*NaClElfImageLoad): 33532 microsecs
    [288,292:19:49:07.382000] NaClPerfCounterInterval(NaClAppLoadFile *NaClElfImageLoad:*MakeDynText): 226087 microsecs
    [288,292:19:49:07.384000] NaClPerfCounterInterval(NaClAppLoadFile *MakeDynText:*ValidateImg): 1860 microsecs
    [288,292:19:49:07.386000] NaClPerfCounterInterval(NaClAppLoadFile __start__:EndLoadFile): 958999 microsecs
    [288,292:19:49:07.386000] NaClPerfCounterInterval(SelMain SnapshotBlob:AppLoadEnd): 1020554 microsecs
    [288,292:19:49:07.389000] NaClPerfCounterInterval(NaClTextDyncodeCreate __start__:*DynRegionValidate): 1647 microsecs
    [288,292:19:49:07.390000] NaClPerfCounterInterval(SelMain AppLoadEnd:BlobLoaded): 3408 microsecs
    [288,292:19:49:07.390000] NACL: Application output follows
    [288,292:19:49:07.390000] NaClPerfCounterInterval(SelMain BlobLoaded:CreateMainThread): 584 microsecs
    
  11. illwieckz commented on Jul 10, 2026

    @illwieckz
    MemberAuthor

    Well, it doesn't work anymore on linux-armhf on my end.

  12. illwieckz commented on Jul 10, 2026

    @illwieckz
    MemberAuthor

    Well, it doesn't work anymore on linux-armhf on my end.

    For this one it looks like I had a bad irt. I don't know from where I got it. With the one from the old naclsdk it works.

  13. slipher commented on Jul 10, 2026

    @slipher
    Member

    One can test building the game with mingw-built nacl_loader and saigo using the illwieckz/deps engine branch (preview packages are provided).

    I can test this if you tell me the specific file to download.

  14. illwieckz commented on Jul 10, 2026

    @illwieckz
    MemberAuthor

    One can test building the game with mingw-built nacl_loader and saigo using the illwieckz/deps engine branch (preview packages are provided).

    I can test this if you tell me the specific file to download.

    Nothing to download by hand, just building the usual way will download the preview package.

    If you want to download them by hand, they are there:

  15. illwieckz commented on Jul 10, 2026

    @illwieckz
    MemberAuthor

    And here are my helloword nexe:

    I forgot to say it, but despite no specific error message (but the missing of the actual hello world one), the loader returned with a non-zero return code.

    Edit: The return code was 1.

  16. slipher commented on Jul 13, 2026

    @slipher
    Member

    I tried the nacl_loader + irt_core from https://dl.unvanquished.net/test/deps/windows-amd64-mingw_12.tar.xz with the 0.56.2 release. The game doesn't start: I immediately get "nacl_loader.exe has stopped working". That's about what I expected since there are some missing pieces relating to thread-local storage:

    • The THREAD macro which is supposed to be an attribute to use TLS is defined to the wrong thing for MinGW. If you fix it, the symbol names change, which causes some (GNU) assembler code to fail to link.
    • The TLS ABI thing which I talked about up-thread. You have to be using a GCC 16+ toolchain to have a chance of it using the right ABI.

    I have a scons mingw build somewhat working and also have a native TLS toolchain available via MSYS so I'll see if I can get it to work with that.

  17. slipher commented on Jul 13, 2026

    @slipher
    Member

    Also you didn't build an i686 Windows version did you? It looks like there are a lot of missing pieces in the source still, where there is MSVC inline assembly with no alternative path. In view of Unvanquished/Unvanquished#3572 maybe the best thing to do would be to keep using the old Google sel_ldr instead of trying to rebuild it, even if we make a few more 32-bit Windows releases.

  18. illwieckz commented on Jul 13, 2026

    @illwieckz
    MemberAuthor

    Also you didn't build an i686 Windows version did you?

    It looks like I forgot to upload them, now done:

    maybe the best thing to do would be to keep using the old Google sel_ldr instead of trying to rebuild it

    Yeah, I'm not excluding the possibility to rely on a different origin for some platforms, though we may prefer to rebuild the Windows loaders with MSVC and put it as a download on the native_client GitHub than to forever rely on that annoying download from Google.

    The same can be said for the IRT. I don't really see the point of building the IRT in the external_deps script and adds Saigo as required dependencies to build the dependencies. A small download from our the GitHub would be fine. Right now in my revamped external_deps/build.sh script I still copy the IRT from the old Google PNaCl tarball.

  19. illwieckz commented on Jul 13, 2026

    @illwieckz
    MemberAuthor

    I learned from commit 406521b that as of 2020, cl.exe (regular MSVC compiler) uses were mostly removed from Chromium builds. They are using clang-cl instead. The Scons file can also be made to work with clang-cl with very minor modifications.

    How is built src/trusted/service_runtime/arch/x86_64/nacl_switch_unwind_win.asm when using clang-cl? I use JWasm to cross-compile the MinGW build witout MASM.

  20. slipher commented on Jul 13, 2026

    @slipher
    Member

    How is built src/trusted/service_runtime/arch/x86_64/nacl_switch_unwind_win.asm when using clang-cl? I use JWasm to cross-compile the MinGW build witout MASM.

    With MASM, same as before. The comment there is precisely 'last use of cl.exe', not last use of Visual Studio. It's just the classic Microsoft C/C++ compiler they wanted to avoid in particular, not the VS toolchains in general. Note that VS also ships clang-cl.

  21. illwieckz commented on Jul 13, 2026

    @illwieckz
    MemberAuthor

    How is built src/trusted/service_runtime/arch/x86_64/nacl_switch_unwind_win.asm when using clang-cl? I use JWasm to cross-compile the MinGW build witout MASM.

    With MASM, same as before. The comment there is precisely 'last use of cl.exe', not last use of Visual Studio. It's just the classic Microsoft C/C++ compiler they wanted to avoid in particular, not the VS toolchains in general. Note that VS also ships clang-cl.

    Ah, so they don't cross-compile…

  22. slipher commented on Jul 14, 2026

    @slipher
    Member

    Good news! I tried building using a patched Scons build with a MinGW GCC 16.1 provided by MSYS2 (but with the one assembler file still compiled with MASM) and it compiles with the thread-local attributes correctly set. Almost all tests pass and crash_test.py works. So MinGW CMake plans can proceed, but you won't be able to build with the compilers in Debian stable. It requires at least GCC 16 and needs to be configured with the "native" TLS. When the attribute is fixed and you try to build with an incompatible toolchain, you'll get link errors.

  23. illwieckz commented on Jul 14, 2026

    @illwieckz
    MemberAuthor

    Nice! For now even Debian unstable is still at GCC15 unfortunately. But that doesn't prevent to do the plumbing. I guess that for Windows we will build the NaCl runtime outside of external_deps and make a package to download in external_deps instead, until some GCC-16-based MinGW surfaces.

  24. slipher commented on Jul 28, 2026

    @slipher
    Member

    I tried renting an arm64 VPS to test the case of armhf running on a 64-bit host. But it turned out the hardware does not have support for running 32-bit programs. Maybe such support is actually uncommon...

  25. illwieckz commented on Jul 29, 2026

    @illwieckz
    MemberAuthor

    The 32-bit apps support is optional in both ARMv8 and ARMv9. Usually ARMv8 supports both (this is also the architecture that introduced 64-bit so it's understandable they massively kept compatibility with older tech), but 32-bit is becoming rarer on ARMv9. All OpenGL 3+/Vulkan single boards I tested (Raspberry Pi 4, 5, Banana Pi M5, Orange Pi 5, NanoPI R5C) had 32-bit support. But they're all ARMv8 as far as I know.
    I have a Dæmon branch able to run box64 on arm64 when armhf isn't there anyway.

  26. slipher commented on Oct 5, 2026

    @slipher
    Member

    Are you still dead-set on this CMake port? It's an enormous waste of time and pointless complexity to have two build systems. Scons can be installed as a Python module so there is no difficulty in installing on Mac or whatever. The loader can only be built for a small fixed set of platforms, so you can't say you need YOKAI to get it to build on FreeBSD or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions