Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

Consider updating NaCl as an alternative to WebAssembly

Open slipher opened this issue 2 years ago • 28 comments

Google Native Client, or NaCl, is not as dead as has been previously believed. Although support for NaCl in websites and 3rd-party browser extensions has been removed, it lives on in some form. This bug tracking issue details the development in 2020-2021 of a C++17-capable NaCl compiler toolchain, codenamed "Saigo". CI-related commits show that it is actively tested on numerous platforms, so it is not just a ChromeOS thing.

After poking around a bit in Chromium Code Search, I still haven't been able to determine what NaCl is being used for. Chromium has a lot of "sandboxed" processes, but in general these are not NaCl-based. But as of now the code is being shipped with Google Chrome: inspection of a Windows install shows a nacl_irt_x86_64.nexe and various NaCl-related strings in chrome.dll. So the chances of it being available for any platform Daemon would want to support seem good. (Contrast this with standalone WebAssembly engines which are more popular for Linux servers and have not been ported to 32-bit architectures.)

slipher avatar Feb 08 '23 06:02 slipher

Some weeks ago I investigated “chromium builds” and I only found nacl stuff in Linux builds. Even macOS amd64 chromium did not have any nacl stuff, and I have seen some commits disabling nacl for macOS.

Edit: I also found some arm64 references, but no builds.

illwieckz avatar Feb 08 '23 06:02 illwieckz

Some search about “Saigo” and “Native Client” returned me this:

https://chromium.googlesource.com/native_client/nacl-llvm-project-v10/+/refs/heads/saigo-2023-01-02

illwieckz avatar Feb 08 '23 07:02 illwieckz

For the record, the C++ toolchain that we would be most likely to use for wasm is upstream clang. This might be the lowest maintenance toolchain we could ever get.

necessarily-equal avatar Feb 08 '23 08:02 necessarily-equal

+1, if Google somehow makes the NaCl thing slightly more user friendly, I think it's better than wasm for now. Wasm doesn't really provide us any features beyond even more modern C++.

For example, in the switch from QVM -> NaCl, if we could have supported C++ on QVMs, we probably would have done that instead of using NaCl.

DolceTriade avatar Feb 08 '23 09:02 DolceTriade

To be able to upgrade NaCl we need two things:

  • a working SDK able to build nexe for hardware platforms we want to run the game on,
    • at least, the SDK should run on Linux amd64 to be able to build and release the game, but to be on par with current SDK such SDK should run on Linux, Windows and macOS amd64;
  • a working runner to ship with the game for hardware platforms and operating systems we want to run the game on,
    • basically the nacl_loader binary and the irt nexe thing.

illwieckz avatar Feb 08 '23 09:02 illwieckz

I think it is also important to reference this thread on the forum, which says that wasm is 2 times slower than native binaries and author seems to have done their research there.

Performance is important as people can only rent cheap VPS to host servers with their own gameplay, and test their own mods. Bots are notably performance hungry, and they were moved from engine to gamelogic thanks to pNaCl near-native performances, I suppose. On my VPS, instances running with 10 bots were (were, because I need to update my codebase) in average using 10% CPU. If it is true that WASM is roughly twice as slow, this might imply going up to 20% CPU, for just 10 bots. I personally do not intend to spend more money in a beefier server just to run servers, so performance are a concern to me. I did not started renting this machine for unvanquished, and unvanquished already have the lion's share of performances, which is ok as it does not impact other processes, but such an increase might very well change that fact.

Keeping up with pNaCl, we would avoid spending developer time (a very scarce resource) on another porting, everything is already there. We would avoid hardly avoidable regressions, too, that can be very annoying. Avoiding compatibility break and sync problems between clients and servers, too.

The main incentive to move to WASM was, IIRC, that pNaCl was thought dead. If it is not, then it would probably be a waste of time, except if the move is almost finished, in which case the decision is a bit harder to do, I guess.

ghost avatar Feb 08 '23 09:02 ghost

About updating nacl, there are some old-but-less-old versions available:

$ curl -s https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/naclsdk_manifest2.json | grep -E '"url":|"description":|"sha1":|"stability":|"name":' | sed -e 's/"//g;s/,$//;s/^      //' | tac
stability: canary
name: pepper_canary
description: Chrome 58 bundle. Chrome revision: 447822. NaCl revision: 70540f6583440d4174e6d75743bb544cfbaaf204
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.447822/naclsdk_win.tar.bz2
      sha1: 183a705dd97ccb9927d53539deb27fb58a9bb611
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.447822/naclsdk_mac.tar.bz2
      sha1: 645de9e81a14801245d5954d71274407d6537f73
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.447822/naclsdk_linux.tar.bz2
      sha1: cb072ab68302803dd4ccf61346db274f3cb5422d
stability: dev
name: pepper_56
description: Chrome 56 bundle. Chrome revision: 54. NaCl revision: 163dfeb43e76995b4265ecd4e78670f7dd432e44
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/56.0.2924.3/naclsdk_win.tar.bz2
      sha1: f20db79c123ef90a046d5399c1e86eff2ca117ed
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/56.0.2924.3/naclsdk_mac.tar.bz2
      sha1: af32526bbde13e60905bbe03a834a8a97daaed92
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/56.0.2924.3/naclsdk_linux.tar.bz2
      sha1: 4f9d6402bc645e137fd601ede6eec67e809e7d6a
stability: beta
name: pepper_55
description: Chrome 55 bundle. Chrome revision: 624. NaCl revision: fe5bd51f9b79d27b2a3884181d4004cfccf70759
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/55.0.2883.59/naclsdk_win.tar.bz2
      sha1: d1f4dc70ceea1dea40e0d1cbbb96d35476ccf681
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/55.0.2883.59/naclsdk_mac.tar.bz2
      sha1: a4bb07075a8509b07e4ff74564ce4632b79dda48
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/55.0.2883.59/naclsdk_linux.tar.bz2
      sha1: 3453c02973381ef5bea50e1eaa3ac2c5418f79d8
stability: beta
name: pepper_50
description: Chrome 50 bundle. Chrome revision: 250. NaCl revision: d182b0a028d44ba9767ae25b30cf3986a7e72e99
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/50.0.2661.37/naclsdk_win.tar.bz2
      sha1: baf5d2c2fccb50bc015dd57c66ccff46514d66a1
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/50.0.2661.37/naclsdk_mac.tar.bz2
      sha1: f306e86a0da969f87ff0637d6786258da31d006e
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/50.0.2661.37/naclsdk_linux.tar.bz2
      sha1: 356ed3c41abe6d062a9f357138c34a352a67a17a
stability: stable
name: pepper_49
description: Chrome 49 bundle. Chrome revision: 592. NaCl revision: 26c7e6ae1327a43c948f4666fef9e84fe351ab7c
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/49.0.2623.87/naclsdk_win.tar.bz2
      sha1: 368b4e141495640e483563d53cf8885b2f6d2a7e
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/49.0.2623.87/naclsdk_mac.tar.bz2
      sha1: 87dcc561b8a77a17c6bbdce9de501ce1c3afc7c2
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/49.0.2623.87/naclsdk_linux.tar.bz2
      sha1: c0085301e5fc2357f7040054d24a140be70f4d2d
stability: post_stable
name: pepper_47
description: Chrome 47 bundle. Chrome revision: 545. NaCl revision: 719fce7fa0c1f11cf05d5c20cdfa6648e8a35611
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/47.0.2526.111/naclsdk_win.tar.bz2
      sha1: 5ed9c96786eae063f6931e586e7a345193fed56e
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/47.0.2526.111/naclsdk_mac.tar.bz2
      sha1: 402e2b71aae904ed7e780602381aa6316f3664a6
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/47.0.2526.111/naclsdk_linux.tar.bz2
      sha1: 43b593f28342ddbbe0a6d1b4b22ba6b5d62a2fd3
stability: dev
name: vs_addin
description: Visual Studio Add-In for building and debugging NaCl applications
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/sdk/1578/vs_addin.tgz
      sha1: c344205faee543e058a978ed1c06cdf5cff248c6
stability: stable
name: sdk_tools
description: Native Client SDK Tools, revision 361478
    url: https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.361478/sdk_tools.tgz
      sha1: c90944aa6dc45085f1a222396ffa2b6a86afdf3d

We are currently using pepper44 (2015-08-08) which is not listed in the manifest:

https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_win.tar.bz2
https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_mac.tar.bz2
https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_linux.tar.bz2
$ sha1sum -b storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_*.tar.bz2
40c3aea429d262900b5b1453ed8955865a90599a *storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_linux.tar.bz2
f46e4b263f25af9ae9011d2ec5860f8b0baef825 *storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_mac.tar.bz2
11c65e7703aba1d20e18f6ed28fecd704a2fb507 *storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/44.0.2403.155/naclsdk_win.tar.bz2

The latest public stable release was pepper_49 (2016-03-08), the most recent public canary release is pepper_58 listed as pepper_canary (2017-02-02).

illwieckz avatar Mar 28 '23 06:03 illwieckz

For reference, we use a pnacl-clang based on 3.6.0 while we can use one based on 3.7.0:

$ PNACLPYTHON=python2 pepper_44/toolchain/linux_pnacl/bin/pnacl-clang++ --version
clang version 3.6.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git 96b3da27dcefc9d152e51cf54280989b2206d789) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git d0089f0b008e03cfd141f05c80e3b628c2df75c1) nacl-version=0beb554650e57834a9fdda91ca9e3352b330b653
Target: le32-unknown-nacl
Thread model: posix

$ PNACLPYTHON=python2 pepper_49/toolchain/linux_pnacl/bin/pnacl-clang++ --version
clang version 3.7.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git cf0dc7f6e6123dfa9b8834b56743315300b34e6c) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git baa63524b6b493ec2a6aa2c5193d9f25c0c33191) nacl-version=3f81c4b7f4cc2bde2ac49873d9d666c02206d459
Target: le32-unknown-nacl
Thread model: posix

$ PNACLPYTHON=python2 pepper_58/toolchain/linux_pnacl/bin/pnacl-clang++ --version
clang version 3.7.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git ce163fdd0f16b4481e5cf77a16d45e9b4dc8300e) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git 7251d5b59fca15195c94a3a7da70f0081724448f) nacl-version=5dfe030a71ca66e72c5719ef5034c2ed24706c43
Target: le32-unknown-nacl
Thread model: posix

illwieckz avatar Mar 28 '23 06:03 illwieckz

I tried to upgrade to the latest release (which was like 6 months newer than the one we're using) one time, but abandoned the attempt because it turned out that toolchain support for C++ exceptions was removed. It's not that hard for us to live without exceptions, but it just didn't seem worthwhile since the benefits were too small.

slipher avatar Mar 28 '23 16:03 slipher

Getting the PNaCl, old GCC, and Saigo toolchains:

$ mkdir workspace
$ cd workspace
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH="$(realpath depot_tools):${PATH}"

$ mkdir depot
$ cd depot
$ gclient config https://chromium.googlesource.com/native_client/src/native_client
$ gclient sync
$ cd native_client

Writing some C source test samples:

$ vim helloworld.cpp
$ cat helloworld.cpp
#include <cstdio>

int main(int argc, char **argv) {
	printf("hello world\n");
	return 0;
}

$ vim exception.cpp
$ cat exception.cpp
#include <iostream>
using namespace std;

int main (int argc, char **argv) {
	try {
		throw 20;
	}
	catch (int e) {
		cout << "An exception occurred: " << e << '\n';
	}
	return 0;
}

Testing the PNaCl toolchain:

$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ helloworld.cpp -o helloworld.bc
$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-finalize helloworld.bc -o helloworld.pexe
$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-translate -arch x86-64 helloworld.pexe -o helloworld.nexe


$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ exception.cpp -o exception.bc
$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-finalize exception.bc -o exception.pexe
$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-translate -arch x86-64 exception.pexe -o exception.nexe

$ ./run.py helloworld.nexe 
********************************************************************************
                        helloworld.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/helloworld.nexe

DEBUG MODE ENABLED (bypass acl)
[1814614,1653906304:13:22:20.747434] BYPASSING ALL ACL CHECKS
[1814614,1653906304:13:22:20.747485] Native Client module will be loaded at base address 0x0000097e00000000
[1814614,1653906304:13:22:20.747491] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1814614,1653906304:13:22:20.748828] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1814614,1653906304:13:22:20.748833] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
hello world

$ ./run.py exception.nexe 
********************************************************************************
                        exception.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/exception.nexe

