Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build WASM core #67

Closed
Nachasic opened this issue Nov 30, 2021 · 13 comments
Closed

Cannot build WASM core #67

Nachasic opened this issue Nov 30, 2021 · 13 comments

Comments

@Nachasic
Copy link

After going through the instructions, after make I get:

wasm-ld: error: xpdf/xpdf.a(TextString.o): undefined symbol: pdfDocEncoding
em++: error: '/home/alexc/Software/emsdk/upstream/bin/wasm-ld -o swiftlatex.wasm tex/xetex0.o tex/xetexini.o tex/xetex-pool.o md5.o xmemory.o texfile.o kpseemu.o texmfmp.o main.o bibtex.o xetexdir/XeTeX_ext.o xetexdir/XeTeX_pic.o xetexdir/image/bmpimage.o xetexdir/image/jpegimage.o xetexdir/image/pngimage.o xetexdir/trans.o xetexdir/XeTeXOTMath.o xetexdir/XeTeXLayoutInterface.o xetexdir/XeTeXFontMgr.o xetexdir/XeTeXFontInst.o xetexdir/XeTeXFontMgr_FC.o xetexdir/hz.o xetexdir/XeTeXHTML.o xetexdir/XeTeXColor.o xetexdir/pdfimage.o teckit/teckit-Engine.o xpdf/xpdf.a -L/home/alexc/Software/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /home/alexc/Software/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libharfbuzz.a /home/alexc/Software/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libfreetype.a /home/alexc/Software/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libpng.a /home/alexc/Software/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libz.a -lGL -lal -lhtml5 -lstubs -lc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -ldlmalloc -lc_rt -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=compileBibtex --export-if-defined=compileLaTeX --export-if-defined=compileFormat --export-if-defined=main --export-if-defined=setMainEntry --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__wasm_call_ctors --export-if-defined=__errno_location --export-if-defined=_get_tzname --export-if-defined=_get_daylight --export-if-defined=_get_timezone --export-if-defined=malloc --export-if-defined=free --export-if-defined=saveSetjmp --export-if-defined=setThrew --export-if-defined=memalign --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=2147483648 --global-base=1024' failed (returned 1)
make: *** [Makefile:33: swiftlatex.js] Error 1
@jaltekruse
Copy link

I also ran into this, appears to be fixable with adding a line to a nested Makefile

diff --git a/webassembly/xpdf/Makefile b/webassembly/xpdf/Makefile
index 904d9f1..ff331c8 100755
--- a/webassembly/xpdf/Makefile
+++ b/webassembly/xpdf/Makefile
@@ -11,6 +11,7 @@ xpdf/Lexer.cc  \
 xpdf/Catalog.cc                  \
 xpdf/Stream.cc \
 xpdf/Object.cc  \
+xpdf/PDFDocEncoding.cc \
 xpdf/TextString.cc \
 xpdf/Dict.cc                           \
 xpdf/Error.cc               xpdf/Page.cc               \
diff --git a/webassembly/xpdf/xpdf.a b/webassembly/xpdf/xpdf.a
index f3e9dd9..761bc27 100644

I'm still having trouble running it though, because even the local version reaches out the currently offline hosted version to download a binary file called swiftlatex22p.fmt that I am having trouble finding anywhere.

@Throvn
Copy link

Throvn commented Jan 18, 2022

I have the exact same issue:

0: SwiftLaTeX-(1:0) Unexpected error happened, please check the detailed log. Status 3, Engine: XeLaTeX


I can't find the format file `swiftlatex22p.fmt'!

Could you find a fix by now?

@LubosD
Copy link
Collaborator

LubosD commented Feb 6, 2022

Here: https://drive.google.com/file/d/1VYOktAnug02dpF_xnb1ewWhaYCyNjwbs/view?usp=sharing

But I already managed to forget how I generated it last year. I think I copied it from xetex? I wish the author was more communicative.

BTW: there are even no sources published for swiftlatex_export.wasm, which is dvipdfmx.

@elliott-wen
Copy link
Contributor

Hi, all. Sorry for the late response.

I am really struggling with making a life recently. Life is hard :(

@LubosD There's a complete XeTeX engine source code under the webassembly directory.

Also inside the pre.js file, there is a compileLaTeXFormatRoutine, which can generate the format.

@LubosD
Copy link
Collaborator

LubosD commented Feb 6, 2022

@elliott-wen Thanks a lot for your answer. But how does swiftlatex_export.wasm get built?

@elliott-wen
Copy link
Contributor

elliott-wen commented Feb 6, 2022 via email

@LubosD
Copy link
Collaborator

LubosD commented Feb 6, 2022

@elliott-wen Well, I know about that, it builds swiftlatex.wasm, which can also produce DVI files.

But then there's DvipdfmxEngine, which uses swiftlatex_export.wasm. This WASM file exports functions like _compilePDF, but this is nowhere to be found in the Git repo. I think you must have forgotten to share the sources of that.

@elliott-wen
Copy link
Contributor

elliott-wen commented Feb 6, 2022

oh, i see. I guess you misunderstood... the engine is actually modified to generate html/svg directly. https://github.com/SwiftLaTeX/SwiftLaTeX/blob/master/webassembly/xetexdir/XeTeXHTML.cpp :D

@LubosD
Copy link
Collaborator

LubosD commented Feb 6, 2022

oh, i see. I guess you misunderstood... the engine is actually modified to generate html/svg directly. https://github.com/SwiftLaTeX/SwiftLaTeX/blob/master/webassembly/xetexdir/XeTeXHTML.cpp :D

I'm well aware, but it apparently has support for generating PDFs as well, which is the primary reason why I took interest in it :-) And also why I push for open sourcing the dvipdfmx webassembly port.

@elliott-wen
Copy link
Contributor

That's really my fault... I was getting a bit rusty

export_engine.zip

BTW This is the server script we use to host the latex files [](url
texlive.zip
)

Do you want to be the maintainer of this repo? I could grant the admin access to you? @LubosD

@LubosD
Copy link
Collaborator

LubosD commented Feb 6, 2022

@elliott-wen I'm not sure I'd have time to be a true maintainer :-) Especially because I'm more interested in client-side PDF generation (from .tex files) than the interactive online editing functionality.

But at least I could import the sources you posted into Git, produce Docker images (incl. Dockerfiles) so that people can get things running easily on their end etc. etc.

@elliott-wen
Copy link
Contributor

Thanks so much for your help.

I was thinking about the future of this repo.
Probably instead of providing a full-brown Overleaf-like editor, we can just provide a library or tool that generates PDFs from tex files.

@elliott-wen
Copy link
Contributor

@LubosD Hi, I refactored the repo. Now, you can find all the compilable components like pdftex, xetex, and dvipdfm over there. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants