Giter Club home page Giter Club logo

Comments (12)

kateinoigakukun avatar kateinoigakukun commented on August 22, 2024 1

@yonihemi I improved the error message: 1a1b926

The input object file contains Foundation symbol but library.so.wasm doesn't have Foundation, so relocation failed. I guess you can get same result using wasm-ld

from chibi-link.

kateinoigakukun avatar kateinoigakukun commented on August 22, 2024 1

As far as I remember, Tokamak doesn't depend on Foundation. So if you want to use Foundation, you need to add -lFoundation -lCoreFoundation -lBlocksRuntime and so on... here

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

Thanks! I'll try to figure out why Foundation is not there.

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

I was missing the same 'unarchive and force link in each object' you've done for swiftSwiftOnoneSupport, which I've now done for all libraries (once I get it working I'll see what can be removed).

Now am stuck with swjs_ exports not being linked as exports in library.so.wasm. They're exported correctly in _CJavaScriptKit.c.owhich definitely is linked in. I've tried every permutation of --export-all, --export-dynamic, --export (also --no-entry for good measure).

from chibi-link.

kateinoigakukun avatar kateinoigakukun commented on August 22, 2024

@yonihemi Good catch! chibi-link doesn't export symbols that have WASM_SYM_EXPORTED flag yet. That's clearly missing implementation of chibi-link.

from chibi-link.

MaxDesiatov avatar MaxDesiatov commented on August 22, 2024

As far as I remember, Tokamak doesn't depend on Foundation.

It now does, we need Bundle to support the Image view.

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

I think it's the level before chibi-link, in wasm-ld.
If I wasm2wat production file then swjs_library_version is there as a function, but at my compiled lib it's not there.
20210315-library.so.wasm.zip

from chibi-link.

kateinoigakukun avatar kateinoigakukun commented on August 22, 2024

@yonihemi Hmm, could you tell me which linker options are you using? Are you using https://github.com/swiftwasm/swiftwasm-pad/blob/master/PreviewSystem/build-script.sh ?

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

Too many attempts to post, this is a random snapshot...
build-script.sh.zip

from chibi-link.

kateinoigakukun avatar kateinoigakukun commented on August 22, 2024

@yonihemi OK, I got the reason why the latest library.so doesn't have swjs_ prefixed symbols.

wasm-ld doesn't output export section when using --relocatable, so the produced object file doesn't have exported name info like swjs_library_version. So we need to rename internal function names to be the same as the exported names. After that, chibi-link can find swjs_library_version in object file and export it.

Here is a PR to address this issue. swiftwasm/JavaScriptKit#123

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

Excellent, thanks.
ChibiLink links successfully now, but I'm still not able to run linked module - somehow it's behaving differently (getting attempting to access detached ArrayBuffer errors).
Trying to isolate the source.

from chibi-link.

yonihemi avatar yonihemi commented on August 22, 2024

Still not sure where the issue is coming from. I'm trying with latest 5.4-SNAPSHOT-2021-03-25.
When building the library I link all except libswift_Concurrency because it has conflicting symbols with libswiftStandaloneRuntime.

Chibi links succesfully, emitting:

Warning: Linking subsection 'comdatInfo' is not supported now
Warning: Custom section 'producers' is currently not supported

20210326.zip

Finally, running the linked wasm breaks with:

TypeError: attempting to access detached ArrayBuffer
    clock_res_get webpack:///./node_modules/@wasmer/wasi/lib/index.esm.js?:111
    start webpack:///./node_modules/@wasmer/wasi/lib/index.esm.js?:131
    startWasiTask webpack:///./entrypoint/dev.js?:94
    async* webpack:///./entrypoint/dev.js?:105
    js http://127.0.0.1:9616/dev.js:97
    __webpack_require__ http://127.0.0.1:9616/dev.js:20
    <anonymous> http://127.0.0.1:9616/dev.js:84
    <anonymous> http://127.0.0.1:9616/dev.js:87

(clock_res_get is called with (3316844, 3316840))

dist.zip

from chibi-link.

Related Issues (2)

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.