DEBUG MODE ENABLED (bypass acl)
[1815047,407542656:13:22:38.242597] BYPASSING ALL ACL CHECKS
[1815047,407542656:13:22:38.242665] Native Client module will be loaded at base address 0x0000197200000000
[1815047,407542656:13:22:38.242673] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1815047,407542656:13:22:38.249334] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1815047,407542656:13:22:38.249349] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
Aborting: _Unwind_RaiseException called (C++ exception handling is disabled)
** abort() called

** Signal 4 from untrusted code: pc=1972000628a0

Testing the old GCC toolchain:

$ toolchain/linux_x86/nacl_x86_newlib/bin/x86_64-nacl-g++ helloworld.cpp -o helloworld.nexe
$ toolchain/linux_x86/nacl_x86_newlib/bin/x86_64-nacl-g++ -fexceptions exceptions.cpp -o exceptions.nexe

$ ./run.py helloworld.nexe 
********************************************************************************
                        helloworld.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/helloworld.nexe

DEBUG MODE ENABLED (bypass acl)
[1825456,2257017728:13:30:41.903031] BYPASSING ALL ACL CHECKS
[1825456,2257017728:13:30:41.903085] Native Client module will be loaded at base address 0x00001a1200000000
[1825456,2257017728:13:30:41.903091] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1825456,2257017728:13:30:41.905482] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1825456,2257017728:13:30:41.905489] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
hello world

$ ./run.py exception.nexe 
********************************************************************************
                        exception.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/exception.nexe

DEBUG MODE ENABLED (bypass acl)
[1826224,1244965760:13:31:17.528934] BYPASSING ALL ACL CHECKS
[1826224,1244965760:13:31:17.528985] Native Client module will be loaded at base address 0x000072c600000000
[1826224,1244965760:13:31:17.528992] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1826224,1244965760:13:31:17.537345] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1826224,1244965760:13:31:17.537353] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
An exception occurred: 20

Testing the Saigo toolchain:

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ helloworld.cpp -o helloworld.nexe
$ ./run.py helloworld.nexe 
********************************************************************************
                        helloworld.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/helloworld.nexe

DEBUG MODE ENABLED (bypass acl)
[1850944,3838008192:13:51:49.826304] BYPASSING ALL ACL CHECKS
[1850944,3838008192:13:51:49.826358] Native Client module will be loaded at base address 0x0000631600000000
[1850944,3838008192:13:51:49.826365] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1850944,3838008192:13:51:49.827730] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1850944,3838008192:13:51:49.827736] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
hello world

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ exception.cpp -o exception.nexe
$ ./run.py exception.nexe 
********************************************************************************
                        exception.nexe is X86-64 STATIC                        
********************************************************************************

workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap workspace/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B workspace/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- workspace/depot/native_client/exception.nexe

DEBUG MODE ENABLED (bypass acl)
[1851531,2455493504:13:52:11.454804] BYPASSING ALL ACL CHECKS
[1851531,2455493504:13:52:11.454862] Native Client module will be loaded at base address 0x0000303200000000
[1851531,2455493504:13:52:11.454868] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1851531,2455493504:13:52:11.464903] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1851531,2455493504:13:52:11.464911] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK

** Signal 11 from untrusted code: pc=3032fffeff20

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ -v
clang version 17.0.0 (https://chromium.googlesource.com/a/native_client/nacl-llvm-project-v10.git f1bbea6e081a4d53853028aa51c5963a8b04feb4)
Target: x86_64-unknown-nacl
Thread model: posix
InstalledDir: workspace/depot/native_client/toolchain/linux_x86/saigo_newlib/bin

$ stat -c '%y' toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++
2023-03-29 13:07:14.211783585 +0200

illwieckz avatar Mar 29 '23 11:03 illwieckz

Well…

$ LANG=C.UTF-U toolchain/linux_x86/nacl_x86_newlib/bin/x86_64-nacl-g++ -v
Using built-in specs.
Target: x86_64-nacl
Configured with: /mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/SRC/gcc/configure CC='gcc -m32' CFLAGS='-O2 -g -Dinhibit_libc -D__gthr_posix_h' LDFLAGS=-s 'CFLAGS_FOR_TARGET=-O2 -g -I/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/headers_for_build' 'CXXFLAGS_FOR_TARGET=-O2 -g -I/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/headers_for_build' --prefix=/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/sdk/nacl-sdk --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --target=x86_64-nacl --enable-linker-build-id --with-gmp=/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/.gcc-extra-install-gmp --with-mpfr=/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/.gcc-extra-install-mpfr --with-ppl=/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/.gcc-extra-install-ppl --with-host-libstdcxx='-lpwl -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm' --with-cloog=/mnt/data/b/build/slave/nacl-toolchain/build/native_client/tools/BUILD/.gcc-extra-install-cloog-ppl --disable-ppl-version-check --disable-shared --enable-languages=c,c++,objc --enable-threads=nacl --enable-tls --with-newlib
Thread model: nacl
gcc version 4.4.3 20150409 (Native Client 11953a35fcd4f999b097a343bc49d89f94af21a8, Git Commit f80d6b9ee7f94755c697ffb7194fb01dd0c537dd) (GCC) 

$ stat -c '%y' toolchain/linux_x86/nacl_x86_newlib/bin/x86_64-nacl-g++
2015-04-09 23:46:00.000000000 +0200

The build is from 2015… :-/

This is probably the toolchain from before the pexe was a thing.

illwieckz avatar Mar 29 '23 11:03 illwieckz

The pnacl_clang+, it's clang 3.7.0 and the build seems to be dated from 2022-04-01:

toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ -v
clang version 3.7.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git c029fe2e0250ec34ba325624ab659835f06bf777) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git a3b836a9847468b1be6247bd596ee12d5783e332)
Target: le32-unknown-nacl
Thread model: posix
clang: warning: argument unused during compilation: '-O0'
clang: warning: argument unused during compilation: '-fno-vectorize'
clang: warning: argument unused during compilation: '-fno-slp-vectorize'
clang: warning: argument unused during compilation: '-fno-common'
clang: warning: argument unused during compilation: '-nostdinc'
clang: warning: argument unused during compilation: '-fno-gnu-inline-asm'
clang: warning: argument unused during compilation: '-fexceptions'

stat -c '%y' toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++
2022-04-01 19:17:46.186732530 +0200

illwieckz avatar Mar 29 '23 11:03 illwieckz

I managed to get saigo build an helloworld.nexe that runs, but exception.nexe doesn't.

This is based on clang 17 and the build looks to be from today:

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ helloworld.cpp -o helloworld.nexe
$ ./run.py helloworld.nexe 
********************************************************************************
                        helloworld.nexe is X86-64 STATIC                        
********************************************************************************

/home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap /home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B /home/illwieckz/dev/native_client/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- /home/illwieckz/dev/native_client/depot/native_client/helloworld.nexe

DEBUG MODE ENABLED (bypass acl)
[1850944,3838008192:13:51:49.826304] BYPASSING ALL ACL CHECKS
[1850944,3838008192:13:51:49.826358] Native Client module will be loaded at base address 0x0000631600000000
[1850944,3838008192:13:51:49.826365] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1850944,3838008192:13:51:49.827730] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1850944,3838008192:13:51:49.827736] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
hello world

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ exception.cpp -o exception.nexe
$ ./run.py exception.nexe 
********************************************************************************
                        exception.nexe is X86-64 STATIC                        
********************************************************************************

/home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap /home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B /home/illwieckz/dev/native_client/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- /home/illwieckz/dev/native_client/depot/native_client/exception.nexe

DEBUG MODE ENABLED (bypass acl)
[1851531,2455493504:13:52:11.454804] BYPASSING ALL ACL CHECKS
[1851531,2455493504:13:52:11.454862] Native Client module will be loaded at base address 0x0000303200000000
[1851531,2455493504:13:52:11.454868] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1851531,2455493504:13:52:11.464903] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1851531,2455493504:13:52:11.464911] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK

** Signal 11 from untrusted code: pc=3032fffeff20

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ -v
clang version 17.0.0 (https://chromium.googlesource.com/a/native_client/nacl-llvm-project-v10.git f1bbea6e081a4d53853028aa51c5963a8b04feb4)
Target: x86_64-unknown-nacl
Thread model: posix
InstalledDir: /home/illwieckz/dev/native_client/depot/native_client/toolchain/linux_x86/saigo_newlib/bin

$ stat -c '%y' toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++
2023-03-29 13:07:14.211783585 +0200

illwieckz avatar Mar 29 '23 11:03 illwieckz

That saigo clang doesn't complain if I use -std=c++20:

$ toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ -std=c++20 helloworld.cpp -o helloworld.nexe

$ ./run.py helloworld.nexe 
********************************************************************************
                        helloworld.nexe is X86-64 STATIC                        
********************************************************************************

/home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/nacl_helper_bootstrap /home/illwieckz/dev/native_client/depot/native_client/scons-out/opt-linux-x86-64/staging/sel_ldr --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a -S -B /home/illwieckz/dev/native_client/depot/native_client/scons-out/nacl_irt-x86-64/staging/irt_core.nexe -- /home/illwieckz/dev/native_client/depot/native_client/helloworld.nexe

DEBUG MODE ENABLED (bypass acl)
[1859664,266750848:13:58:36.653656] BYPASSING ALL ACL CHECKS
[1859664,266750848:13:58:36.653708] Native Client module will be loaded at base address 0x00007c8300000000
[1859664,266750848:13:58:36.653716] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1859664,266750848:13:58:36.655072] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
[1859664,266750848:13:58:36.655078] WARNING: BYPASSING DESCRIPTOR SAFETY CHECK
hello world

illwieckz avatar Mar 29 '23 11:03 illwieckz

while run.py automatically builds the loader if it's missing, this command can do it as well:

./scons platform=x86-64 MODE=opt-host naclsdk_validate=0 sysinfo=0 -j8 sel_ldr

The file can then be found as:

./scons-out/opt-linux-x86-64/staging/sel_ldr

illwieckz avatar Mar 29 '23 12:03 illwieckz

Even with a saigo toolchain from today there is still no arm64 target:

$ toolchain/linux_x86/saigo_newlib/bin/clang++ --print-targets

  Registered Targets:
    arm     - ARM
    armeb   - ARM (big endian)
    thumb   - Thumb
    thumbeb - Thumb (big endian)
    x86     - 32-bit X86: Pentium-Pro and above
    x86-64  - 64-bit X86: EM64T and AMD64


toolchain/linux_x86/saigo_newlib/bin/clang++ --target=arm64--nacl helloworld.cpp -o helloworld.nexe
clang++: error: the target architecture 'arm64' is not supported by the target 'Native Client'

illwieckz avatar Mar 29 '23 12:03 illwieckz

Also I fail to build a pexe with saigo, that would mean building every nexe platform from scratch instead of just translating a single pexe:

$ toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang -v
clang version 3.7.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git c029fe2e0250ec34ba325624ab659835f06bf777) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git a3b836a9847468b1be6247bd596ee12d5783e332)
Target: le32-unknown-nacl
Thread model: posix
clang: warning: argument unused during compilation: '-O0'
clang: warning: argument unused during compilation: '-fno-vectorize'
clang: warning: argument unused during compilation: '-fno-slp-vectorize'
clang: warning: argument unused during compilation: '-fno-common'
clang: warning: argument unused during compilation: '-nostdinc'
clang: warning: argument unused during compilation: '-fno-gnu-inline-asm'

$ toolchain/linux_x86/saigo_newlib/bin/clang++ --target=le32-unknown-nacl helloworld.bc -o helloworld.bc
clang++: error: the target architecture 'le32' is not supported by the target 'Native Client'

illwieckz avatar Mar 29 '23 12:03 illwieckz

Since it's doable to rebuild the nacl_loader, out of curiosity I wonder if it can be rebuilt for armel (and then, Android).

illwieckz avatar Apr 26 '23 23:04 illwieckz

If the PNaCl format no longer exists, that may or may not be bad for us... yes, we would have to compile all the code multiple times, but the translation (PNaCl -> NaCl) step is so slow that the overall build time might not really be worse. I bet it's faster at least for incremental builds.

slipher avatar Oct 31 '23 21:10 slipher

Sounds like a worthwhile thing to test then

DolceTriade avatar Oct 31 '23 22:10 DolceTriade

I will probably spend time on updating NaCl only if we find WAMR unusable, see:

  • https://github.com/DaemonEngine/Daemon/issues/757#issuecomment-1769041733

I consider that the priority on that topic after next release is to investigate WAMR then fallback on updated NaCl if WAMR is proven unusable.

illwieckz avatar Nov 01 '23 04:11 illwieckz

If work is done on "moving", please keep in consideration the need to have a transition period where both are supported, as such a move can trigger hard to find bugs in mods, that only time can reveal.

ghost avatar Nov 01 '23 20:11 ghost

I assume the way to build for a newer NaCl or for Wasm would require a very different CMake code than our current code with PNaCL, so I think that would even be easier to not modify the existing code but to add code, this means having the two toolchains in CMake may be even easier. For the virtual machine plumbing I have no idea though.

At QVM/NaCl time we did a transition where both existed at the same time, and there was a time were the server was running NaCl by default and the client was still running QVM by default while ironing out the last bits.

illwieckz avatar Nov 01 '23 20:11 illwieckz

To change my mind I toyed with Saigo a bit, and I got this:

[ 56%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/LuaEventListenerInstancer.cpp.obj
[ 56%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/LuaEventListener.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/LuaType.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/LuaPlugin.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/RmlUi.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/RmlUiContextsProxy.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/Utilities.cpp.obj
[ 57%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/Vector2f.cpp.obj
[ 58%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Lua/Vector2i.cpp.obj
Unknown TLS model
UNREACHABLE executed at /b/s/w/ir/x/w/native_client/toolchain_build/src/llvm-saigo/llvm/lib/Target/X86/X86ISelLowering.cpp:20872!
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: native_client/toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang++ -DARCH_STRING=pnacl -DDAEMON_ARCH_pnacl -DDAEMON_BUILD_Release -DGLM_FORCE_EXPLICIT_CTOR -DLUA_COMPAT_APIINTCASTS -DNACL_ARCH_STRING=pnacl -DNACL_BUILD_ARCH=x86 -DNACL_BUILD_SUBARCH=64 -DRC_MAX_LAYERS_DEF=63 -DRC_MAX_NEIS_DEF=16 -DRMLUI_STATIC_LIB -DTHIS_IS_NOT_A_DEBUG_BUILD -IUnvanquished/daemon/src -IUnvanquished/daemon/libs -IUnvanquished/daemon/libs/zlib -IUnvanquished/daemon/libs/nacl -IUnvanquished/libs -IUnvanquished/src -IUnvanquished/daemon/external_deps/linux-amd64-default_9/pnacl_deps/include/freetype2 -IUnvanquished/libs/RmlUi/Include -IUnvanquished/daemon/external_deps/linux-amd64-default_9/pnacl_deps/include -IUnvanquished/libs/recastnavigation/Detour/Include -IUnvanquished/libs/recastnavigation/DetourTileCache/Include -IUnvanquished/libs/recastnavigation/DebugUtils/Include -IUnvanquished/libs/recastnavigation/DetourCrowd/Include -IUnvanquished/libs/recastnavigation/Recast/Include -IUnvanquished/libs/recastnavigation/RecastDemo/Include -IUnvanquished/libs/glm -std=gnu++14 -ffast-math -fvisibility=hidden -stdlib=libc++ -O3 -DNDEBUG -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/SystemInterface.cpp.obj -MF CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/SystemInterface.cpp.obj.d -o CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/SystemInterface.cpp.obj -c Unvanquished/libs/RmlUi/Source/Core/SystemInterface.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'Unvanquished/libs/RmlUi/Source/Core/SystemInterface.cpp'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN3Rml15SystemInterface10LogMessageENS_3Log4TypeERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'
[ 42%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/XMLNodeHandler.cpp.obj
[ 42%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/XMLNodeHandlerBody.cpp.obj
 #0 0x00007fd10a9b0f07 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x1fb0f07)
 #1 0x00007fd10a9aec2e llvm::sys::RunSignalHandlers() (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x1faec2e)
 #2 0x00007fd10a9b02c3 llvm::sys::CleanupOnSignal(unsigned long) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x1fb02c3)
 #3 0x00007fd10a8f82d6 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007fd108642910 (/lib/x86_64-linux-gnu/libc.so.6+0x42910)
 #5 0x00007fd10869999b pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9999b)
 #6 0x00007fd108642866 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42866)
 #7 0x00007fd1086268b7 abort (/lib/x86_64-linux-gnu/libc.so.6+0x268b7)
 #8 0x00007fd10a909bbf (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x1f09bbf)
 #9 0x00007fd10cd7dcad llvm::X86TargetLowering::LowerGlobalTLSAddress(llvm::SDValue, llvm::SelectionDAG&) const X86ISelLowering.cpp:0:0
#10 0x00007fd10b2a9b34 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#11 0x00007fd10b2a8de1 llvm::SelectionDAG::Legalize() (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x28a8de1)
#12 0x00007fd10b435e87 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2a35e87)
#13 0x00007fd10b433de3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2a33de3)
#14 0x00007fd10b4307d5 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2a307d5)
#15 0x00007fd10cd34249 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#16 0x00007fd10ae72435 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2472435)
#17 0x00007fd10ab40887 llvm::FPPassManager::runOnFunction(llvm::Function&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2140887)
#18 0x00007fd10ab48bc1 llvm::FPPassManager::runOnModule(llvm::Module&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2148bc1)
#19 0x00007fd10ab41325 llvm::legacy::PassManagerImpl::run(llvm::Module&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x2141325)
#20 0x00007fd1106b5da4 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>>) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x2cb5da4)
#21 0x00007fd110ab4e23 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#22 0x00007fd10f452c14 clang::ParseAST(clang::Sema&, bool, bool) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x1a52c14)
#23 0x00007fd1116664d0 clang::FrontendAction::Execute() (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x3c664d0)
#24 0x00007fd1115d9f0f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x3bd9f0f)
#25 0x00007fd1116f23e4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x3cf23e4)
#26 0x000055da8c0815c2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (native_client/toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang+++0x185c2)
#27 0x000055da8c07d19d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x00007fd1111e8a39 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 0x00007fd10a8f801d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libLLVM-17git.so+0x1ef801d)
#30 0x00007fd1111e7eaf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x37e7eaf)
#31 0x00007fd1111a5bef clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x37a5bef)
#32 0x00007fd1111a5ea7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x37a5ea7)
#33 0x00007fd1111c5f59 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (native_client/toolchain/linux_x86/saigo_newlib/bin/../lib/libclang-cpp.so.17git+0x37c5f59)
#34 0x000055da8c07c471 clang_main(int, char**, llvm::ToolContext const&) (native_client/toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang+++0x13471)
#35 0x000055da8c08d861 main (native_client/toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang+++0x24861)
#36 0x00007fd1086280d0 (/lib/x86_64-linux-gnu/libc.so.6+0x280d0)
#37 0x00007fd108628189 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28189)
#38 0x000055da8c078f0a _start (native_client/toolchain/linux_x86/saigo_newlib/bin/x86_64-nacl-clang+++0xff0a)
x86_64-nacl-clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 17.0.0 (https://chromium.googlesource.com/a/native_client/nacl-llvm-project-v10.git f1bbea6e081a4d53853028aa51c5963a8b04feb4)
Target: x86_64-unknown-nacl
Thread model: posix
InstalledDir: native_client/toolchain/linux_x86/saigo_newlib/bin
[ 42%] Building CXX object CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/XMLNodeHandlerDefault.cpp.obj
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/SystemInterface-c620e4.cpp
x86_64-nacl-clang++: note: diagnostic msg: /tmp/SystemInterface-c620e4.sh
x86_64-nacl-clang++: note: diagnostic msg: 

********************
make[2]: *** [CMakeFiles/RMLUI_LIB.dir/build.make:2120 : CMakeFiles/RMLUI_LIB.dir/libs/RmlUi/Source/Core/SystemInterface.cpp.obj] Erreur 1
make[2]: *** Attente des tâches non terminées....
make[1]: *** [CMakeFiles/Makefile2:113 : CMakeFiles/RMLUI_LIB.dir/all] Erreur 2
make: *** [Makefile:91 : all] Erreur 2

illwieckz avatar Nov 20 '23 19:11 illwieckz

I now wonder if Saigo SDK exists for Windows.

Here are the instructions I use to get the Saigo toolchain:

$ mkdir workspace
$ cd workspace
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH="$(realpath depot_tools):${PATH}"

$ mkdir depot
$ cd depot
$ gclient config https://chromium.googlesource.com/native_client/src/native_client
$ gclient sync
$ cd native_client

Then I get toolchain/linux_x86/nacl_x86_newlib/bin/x86_64-nacl-g++

But in toolchain_revisions/saigo_newlib.json file I only get references to archives of Linux binaries.

illwieckz avatar Dec 18 '23 21:12 illwieckz