-
-
Notifications
You must be signed in to change notification settings - Fork 35
Open
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.
elebeaup and bryphebryphe
Metadata
Metadata
Assignees
Labels
No labels