orca-app / orca

A Wasm environment for cross-platform, sandboxed graphical applications.
https://orca-app.dev
Other
156 stars 13 forks source link

C tooling #55

Closed bitwitch closed 4 months ago

bitwitch commented 5 months ago
martinfouilleul commented 5 months ago

Hey, it's great! Here are some notes:

Tool

CI

Misc

TODOs

(just making a note for myself of what's left before we can use this both in dev and user modes)

bitwitch commented 5 months ago

Do we really want to let users override system orca dir? It seems like it could lead to using some version of the tool with another version of the source/libs.

Oh yeah probably not, this was an option from before that I left in. I will remove it.

Why is there source in release in addition to sources inside the tarball?

The two files Source code (zip) and Source code (tar.gz) are just there by default in github releases, it includes the entire repo. I don't know if these can be disabled but I can look, if we want to exclude them. The src dir inside each platform specific tarball is needed because it includes source files generated by building the runtime, like bindings, that don't exist in the repo source.

Some files have formatting that's a little inconsistent with our clang-format config, eg braces on the right, etc. and some have windows line endings (I never remember the git incantations for that, it's a pain...)

Ah yeah sorry about that. I'm not used to using clang so I didn't even think of using clang-format. I'll clean it up.

Thanks for the great notes, I will start looking into the rest of these.

bitwitch commented 5 months ago

What's the reason for the changes in ui.c? Did MSVC complain, or is it to avoid a buggy conversion (in the latter case should the macro be made more explicit wrt conversions)? Anyway we should probably split that out from this PR.

The commit in question is 4ff922b6de0d176c1b907c932358a5e112ec514a , @rdunnington do you remember the reason for the changes in ui.c here?

rdunnington commented 5 months ago

Yeah there are differences in how clang defines size_t on windows vs macOS, which was triggering errors in how we were dealing with it when passing size_t variables to the _Generic macro. The comment in the commit has some more details. I remember doing a few rounds of this until we finally landed on a solution that built on all platforms.

martinfouilleul commented 5 months ago

ah yeah I remember this one. Does this mean that the casts in ui.c were a temporary workaround to silence those errors, and can now be safely removed?

rdunnington commented 5 months ago

Hmm, maybe, I forget the exact details. We could probably try but would need to build a few scenarios:

bvisness commented 5 months ago

I see the tooling build still uses MSVC on Windows - can/should we switch to using clang? I feel like we talked about doing this before, since everyone will need clang for their wasm compiles anyway.

martinfouilleul commented 5 months ago

Yes, agreed

bitwitch commented 5 months ago

I see the tooling build still uses MSVC on Windows - can/should we switch to using clang? I feel like we talked about doing this before, since everyone will need clang for their wasm compiles anyway.

Oh I see. Well libcurl and zlib are both compiled using msvc (they both use nmake). zlib seems like it is relatively straightforward so it could probably be manually compiled with clang, but libcurl is not straightforward. I really don't know how to go about building it with clang.

martinfouilleul commented 4 months ago

Nice work! could you squash these into one (or a few) commits, also excluding ui.c? I think I'll merge that first, then we can continue work on the orca-libc branch to integrate the libc.

martinfouilleul commented 4 months ago

You also have some CRLF in here (eg at the beginning of bundle.c), what are your settings for git config core.autocrlf?

martinfouilleul commented 4 months ago

On macOS I also get this when trying to build the tool locally:

./osx_system.c:249:13: error: initializing 'oc_str8' (aka 'struct oc_str8') with an expression of incompatible type 'char *'
  249 |     oc_str8 path_cstr = oc_str8_to_cstring(a, path);
      |             ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
./osx_system.c:250:21: error: passing 'oc_str8' (aka 'struct oc_str8') to parameter of incompatible type 'const char *'
  250 |         DIR *dir = opendir(path_cstr);
      |                            ^~~~~~~~~
martinfouilleul commented 4 months ago

A couple other things from trying to follow the user workflow on macOS:

bitwitch commented 4 months ago

Nice work! could you squash these into one (or a few) commits, also excluding ui.c? I think I'll merge that first, then we can continue work on the orca-libc branch to integrate the libc.

Alright I squished it. I excluded commit 4ff922b6de0d176c1b907c932358a5e112ec514a which had the changes to ui.c. Note that there were also some changes in that commit to src/util/macros.h.

martinfouilleul commented 4 months ago

Nice work! could you squash these into one (or a few) commits, also excluding ui.c? I think I'll merge that first, then we can continue work on the orca-libc branch to integrate the libc.

Alright I squished it. I excluded commit 4ff922b which had the changes to ui.c. Note that there were also some changes in that commit to src/util/macros.h.

Thanks, I cherry picked this commit and applied it on main separately.

martinfouilleul commented 4 months ago

Ok I'm going to merge this since we have enough of the workflows fleshed out and I want to start using the new tooling on the other fronts. Remaining work on the tooling can be done as additional incremental PRs.