Porting LilyPond to WebAssembly, Part 1

Ok, first i set up the Emscripten environment, following the tutorial

skainz@cp19-26:~/privat/WASMPond$ source ${EMSDKDIR}/emsdk_env.sh
Adding directories to PATH:
PATH += /home/skainz/privat/webassembly/emsdk
PATH += /home/skainz/privat/webassembly/emsdk/upstream/emscripten
PATH += /home/skainz/privat/webassembly/emsdk/node/14.18.2_64bit/bin

Setting environment variables:
PATH = /home/skainz/privat/webassembly/emsdk:/home/skainz/privat/webassembly/emsdk/upstream/emscripten:/home/skainz/privat/webassembly/emsdk/node/1
4.18.2_64bit/bin:/home/skainz/perl5/bin:/home/skainz/.krew/bin:/home/skainz/.cargo/bin:/home/skainz/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/lo
cal/games:/usr/games
EMSDK = /home/skainz/privat/webassembly/emsdk
EM_CONFIG = /home/skainz/privat/webassembly/emsdk/.emscripten
EMSDK_NODE = /home/skainz/privat/webassembly/emsdk/node/14.18.2_64bit/bin/node

Well, looks good so far!

After downloading LilyPond, i gunzip/untar the source file and run the emscripten configure wrapper, while results in this:

skainz@cp19-26:~/privat/WASMPond/lilypond-2.22.2$ emconfigure ./configure --prefix=${TARGET_DIR}
configure: ./configure --prefix=/home/skainz/privat/WASMPond/out
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gmake... no
checking for make... make
checking for find... find
checking for tar... tar
checking for python... python3
checking python3 version... 3.7.3
checking for python3... /usr/bin/python3
checking for gcc... /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emcc accepts -g... yes
checking for /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether compiler understands -pipe... yes
checking for fc-list... fc-list
checking for TeX Gyre fonts OTF files... yes
checking for URW++ OTF files... no
checking for python... /usr/bin/python3
checking /usr/bin/python3 version... 3.7.3
checking for /usr/bin/python3... (cached) /usr/bin/python3
checking whether we are using the GNU C++ compiler... yes
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ accepts -g... yes
checking for ar... /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emar
checking for ranlib... /home/skainz/privat/webassembly/emsdk/upstream/emscripten/emranlib
checking for bison... bison -y
checking for bison... bison
checking bison version... 3.3.2
checking for flex... flex
checking how to run the C++ preprocessor... /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ -E
checking FlexLexer.h usability... no
checking FlexLexer.h presence... no
checking for FlexLexer.h... no
checking for yyFlexLexer.yypop_buffer_state ()... no
checking for gettext in -lintl... no
checking for gettext... yes
checking for msgfmt... msgfmt
checking for mf-nowin... mf-nowin
checking for mpost... mpost
checking for working metafont mode... ljfour
checking for kpsewhich... kpsewhich
checking for metapost required files... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for guile-1.8 >= 1.8.2... no
checking for guile-2.2 >= 2.2.0... no
checking libguile18.h usability... no
checking libguile18.h presence... no
checking for libguile18.h... no
checking for scm_t_hash_fold_fn... no
checking for scm_t_subr... no
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ supports -Werror=unknown-warning-option... yes
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ supports -Wcast-function-type... yes
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ supports -Wsequence-point... yes
checking whether /home/skainz/privat/webassembly/emsdk/upstream/emscripten/em++ supports -Wsuggest-override... yes
checking for usable C++ demangler... yes
checking for fontforge... fontforge
checking for fontforge... /usr/bin/fontforge
checking /usr/bin/fontforge version... 20170924
checking for t1asm... t1asm
checking for t1asm... /usr/bin/t1asm
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking libio.h usability... no
checking libio.h presence... no
checking for libio.h... no
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking for sys/stat.h... (cached) yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking whether stat file-mode macros are broken... no
checking for working memcmp... yes
checking for vprintf... yes
checking for _doprnt... no
checking for chroot... yes
checking for gettext... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking /usr/bin/pkg-config version... 0.29
checking for rpath linkage... no
checking for pangoft2 >= 1.38.0... no
Package pangoft2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangoft2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangoft2' found
checking for pangoft2 >= 1.36.0... no
Package pangoft2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangoft2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangoft2' found
checking for fontconfig >= 2.4.0... no
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
checking for freetype2 >= 2.3.9... no
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
checking for glib-2.0 >= 2.38... no
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
checking for gobject-2.0 >= 2.38... no
Package gobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-2.0' found
checking for some flavor of Windows... no
checking for -windres... no
checking for x86_64-pc-linux-gnu-windres... no
checking for windres... no
checking for guile... guile
checking guile version... 2.2.4
checking for guile... guile
checking for guile... /usr/bin/guile
checking for perl... perl
checking for perl... /usr/bin/perl
checking for tidy... no
checking for gs... gs
checking for gs... /usr/bin/gs
checking /usr/bin/gs version... 9.27
checking for gs... gs
checking gs version... 9.27
checking for extractpdfmark... no
checking for makeinfo... makeinfo
checking makeinfo version... 6.5
checking for texi2html... texi2html
checking texi2html version... 1.82
checking for dblatex... no
checking for bibtex... bibtex
checking for xelatex... no
checking for pdflatex... pdflatex
checking for pdfetex... pdfetex
checking for texi2pdf... texi2pdf
checking for texindex... texindex
checking for epsf.tex... /usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
checking for Cyrillic characters support in TeX... yes
checking for convert... convert
checking for zip... zip
checking for rsync... rsync
configure: creating ./config.status
config.status: creating config.make
config.status: creating config.hh

