Coder Social home page Coder Social logo

Make this repo build again about wasmtime-zig HOT 2 OPEN

voigt avatar voigt commented on May 24, 2024
Make this repo build again

from wasmtime-zig.

Comments (2)

kubkon avatar kubkon commented on May 24, 2024

I took a look and the missing symbols are provided by libunwind (also note that the errors pop up in the first place since Zig/lld will prefer linking against static libs first). Zig ships libunwind and so we only need to explicitly specify that we want to link against in the build.zig script. Here's the diff, feel free to use it and no attribution is necessary:

diff --git a/build.zig b/build.zig
index 0b07c15..9c5ab2b 100644
--- a/build.zig
+++ b/build.zig
@@ -33,10 +33,19 @@ pub fn build(b: *std.build.Builder) !void {
         .source = .{ .path = "src/main.zig" },
         .dependencies = &.{pkgs.wasm},
     });
-    if (builtin.os.tag == .windows) {
-        simple_exe.linkSystemLibrary("wasmtime.dll");
-    } else {
-        simple_exe.linkSystemLibrary("wasmtime");
+    switch (builtin.os.tag) {
+        .windows => {
+            simple_exe.linkSystemLibrary("wasmtime.dll");
+            simple_exe.linkSystemLibrary("unwind");
+        },
+        .linux => {
+            simple_exe.linkSystemLibrary("wasmtime");
+            simple_exe.linkSystemLibrary("unwind");
+        },
+        .macos => {
+            simple_exe.linkSystemLibrary("wasmtime");
+        },
+        else => unreachable,
     }
     simple_exe.linkLibC();
     simple_exe.step.dependOn(b.getInstallStep());

Note that on macOS we always link dynamically and libcand libunwind are provided by the OS and always available so no need to link against it there.

Once you get everything building again, I'd really appreciate a PR with the fixed :-)

from wasmtime-zig.

voigt avatar voigt commented on May 24, 2024

Thanks a lot, @kubkon, for looking into the problem.

I was able to incorporate your changes into build.zig. While Linux finally builds, Windows still complains about "FILENOTFOUND" stuff...

D:\a\wasmtime-zig\wasmtime-zig\zig-windows-x86_64-0.10.0-dev.2473+e498fb155\lib\std\os\windows.zig:1593:32: 0x7ff78d4627eb in td.os.windows.CreateProcessW (build.obj)
            .FILE_NOT_FOUND => return error.FileNotFound,

I'd appreciate it if you could have another look.

Apart from that, I started fixing the examples. This might take a couple of days (currently a bit limited in time)

Once you get everything building again, I'd appreciate a PR with the fixed :-)

This is my goal :)

from wasmtime-zig.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.