Skip to content

Issue with 'hello world' example #8

@jgranduel

Description

@jgranduel

A regression with perry-0.48 on WSL at least (perry doctor fine and code compiled with previous version) :

# Initialize a new project
perry init my-project
cd my-project

# Compile and run
perry compile src/main.ts -o myapp

Collecting modules...
Found 1 module(s): 1 native, 0 JavaScript
Generating code...

Module init order (0 modules):

Wrote object file: main_ts.o
  Generating stubs for 9 missing symbols (0 data, 9 functions, 0 identity)
    - js_call_function
    - js_new_from_handle
    - js_runtime_init
    - js_set_property
    - js_create_callback
    - js_get_export
    - js_load_module
    - js_new_instance
    - js_await_js_promise
Linking (runtime-only)...
/usr/bin/ld: cannot find -lpulse-simple: No such file or directory
/usr/bin/ld: cannot find -lpulse: No such file or directory
collect2: error: ld returned 1 exit status
Error: Linking failed

also, probably linked:

perry run .
error: invalid value '.' for '[PLATFORM]'
  [possible values: macos, ios, watchos, tvos, android, linux, windows, web]

For more information, try '--help'.

I tried like what I've seen in issue #6 : asking a quick diagnostic to Claude:

The error has nothing to do with your TypeScript code. It's a linker regression in perryts v0.48 where the build system unconditionally passes -lpulse-simple and -lpulse (PulseAudio libraries) to the linker — even for a pure CLI "Hello World" that has no audio whatsoever.
On WSL, PulseAudio dev libraries are typically not installed (WSL has no native audio subsystem), so ld can't find them and the link step fails.
There are two layers to the problem:

perryts bug: the compiler is emitting audio library flags as part of its default "runtime-only" link profile, which shouldn't be needed for a CLI app. Since you're on v0.48 and this is almost certainly an overly broad link config that should be guarded behind a feature flag or platform check.
WSL environment: even if the flag were intentional, WSL doesn't ship libpulse-dev by default, so any unconditional dependency on it will break here.

Workarounds to try :
Install the missing dev libraries (quick fix)
bash $ sudo apt update
sudo apt install libpulse-dev
This satisfies the linker. The libraries won't actually be used at runtime by a hello world, but the link will succeed.

An indeed, compilation was successful:

my-project$ ./myapp
Hello from Perry 😊!

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