WARNING: Please consider installing optional programs or files:  URW++ OTF fonts (download OTF files from 'http://git.ghostscript.com/?p=urw-core35-fonts.git;a=tree;hb=91edd6ece36e84a1c6d63a1cf63a1a6d84bd443a' and put them under '~/.local/share/fonts' etc., or use --with-urwotf-dir) libpango1.0-dev or pango?-devel >= 1.38.0 (It is required if you'd like to use OpenType font feature. installed: ) tidy extractpdfmark (Using GhostScript >= 9.20 together with extractpdfmark can significantly reduce the size of the final PDF files.) dblatex

ERROR: Please install required programs:  FlexLexer.h (flex package) FlexLexer.h with yypop_buffer_state (flex >= 2.5.29) guile-devel >= 1.8 libpango1.0-dev or pango?-devel >= 1.36.0 (installed: ) libfontconfig-dev or fontconfig-devel >= 2.4.0 (installed: ) libfreetype6-dev or freetype?-devel >= 2.3.9 (installed: ) libglib-dev or glib?-devel >= 2.38 (installed: ) libgobject-dev or gobject?-devel >= 2.38 (installed: )

See INSTALL.txt for more information on how to build LilyPond
emconfigure: error: './configure --prefix=/home/skainz/privat/WASMPond/out' failed (returned 1)

Ehh, well, this looks like a lot of work to do! Right now, i will skip the WARNING section - those are optional files/packages. The ERROR entries look a lot more fun! LilyPond needs the following libs/packages for a successful configure run:

  • FlexLexer.h (flex package) FlexLexer.h with yypop_buffer_state (flex >= 2.5.29)
  • guile-devel >= 1.8
  • libpango1.0-dev or pango?-devel >= 1.36.0 (installed: )
  • libfontconfig-dev or fontconfig-devel >= 2.4.0 (installed: )
  • libfreetype6-dev or freetype?-devel>= 2.3.9 (installed: )
  • libglib-dev or glib?-devel >= 2.38 (installed: )
  • libgobject-dev or gobject?-devel >= 2.38 (installed: )

ok, so we need (at least) 7 packages to build for WebAssembly to ./configure LilyPond, including all the dependencies for those packages as well.

blogroll

social