[01:11] "Reading those opts, one thing I see is `LEGACY_GL_EMULATION`. Probably that's necessary? If it's on by mistake it adds overhead. Can just build without it and see if things still work if you aren't sure." [01:11] "clang 14.0 is correct" [01:14] I'm trying 1in39 without it [01:20] Other lines: [01:21] "The optimization level during link is [01:21] _OPTIONS["OPTIMIZE"] [01:21] so the question is what value that actually has. -O3 would usually by a good option, but you can try -Os too." [01:21] "For new browsers you can try wasm EH support, but most don't support it yet, see https://emscripten.org/docs/porting/exceptions.html#webassembly-exception-handling-proposal" [01:21] (I do not think we should do this.) [01:21] "Aside from those things, it may also be worth looking into LTO: building with -flto during both compile and link. The build will be much slower though, but it may be worth it." [01:26] 39in1 recompiled is running at 22% instead of 10%. A two-time speedup based on the previous overhead [01:59] Did a make clean and THEN a build, see if it makes a difference [02:05] OK, trying the LTO [02:05] Either it works or it dies. [02:59] Girl-bossed too close to the son, LTO hack dies. [02:59] Going back to other [03:55] *** jvilk has joined #jsmess [03:55] I was summoned by SketchCow -- what's happening? [03:58] I don't have too much time (I now have a 6 month old son!), but if someone could let me know what's up I can try to help out with whatever is happening when I can [04:03] MAME is -O3 by default and anything else would be a lot slower [04:05] jvilk: a2600 and a7800 builds are erroring out at runtime with browserfs.rollup.js:2399 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ENOTSUP') at $.readlink (browserfs.rollup.js:2399) at Object.readlink (mamea2600.js.gz:1) at Object.doReadlink (mamea2600.js.gz:1) at ___syscall_readlink (mamea2600.js.gz:1) at 04b85052:0x51b1b2 at 04b85052:0x51b034 at [04:05] 04b85052:0x26135d at 04b85052:0x21693b at 04b85052:0x18307f at 04b85052:0x66f4fb [04:06] DFJustin: got it. is there a link to a build exhibiting the bug? [04:06] or is this live at the archive [04:07] oh interesting it's doing a `readlink` call. why is it doing that. [04:11] hey all. finally sitting down at my computer for the first time since last night [04:11] hey jvilk, good to see you - sounds like we're in the same boat now, congrats :D [04:11] thanks -- same to you! [04:12] yeah I was trying to figure out last night why it's suddenly doing a readlink call when it wasn't before. the only references I could find in the mame codebase were 6+ years old, so I'm also a bit confused where they're coming from, unless emscripten itself is responsible [04:14] is there a build somewhere I can look at? just so i can confirm the failure site. [04:15] yeah that was gonna be my question for SketchCo1 too [04:15] Sure, all a7800 games one moment [04:15] https://archive.org/details/Food_Fight_1987_Atari_NTSC [04:16] Everyone's making babies and ignoring my emulation empire [04:16] So, bear in mind - the compilation all works fine as long as it's not trying to add a thing. [04:16] yeah... i still think about streaming isos. :/ [04:17] me too, been top of my mind lately, I've been using browserfs in a few new projects lately [04:18] I got streaming zip support working (outside of browserfs though, the whole emscripten synchronous requirement makes it trickier in both cases obviously) [04:18] OK, so the error is that `this.ERRNO_CODES` doesn't exist. [04:18] By the way, speaking of WASM [04:18] https://webassembly.org/roadmap/ [04:18] looking into why [04:19] Apparently, Exception Handling will make things speed up, but when even the reference library doesn't apply it [04:21] we upgraded emscripten, right? [04:21] Yeah, 3.1.0 [04:21] Had to [04:22] I bet ERRNO_CODES is gone :looking: [04:22] So we're cruising proper. [04:22] https://github.com/emscripten-core/emscripten/issues/10061 [04:23] DEFAULT_LIBRARY_FUNCS_TO_INCLUDE ... sounds like a compilation option? [04:23] this is somewhat interesting, not sure if it's related https://github.com/emscripten-core/emscripten/blob/8e1e305519e1027726a48861a1fec5662f7e18a2/src/library.js#L1566 [04:23] instead it seems they're all being set as $ERRNO_CODES__postset [04:25] ah ok, yeah hopefully adding that compilation arg will just magically fix everything [04:25] I'm trying to figure out how to add it. [04:27] Is it a build option? [04:27] I'm looking here: [04:27] looks like it's in this list of compile options: https://github.com/emscripten-core/emscripten/blob/d8ec08a37915c5a7a358b324627abe5a00c0f632/tools/settings.py#L54 it's been awhile since I compiled with emscripten [04:28] so maybe `-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$ERRNO_CODES`? [04:29] I need to sign off in 2 minutes, but I can check back in tomorrow around this same time. [04:29] Trying [04:29] I'll let you know if it blows up [04:29] sounds good. here's hoping things just work :) [04:30] alright, see you all tomorrow [04:30] *** jvilk has quit IRC (leaving) [04:33] Thanks dad [04:34] (I don't know if I put this in the right place - but it's not EXPLODING so that's good [04:38] I'm going to: [04:39] - Finish this build of 39in1, then upload the replacement, see if it works now. [04:39] - Should just work, it doesn't do anything tricky [04:39] IF I got it right with where it goes, big if, then I'll do a7800 [04:39] If DFJustin thinks I got it in the wrong place, let me know [04:40] It'll be nice if it's a one-line fix PLUS a removal of another line that speeds it up [05:33] I don't know where you put it so I don't know if it's wrong or not :) [05:35] sorry got pulled away for an hour to wrestle this stubborn-ass kid into bed - it's in the genie files somewhere, lemme find it [05:35] should just go with all the other link options in scripts/genie.lua [05:36] once we find out if it works I can push that and the legacy gl thing to the mame repo [05:36] yeah, here most likely https://github.com/mamedev/mame/blob/3fd7f8ac576a9e40fcbc76184882bdf98d403537/scripts/genie.lua#L1160-L1179 [05:38] huh, we're still using LEGACY_GL_EMULATION? with the bgfx output driver that's likely not necessary anymore, might be worth seeing if it helps speed things up to remove that [05:42] We WERE [05:42] I updated [05:42] it DID speed things up [05:42] oh ok [05:42] sorry I guess yeah DFJustin did say that just before I noticed it huh :D [05:43] didn't get much sleep last night, one of the kids decided to get up at 2am and party until 6 [05:50] I BELIEVE I have it set now? [05:50] I'm doing a7800. [05:50] Then I will go back and if it works, ONLY if it works, I set off an infinite build, a master build [05:50] That will take 2 days [05:50] But I can place things in and compare size [05:51] To give you an idea, they removed the thing killing browserfs in 2019 [05:52] the thing? [05:53] guess I missed the thing [05:54] Sounds like we need A SUMMARY [05:54] ------------------------------------------ [05:54] In general, 0.239 works [05:54] It has a problem with browserfs looking for a feature that emscripten will now remove by default [05:54] We now put that back in, it should work [05:55] We also removed the GL_EMULATION setting so it just uses what Emscripten has, since it got its act together [05:55] There should generally be speedups [05:55] We will see [05:55] oh, the thing we just talked about, right [05:57] the gl_emulation thing was actually because when we started, MAME was using SDL video output which used opengl 1.3, but a couple years after we started / around the time when they accepted everything into their own codebase, bgfx became the default, and that uses proper modern GLES which ports cleanly to WebGL [06:09] I think I did something wrong [06:09] Here, let me show you [06:10] linkoptions { [06:10] "-Wl,--start-group", [06:10] "-O" .. _OPTIONS["OPTIMIZE"], [06:10] "-s USE_SDL=2", [06:10] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$ERRNO_CODES", [06:10] "-s USE_SDL_TTF=2", [06:10] "--memory-init-file 0", [06:10] "-s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__ZN15running_machine30emscripten_get_running_machineEv', '__ZN15running_machine17emscripten_get_uiEv', '__ZN15running_machine20emscripten_get_soundEv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_Pau [06:10] seAudio', '_SDL_SendKeyboardKey', '__ZN15running_machine15emscripten_saveEPKc', '__ZN15running_machine15emscripten_loadEPKc', '__ZN15running_machine21emscripten_hard_resetEv', '__ZN15running_machine21emscripten_soft_resetEv', '__ZN15running_machine15emscripten_exitEv']\"", [06:10] "-s EXPORTED_RUNTIME_METHODS=\"['cwrap']\"", [06:10] "-s ERROR_ON_UNDEFINED_SYMBOLS=0", [06:10] "-s USE_WEBGL2=1", [06:10] "-s GL_UNSAFE_OPTS=0", [06:10] "--pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js", [06:11] "--post-js " .. _MAKE.esc(MAME_DIR) .. "scripts/resources/emscripten/emscripten_post.js", [06:11] "--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/chains@bgfx/chains", [06:11] etc. [06:11] DFJustin: That seem right? [06:11] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$ERRNO_CODES", [06:13] Or does it need to be an array [06:14] I have literally no idea what I'm doing [06:14] hmm....yeah it might need to be the weirdly-escaped array syntax they use for the other ones. you might also need to escape $ as \$ [06:14] not 100% sure on either nor am I sure how to find out though [06:15] if you can find the link argument that gets run in the console when doing the final compile step though, that would be a good indicator of if it's trying to expand $ERRNO_CODES as a variable or not [06:16] also, you may need to run the "regenie" step to rebuild all the makefiles, if you aren't already doing that I can dig up how that works [06:16] make REGENIE=1 [06:19] so I guess I'd try it as "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\$ERRNO_CODES']\"", [06:22] confirmed it does want an array https://github.com/emscripten-core/emscripten/blob/ab334601cc2ca9332dd4e1cdd75baeca14728d5a/tools/ports/sdl2.py#L88 [06:23] in that case it's a .py script rather than a quoted string inside of a lua config though so inconclusive about needing to escape $ or not [06:25] it might be safe not to escape it since it's in single quotes within the array [06:26] it still uses SDL by default and not bgfx [06:26] so, I'd recommend trying "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['$ERRNO_CODES']\"", first and see if that works [06:27] DFJustin: oh, my bad - even for the emscripten builds? [06:27] yes [06:27] ah [06:31] I did a make clean [06:31] did the rm -rf mame/build [06:32] Trying with "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\$ERRNO_CODES']\"", [06:34] hmm, yeah I'm not familiar enough with the genie system to know if regenie does anything to the makefiles outside of the build/ directory [06:34] the output of the linker command in the console is the most conclusive way to be sure it's applying, but I know that's hard to find in the spam while it's building [06:35] it's normally the last thing it spits out before the last big pause [06:35] try without \$ first, just unescaped $ [06:36] it doesn't echo the linker command by default anymore [06:36] it should be enough to just add REGENIE=1 and not rm -rf build [06:36] I think it should be safe, since the purpose of the escaping is to make sure that the bash command it runs during that link command is clean, and bash doesn't do variable expansion inside single quotes [06:37] oh....guess it shows how long it's been since I've done a full recompile myself then :D [06:56] Built and uploaded [06:56] Same problem, meaning I got it wrong [06:56] Here's how I have it [06:57] "-O" .. _OPTIONS["OPTIMIZE"], [06:57] "-s USE_SDL=2", [06:57] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['$ERRNO_CODES']\"", [06:57] "-s USE_SDL_TTF=2", [06:57] "--memory-init-file 0", [06:57] Under that: [06:57] "-s EXPORTED_RUNTIME_METHODS=\"['cwrap']\"", [06:57] So that does seem like the proper escape [06:57] Does $ need it too [06:58] I also don't know where to put REGENIE [07:00] when you run the make command, instead of just "make -j4" or whatever, run it as "make REGENIE=1 -j4" [07:02] warning: undefined symbol: RRNO_CODES (referenced by top-level compiled C/C++ code) [07:02] warning: undefined symbol: glColor4f (referenced by top-level compiled C/C++ code) [07:02] warning: undefined symbol: glDisableClientState (referenced by top-level compiled C/C++ code) [07:03] huh, that's....promis....no, it's.....confusing? [07:03] I'm trying to get it to see things [07:05] I guess maybe try with \$ and see if that works. I'd expect, if it is doing unwanted variable expansion, for it to replace the whole '$ERRNO_CODES' block with '', but uhhhh maybe it's evaluating $E and leaving RRNO_CODES? [07:05] I'm trying "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\\$ERRNO_CODES']\"", [07:05] which makes no sense but then, linker commands embedded in bash strings embedded in lua configs is kind of crazy :D [07:05] warning: undefined symbol: \\RRNO_CODES (referenced by top-level compiled C/C++ code) [07:06] /1/MAME/mame/scripts/genie.lua:1164: invalid escape sequence near '"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE="['\$' [07:09] did you try it with just \$ instead of \\$ [07:09] Yes. [07:09] yeah, so double-\ is too much, but seems to imply that a single \ would work [07:09] \$ gives: [07:09] /1/MAME/mame/scripts/genie.lua:1164: invalid escape sequence near '"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE="['\$' [07:09] might need \\\$ [07:09] ffffuuhhhhhh [07:10] \\$ gives /1/MAME/mame/scripts/genie.lua:1164: invalid escape sequence near '"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE= [07:10] Sorry [07:10] I mean \\\$ gives /1/MAME/mame/scripts/genie.lua:1164: invalid escape sequence near '"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE= [07:10] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\\\$ERRNO_CODES']\"", [07:11] fuck it, go for broke and try 4 [07:16] It's not crashing against 4 [07:16] Let me see if it complains at the other point [07:16] The warning undefined symbol [07:16] warning: undefined symbol: \\RRNO_CODES (referenced by top-level compiled C/C++ code) [07:20] I don't really know what to think of that, why is it expanding $E and not the whole thing [07:21] Confounding me too, running out of tricks [07:23] Trying a tough one [07:23] I think probably just $ with no \ was correct the first time and something else is wrong [07:24] as a hack we could try modifying emscripten's src/library_fs.js to push it onto the list there instead of in our build command [07:24] similar to https://github.com/emscripten-core/emscripten/blob/1ae5dd3431fa0ccbe939c740d256dfb587b05198/src/library_fs.js#L2017 [07:25] I warning: undefined symbol: RRNO_CODES (referenced by top-level compiled C/C++ code) [07:25] warning: undefined symbol: glColor4f (referenced by top-level compiled C/C++ code) [07:25] Watch, I'll remove the $ and it will eay ERRNO_CODES I bet [07:25] yeah with https://archive.org/details/Food_Fight_1987_Atari_NTSC I'm getting a different error from the ERRNO_CODES error [07:26] RuntimeError: Aborted(TypeError: import object field 'env' is not an Object). Build with -s ASSERTIONS=1 for more info. [07:26] warning: undefined symbol: ERRNO_CODES (referenced by top-level compiled C/C++ code) [07:27] here's a stupid shell trick you could try [07:27] don't remove the $ [07:27] I removed it just to show it's hitting this [07:27] export E='$E' [07:27] bai I think something else is wrong [07:28] probably :D [07:28] do it how you had it before, "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['$ERRNO_CODES']\"", [07:28] that compiled which means it was probably right [07:28] OK, then [07:29] So YOUR theory is the warning just means the system is being an ass as it prints the error [07:30] I'm going off what you said Built and uploaded Same problem, meaning I got it wrong [07:30] I'm disbelieving that it's in fact the same problem [07:30] is there warning output if you build with "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['$ERRNO_CODES']\"", [07:30] warning: undefined symbol: RRNO_CODES (referenced by top-level compiled C/C++ code) [07:31] with the single dollar sign and no backslashes [07:31] Right [07:31] OK [07:31] warning: undefined symbol: RRNO_CODES (referenced by top-level compiled C/C++ code) [07:31] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['$ERRNO_CODES']\"", [07:31] so yes there is still escape fuckery going on [07:32] bai's idea might work but there has to be a better way [07:35] my idea is utterly stupid insanity and I agree that there's definitely a better way :D [07:35] I'm trying it in my environment [07:36] reproduced the RRNO_CODES thing [07:39] https://github.com/emscripten-core/emscripten/issues/7238#issuecomment-427663905 [07:40] switching quote types doesn't seem to work though [07:41] in that case he isn't escaping the " [07:41] so maybe that's related [07:43] Mine does not like it [07:43] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\'["$ERRNO_CODES"]\'", [07:45] We have run my clock, I need to go to bed [07:45] try export EMCC_DEBUG=1 before running make, I'm gonna assume that re-enabled dumping the link command [07:45] And heal more [07:47] I'll keep poking for a bit [07:47] yeah don't let emscripten get in the way of your health any more than it already does :D [08:22] ok I got it [08:23] "-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\\$$ERRNO_CODES']\"", [08:23] that was one of the stupider adventures I've had [08:28] *** Sgeo has quit IRC (Read error: Connection reset by peer) [15:07] *** Sgeo has joined #jsmess [17:54] Thanks [18:01] OK, we have ourselves a working thingamabob [18:01] I'm looking at a working asteroids. [18:01] Jesus, that was bleak, thanks DFJustin [18:20] wow [18:21] oh boy, $ is a special character in lua sttings too I guess [18:47] So, in total, the mods we do is The Line That Time Forgot (this ERRNO CODES one) [18:48] And removal of the LEGACY_GL_EMULATION line. [18:48] That should make it work fine for 0.239 going forward [18:50] The only other note is Alon suggests using LTO (-flto) to Emscripten, but I have no idea if that already happens or what it's involved in, or what the result is. [20:07] Well, Apple2e went in without a hitch [20:14] LTO is not currently on for MAME because it takes a lot of time and ram to build [20:15] might be doable for a single driver build though [20:18] basically that tries to run the optimizer on the entire executable at once instead of one source file at a time [20:19] should just be a matter of adding LTO=1 to the make command line [21:54] My attitude is: [21:54] Let this thing finish building. (It's 4 minutes a driver. It's at ba as we speak.) [21:54] Then, let's try... oh, 39in1. [21:57] Compare, see the differences. [21:57] I can't pause and start the masterbuilder, so I'll let it go [21:57] But it'll be neat to find [21:58] But you think I add LTO=1 and it will do the emscripten as well? [22:33] it should, I haven't tried though [23:08] I don't see any speed difference from removing legacy gl emulation