Description
When I try to instantiate gifsicle.wasm (built from https://github.com/kohler/gifsicle), an exception is thrown.
The built binary gifsicle works in the CLI. But gifsicle.wasm does not work with Endive.
Steps to reproduce
- Clone https://github.com/biggujo/endive-gifsicle-problem.
- Run
Main.java.
How to Build WASM
If you need to create a WASM by yourself, do the following.
- Clone and open https://github.com/biggujo/endive-autotools.
- Build Dockerfile:
docker build -t emscripten-autotools:6.0.1 ..
- Clone and open https://github.com/kohler/gifsicle.
- Build:
docker run \
--rm \
-v $(pwd):/src \
-u $(id -u):$(id -g) \
emscripten-autotools:6.0.1 \
autoreconf -i
docker run \
--rm \
-v $(pwd):/src \
-u $(id -u):$(id -g) \
emscripten-autotools:6.0.1 \
emconfigure ./configure
docker run \
--rm \
-v $(pwd):/src \
-u $(id -u):$(id -g) \
emscripten-autotools:6.0.1 \
emmake make
- Copy
src/gifsicle.wasm to endive-gifsicle-problem repository folder: endive-gifsicle-problem/src/main/resources/gifsicle.wasm.
Expected Behavior
gifsicle works in CLI (if you run src/gifsicle after build).
gifsicle works in Endive.
Actual Behavior
gifsicle works in CLI (if you run src/gifsicle after build).
gifsicle does not work in Endive.
Attachments
Java source code:
package com.example;
import run.endive.wasm.Parser;
import run.endive.runtime.Instance;
import java.io.File;
import java.net.URISyntaxException;
public class Main {
static void main() throws URISyntaxException {
var file = new File(Main.class.getResource("/gifsicle.wasm").toURI());
var module = Parser.parse(file);
var instance = Instance.builder(module).build(); // throws here
}
}
Exception output:
Exception in thread "main" run.endive.wasm.UnlinkableException: unknown import, could not find host function for import number: 0 named env.__assert_fail
at run.endive.runtime.Instance$Builder.mapHostImports(Instance.java:1013)
at run.endive.runtime.Instance$Builder.build(Instance.java:1075)
at ua.karazin.Main.main(Main.java:12)
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>endive-gifsicle-problem</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>run.endive</groupId>
<artifactId>runtime</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Screenshot of the built working gifsicle in CLI:
Occurrence Frequency
3/3. I tried building WASM multiple times.
Environment
- macOS 15.5 (24F74).
- Docker version 28.1.1, build 4eba377.
Java:
openjdk version "25" 2025-09-16
OpenJDK Runtime Environment (build 25+36-3489)
OpenJDK 64-Bit Server VM (build 25+36-3489, mixed mode, sharing)
Description
When I try to instantiate
gifsicle.wasm(built from https://github.com/kohler/gifsicle), an exception is thrown.The built binary
gifsicleworks in the CLI. Butgifsicle.wasmdoes not work with Endive.Steps to reproduce
Main.java.How to Build WASM
If you need to create a WASM by yourself, do the following.
docker build -t emscripten-autotools:6.0.1 ..src/gifsicle.wasmtoendive-gifsicle-problemrepository folder:endive-gifsicle-problem/src/main/resources/gifsicle.wasm.Expected Behavior
gifsicleworks in CLI (if you runsrc/gifsicleafter build).gifsicleworks in Endive.Actual Behavior
gifsicleworks in CLI (if you runsrc/gifsicleafter build).gifsicledoes not work in Endive.Attachments
Java source code:
Exception output:
pom.xml:Screenshot of the built working
gifsiclein CLI:Occurrence Frequency
3/3. I tried building WASM multiple times.
Environment
Java: