Replies: 16 comments 3 replies
-
Hmmm. Cleaned up and asked ChatGPT: The list of imports you've mentioned predominantly consists of standard WASI API functions. These functions provide a wide range of systems interface capabilities such as file and directory operations, environment variable access, clock and time functions, and socket operations. Here’s a breakdown of what these functions typically do: Standard WASI Imports
Identification of Non-standard ElementsFrom your list, all the functions are typical WASI functions that deal with system-level operations necessary for WebAssembly to interact with the host environment securely and portably. There doesn't seem to be a non-standard or custom entry in your list now. If your WASM module continues to have issues related to imports, it might be with how these are implemented or linked within your Swift program or runtime environment. Ensure that your WASI-compatible environment or runtime such as Wasmer, Wasmtime, or another similar WebAssembly runtime has proper support and links for these functions. If you still encounter unexpected import errors, those might pertain to other configuration or environmental factors not directly visible from this list of imports. |
Beta Was this translation helpful? Give feedback.
-
Ok, problem must be somewhere else. All imports look wrong. I will close this for now. |
Beta Was this translation helpful? Give feedback.
-
I used wasm2wat of the resulting wasm and found that indeed the imports are somehow renamed: |
Beta Was this translation helpful? Give feedback.
-
This is a good guess for what is happening: WebAssembly/wabt#2402
So, now i need to find the right place to add this option ;-) |
Beta Was this translation helpful? Give feedback.
-
Where can I do this best? |
Beta Was this translation helpful? Give feedback.
-
A few questions to help point you in the right direction:
|
Beta Was this translation helpful? Give feedback.
-
Swift, via WasmKit (https://github.com/swiftwasm/WasmKit/tree/main)
On a mac. So, i use your OSX branch https://github.com/GordonSmith/hpcc-js-wasm/tree/OSX_TES
|
Beta Was this translation helpful? Give feedback.
-
(or you want to load the graphviz wasm file into WasmKit?) |
Beta Was this translation helpful? Give feedback.
-
Right now as part of an macOS app.
Later iOS app. And yes, I want to use it as well in a browser, where my app
will become another WASM.
*Vithanco / Klaus Kneupner*
See for yourself how you can combine your brain power with structured
visuals to help you think: https://vithanco.com/newsletter.
The home of Structured Visual Thinking: www.vithanco.com
<https://vithanco.com>.
…On Mon, 20 Jan 2025 at 11.49, Gordon Smith ***@***.***> wrote:
2. Where do you want to execute your wasm file (web browser or other)?
—
Reply to this email directly, view it on GitHub
<#295 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFFOMBIQB7L7UVLYVLL5RT2LTIEFAVCNFSM6AAAAABVPAFK2WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBYHEYTKNA>
.
You are receiving this because you modified the open/close state.Message
ID: <hpcc-systems/hpcc-js-wasm/repo-discussions/295/comments/11889154@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
For that use case you need a standalone wasm (emscriptens naming convention), in the future you will want to use WIT and Components but I don't think swift supports that yet?
Where layout and lastError are of interest. Note: The WASI imports required are listed here (these are the functions your host application has to expose the the wasm guest):
For simple calls to "layout" I don't think any of those will be used, but if you need to pass in jpegs or similar they will be... |
Beta Was this translation helpful? Give feedback.
-
Impressive, how you add these pieces so fast for me!
I merged both branches and it works so far.
Thank you.
…On Mon, Jan 20, 2025 at 3:18 PM Gordon Smith ***@***.***> wrote:
For that use case you need a standalone wasm (emscriptens naming
convention), in the future you will want to use WIT and Components but I
don't think swift supports that yet?
This PR has a quick example:
https://github.com/hpcc-systems/hpcc-js-wasm/pull/296/files - once you
build the wasm you should see the export list looks like:
(table (;0;) 834 834 funcref)
(memory (;0;) 260 260)
(global (;0;) (mut i32) (i32.const 249456))
(export "memory" (memory 0))
(export "layout" (func 1460))
(export "lastError" (func 1418))
(export "__indirect_function_table" (table 0))
(export "free" (func 9))
(export "malloc" (func 27))
(export "_initialize" (func 1504))
Where layout and lastError are off interest.
Note: The WASI imports required are listed here (these are the functions
your host application has to expose the the wasm guest):
(import "wasi_snapshot_preview1" "fd_close" (func (;0;) (type 4)))
(import "wasi_snapshot_preview1" "fd_write" (func (;1;) (type 7)))
(import "wasi_snapshot_preview1" "fd_read" (func (;2;) (type 7)))
(import "wasi_snapshot_preview1" "fd_seek" (func (;3;) (type 109)))
(import "wasi_snapshot_preview1" "environ_get" (func (;4;) (type 1)))
(import "wasi_snapshot_preview1" "environ_sizes_get" (func (;5;) (type 1)))
(import "env" "__syscall_faccessat" (func (;6;) (type 7)))
(import "wasi_snapshot_preview1" "proc_exit" (func (;7;) (type 2)))
(import "wasi_snapshot_preview1" "clock_time_get" (func (;8;) (type 49)))
For simple calls to "layout" I don't think any of those will be used, but
if you need to pass in jpegs or similar they will be...
—
Reply to this email directly, view it on GitHub
<#295 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFFOMEFAMJRLNPOH7GOXT32LUAVDAVCNFSM6AAAAABVPAFK2WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBZGEYTOMY>
.
You are receiving this because you modified the open/close state.Message
ID: <hpcc-systems/hpcc-js-wasm/repo-discussions/295/comments/11891173@
github.com>
--
*Vithanco / Klaus Kneupner*
See for yourself how you can combine your brain power with structured
visuals to help you think: https://vithanco.com/newsletter.
The home of Structured Visual Thinking: www.vithanco.com
<https://vithanco.com>.
|
Beta Was this translation helpful? Give feedback.
-
Apple silicon
*Vithanco / Klaus Kneupner*
See for yourself how you can combine your brain power with structured
visuals to help you think: https://vithanco.com/newsletter.
The home of Structured Visual Thinking: www.vithanco.com
<https://vithanco.com>.
…On Wed, 22 Jan 2025 at 08.26, Gordon Smith ***@***.***> wrote:
I happened to be noodling in the project at the time!
Quick question are you running on Apple Silicon or Intel?
—
Reply to this email directly, view it on GitHub
<#295 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFFOMC5YQQHXXQXL4P7CX32L5BZTAVCNFSM6AAAAABVPAFK2WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJRGIYDSNY>
.
You are receiving this because you modified the open/close state.Message
ID: <hpcc-systems/hpcc-js-wasm/repo-discussions/295/comments/11912097@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Indeed, it is a path problem.
I added /opt/homebrew/opt/bison/bin to my path
…On Wed, Jan 22, 2025 at 8:40 AM Gordon Smith ***@***.***> wrote:
I am getting the following error when building on Apple Silicon (in the GH
Runner):
CMake Error at /opt/homebrew/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find BISON: Found unsuitable version "2.3", but required is at
least "3.0" (found /usr/bin/bison)
Call Stack (most recent call first):
/opt/homebrew/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:601 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/share/cmake/Modules/FindBISON.cmake:306 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/Users/runner/work/hpcc-js-wasm/hpcc-js-wasm/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
CMakeLists.txt:80 (find_package)
I am pretty sure, its just a pathing issue here:
https://github.com/GordonSmith/hpcc-js-wasm/blob/OSX_TEST/.github/workflows/test-pr.yml#L43-L52
Can you track down where brew actually installs the 3.x Bison?
—
Reply to this email directly, view it on GitHub
<#295 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFFOMAY2N6JNQPJOAZGK532L5DOPAVCNFSM6AAAAABVPAFK2WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJRGIZTGMY>
.
You are receiving this because you modified the open/close state.Message
ID: <hpcc-systems/hpcc-js-wasm/repo-discussions/295/comments/11912333@
github.com>
--
*Vithanco / Klaus Kneupner*
See for yourself how you can combine your brain power with structured
visuals to help you think: https://vithanco.com/newsletter.
The home of Structured Visual Thinking: www.vithanco.com
<https://vithanco.com>.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
How are string parameters working? The layout function has this layout: |
Beta Was this translation helpful? Give feedback.
-
(this is the standard wasi ABI mechanism) |
Beta Was this translation helpful? Give feedback.
-
UPDATE:
The problem seems to be that the WASM imports are minimised in emscripten, but i need them with proper names. (Best to read from the bottom).
Would you please be able to point out how you would integrate such a switch? Especially, as I don't want to change your standard build process.
My apologies, if this has. nothing to do with the WASM that is created here. But it could easily be. Is there a specific requirement, one beyond the standard WASI API?
Background:
I started looking into using the WASM. I use WasmKit and follow this example: https://github.com/swiftwasm/WasmKit/blob/main/Examples/Sources/WASI-Hello/Hello.swift
The debugPrint gives me this:
but the instantiation leads to:
Error: ImportError(message: WasmKit.ImportError.Message(text: "unknown import a.a"))
Beta Was this translation helpful? Give feedback.
All reactions