Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WebAssembly build #258

Open
Open
@easbar

Description

Can you give some advice how to compile libvim to WebAssembly? its mentioned in the README.md but I could not find any instructions how this is done.

I do not know the esy tool very well, but I think I was able to build the library under linux using this script in src/build (running it from src):

# build in this folder
cur__install=my_build_wasm
# the lib folder is not created by the makefile for some reason -> created it manually
mkdir -p $cur__install/lib
emconfigure ./configure --disable-selinux CFLAGS=-fPIC
emmake make installlibvim DESTDIR=$cur__install

There were some failing checks though (not sure if this is the problem):

checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
 You need to install a terminal library; for example ncurses.
 Or specify the name of the library with --with-tlib.

Anyway I got a libvim.a file and tried compiling this code:

#include <stdio.h>
#include "libvim.h"
void sayHello() {
 printf("hello\n");
}
int main(int argc, char** argv) {
 vimInit(argc, argv);
 sayHello();
}

using this command:

emcc -Iinclude -Iinclude/proto -DHAVE_CONFIG_H -fPIC main.c lib/libvim.a -o index.html

But then I got this error:

wasm-ld: error: unknown file type: libvim.o

This works fine using gcc:

# after running the same build script but with configure/make instead of emconfigure/emmake
gcc -Iinclude -Iinclude/proto -DHAVE_CONFIG_H main.c lib/libvim.a -lSM -lICE -lXt -lX11 -lXdmcp -lm -ltinfo -lnsl -ldl

Any idea what could be wrong? Did you have success using this library with WebAssembly yet? If so it would be great if you could add some directions how.

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

        AltStyle によって変換されたページ (->オリジナル) /