Skip to content

Using the fetch API #3

Description

@jgranduel

Thanks for this amazing project!

First time I can compile perry on WSL, and after a hello world, I have tried to compile a simple fetch query. It's not yet supported, right, but I can't compile with --enable-js-runtime neither. I took the function getData defined in https://developer.mozilla.org/fr/docs/Web/API/Fetch_API/Using_Fetch as a canonical example.

$ perry compile src/main.ts --enable-js-runtime
Collecting modules...
Found 1 module(s): 1 native, 0 JavaScript
Generating code...

Module init order (0 modules):

Wrote object file: main_ts.o
Linking (runtime-only)...
Using V8 JavaScript runtime for JS module support
/usr/bin/ld: /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_runtime-d9bfb8e27a475660.perry_runtime.596a7181d0bac965-cgu.0.rcgu.o): in function `js_await_any_promise':
perry_runtime.596a7181d0bac965-cgu.0:(.text.js_await_any_promise+0x0): multiple definition of `js_await_any_promise'; /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_jsruntime-2bc0219207bcc988.perry_jsruntime.1c5dee8d130ae367-cgu.0.rcgu.o):perry_jsruntime.1c5dee8d130ae367-cgu.0:(.text.js_await_any_promise+0x0): first defined here
/usr/bin/ld: /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_runtime-d9bfb8e27a475660.perry_runtime.596a7181d0bac965-cgu.0.rcgu.o): in function `js_handle_array_get':
perry_runtime.596a7181d0bac965-cgu.0:(.text.js_handle_array_get+0x0): multiple definition of `js_handle_array_get'; /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_jsruntime-2bc0219207bcc988.perry_jsruntime.1c5dee8d130ae367-cgu.0.rcgu.o):perry_jsruntime.1c5dee8d130ae367-cgu.0:(.text.js_handle_array_get+0x0): first defined here
/usr/bin/ld: /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_runtime-d9bfb8e27a475660.perry_runtime.596a7181d0bac965-cgu.0.rcgu.o): in function `js_handle_array_length':
perry_runtime.596a7181d0bac965-cgu.0:(.text.js_handle_array_length+0x0): multiple definition of `js_handle_array_length'; /path/to/perry/perry/target/release/libperry_jsruntime.a(perry_jsruntime-2bc0219207bcc988.perry_jsruntime.1c5dee8d130ae367-cgu.0.rcgu.o):perry_jsruntime.1c5dee8d130ae367-cgu.0:(.text.js_handle_array_length+0x0): first defined here
collect2: error: ld returned 1 exit status
Error: Linking failed
$ perry doctor 
Perry Doctor

Environment Checks
──────────────────
  ✓ perry version: 0.2.177
  ✓ update status: up to date
  ✓ system linker (cc): cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
  ✓ runtime library: /path/to/perry/target/release/libperry_runtime.a
  ✓ project config (perry.toml): found

All checks passed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions