[Csnd] Building the Emscripten version of Csound -- build errors
Date | 2024-04-21 20:24 |
From | Aaron Krister Johnson |
Subject | [Csnd] Building the Emscripten version of Csound -- build errors |
Attachments | link_errors.txt |
Hi all, following the README.md instructions for building the web-version of Csound (Emscripten/wasm), I run into the following. My system is Linux Mint 20, using the following emcc:
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
aaron@aaron-XPS-13-9350:~/Downloads/csound/Emscripten$ emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.57 (1df9c1977b49926c1efca672c31414da45c0c7bb) clang version 19.0.0git (https:/github.com/llvm/llvm-project ccdebbae4d77d3efc236af92c22941de5d437e01) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /home/aaron/Downloads/emsdk/upstream/bin Attached are the warnings/errors I see; it's all in the linking process. Any thoughts? |
Date | 2024-04-21 20:56 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
We're using nix to build the official webaudio csound builds (in the wasm folder) and have not spent much time keeping the Emscripten build up. That said, there's a PR that enables building with Emscripten and vcpkg: https://github.com/csound/csound/pull/1797 On Sun, Apr 21, 2024 at 3:24 PM Aaron Krister Johnson |
Date | 2024-04-21 23:01 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Ah, is there documentation for building with Nix? On Sun, Apr 21, 2024, 12:56 Steven Yi <stevenyi@gmail.com> wrote: We're using nix to build the official webaudio csound builds (in the |
Date | 2024-04-22 17:32 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Re: wasm builds being the "new way" for web-based Csound: I see that the *.nix files in `wasm/src` drive the build. And the `wasm/scripts` folder seems to be a wrapper around all that? Perhaps a little more verbose instructions about how this all works together being put into the `README.md` would make this more approachable for those curious/unafraid to build their own wasm builds....? Once someone answers these things, I'm happy to open a PR to flesh out this for others in precisely this way. On Sun, Apr 21, 2024 at 3:01 PM Aaron Krister Johnson <akjmicro@gmail.com> wrote:
|
Date | 2024-04-22 19:21 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
I think Hlodver could answer better as he set a lot of this up, but for me I have nix and yarn installed, then I go into the wasm folder and type 'yarn build'. That build's the @csound/wasm library. Next I go into the /wasm/browser folder and build with 'yarn build'. There's one additional step that if you want to build the browser library against the wasm library built in the first step, you'll have to yarn link them together. So that's cd wasm yarn build yarn link cd browser yarn link @csound/wasm yarn build >From there, I'll yarn link my other web projects to the @csound/browser library I built by running 'yarn link' in the wasm/browser folder, then in my web project I'll add the @csound/browser dependency to package.json and use 'yarn link @csound/browser' to override and use the local version (vs. using the npm published version). (FYI, I did notice a build issue with latest from develop; looks like build updates to cmake and files moving around didn't get updated in the wasm build. Will look at a PR shortly to fix that.) On Mon, Apr 22, 2024 at 12:32 PM Aaron Krister Johnson |
Date | 2024-04-22 21:29 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Thanks, Steven. One more question: As long as the built *.js, *.wasm resources are servable in general, we don't need to use node to serve them, right? Node is an option to serve them, or run the JS artifacts from the CLI, but it isn't strictly necessary? On Mon, Apr 22, 2024, 11:21 Steven Yi <stevenyi@gmail.com> wrote: I think Hlodver could answer better as he set a lot of this up, but |
Date | 2024-04-22 22:59 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Node is used to build the artifacts (what's in the wasm/browser/dist folder) and those are everything needed to use csound on the web. You can choose how you want to include those in your app (most typically using a build tool like npm or yarn, but not necessary). The browser build is meant for browser environments and not used with node. There is a separate nodejs folder for @csound/nodejs, for running on CLI or in a node server, but I do not think that has been maintained. On Mon, Apr 22, 2024 at 4:29 PM Aaron Krister Johnson |
Date | 2024-04-23 01:52 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Attachments | error.log |
Building the wasm with with `yarn build`....there seems to be an upstream error in some header...have you encountered this? The whole nix R/O filesystem is.....interesting.....but also super annoying, b/c you can't apply an edit to fix an include. See attached for the error. On Mon, Apr 22, 2024 at 2:59 PM Steven Yi <stevenyi@gmail.com> wrote: Node is used to build the artifacts (what's in the wasm/browser/dist |
Date | 2024-04-23 02:49 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Yes, I mentioned there are build problems at the moment. I got it to compile but it doesn't run as it looks like csound.nix is missing some files for when not building plugins. (This was a recent change in the develop branch that did not get updated in the wasm build.) I pushed a fix-wasm-build branch that has ongoing changes in case Victor or Hlodver have a chance to take a look, otherwise will be a day or two before I can get back to it. On Mon, Apr 22, 2024 at 8:53 PM Aaron Krister Johnson |
Date | 2024-04-23 03:20 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
FWIW, I was building from the master branch, and it didn't finish building at all. Googling the error, it seems like the errors were a common issue with gcc-13.2 LLVM (which I assume was a wrapper around clang, b/c I thought wasm/LLVM was a clang-only program). Anyway, no joy on my machine for master branch 'wasm' either. On Mon, Apr 22, 2024, 18:50 Steven Yi <stevenyi@gmail.com> wrote: Yes, I mentioned there are build problems at the moment. I got it to |
Date | 2024-04-23 20:59 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
While this thread is happening: might I ask why there are two "web Csound" build folders/techniques to begin with? Why was Emscripten abandoned in favor of nix/nix-build? In my limited experience with both build processes, the Emscripten one felt more natural and similar to a normal C/C++ process, while the nix one felt like I had zero 'hackability' over the process without a lot of extra boilerplate fidgeting. E.G. the "read-only" encrypted filesystem makes the already opaque build process even more so, and to change anything like a missing `#include` directive meant -- horrors -- creating a whole framework for "patching" the 3rd-party read-only artifacts, as opposed to just opening a file in an editor and adding a line. Yuk... :/ Anyway, how does the "Emscripten" folder, abandoned or not, relate to the "wasm", other than as a competing build technique?On Mon, Apr 22, 2024 at 7:20 PM Aaron Krister Johnson <akjmicro@gmail.com> wrote:
|
Date | 2024-04-23 21:00 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
s/encrypted/hash-labelled-read-only On Tue, Apr 23, 2024 at 12:59 PM Aaron Krister Johnson <akjmicro@gmail.com> wrote:
|
Date | 2024-04-29 15:00 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Emscripten was first and worked okay; Hlodver was working on a nix-based build using wasi and he optimized the build quite a bit (pretty large difference at the time), as well as added some features for dynamically loaded libraries. nix has good qualities for reproducible builds but has a bit of a learning curve. At this point, I'd like to see the nix build lean more on cmake; alternatively, it might be worth revisiting Emscripten for the @csound/wasm build and keep @csound/browser. The Emscripten build did both compile libcsound to wasm (with additional dependencies like libsndfile) as well as provided the JS code to load and use libcsound and provide an API that worked with ScriptProcessorNodes and AudioWorklets. The current wasm folder splits those two into @csound/wasm and @csound/browser. On Tue, Apr 23, 2024 at 3:59 PM Aaron Krister Johnson |
Date | 2024-04-29 21:52 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Thanks for the details, Steven. At the moment, is anyone having luck building web-csound either via EmScripten or `wasm`? If so, is this in the dev branch only?On Mon, Apr 29, 2024 at 7:00 AM Steven Yi <stevenyi@gmail.com> wrote: Emscripten was first and worked okay; Hlodver was working on a |
Date | 2024-04-29 22:53 |
From | Michael Gogins |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
You can use my cloud-5 release from here: https://github.com/gogins/cloud-5/releases It includes my build of Csound for WASM. For this to work, copy the files to the root of your Web directory, and serve your pieces from there. Best, Mike On Mon, Apr 29, 2024, 16:52 Aaron Krister Johnson <akjmicro@gmail.com> wrote:
|
Date | 2024-04-29 23:06 |
From | Steven Yi |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Is there any reason you're not using the released built versions of Web Csound? That's all you need to build web apps with Csound. BTW: I also ported a fix from develop to the csound6 branch (fixes libsndfile and libmpg123 nix files). That should now build with `yarn build`. On Mon, Apr 29, 2024 at 4:52 PM Aaron Krister Johnson |
Date | 2024-04-30 00:39 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Thanks, nice to know this option is there! On Mon, Apr 29, 2024 at 2:53 PM Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2024-04-30 00:44 |
From | Aaron Krister Johnson |
Subject | Re: [Csnd] Building the Emscripten version of Csound -- build errors |
Hi Steven, On Mon, Apr 29, 2024 at 3:07 PM Steven Yi <stevenyi@gmail.com> wrote:
You can think of me as an additional tester of compile issues in this regard, and I'm happy to do so.
Excellent news, I will try it out.
|