Compiling pdftex-worker.js fails
Closed this issue · 0 comments
I run into an interesting problem when trying to compile pdftex-worker.js from scratch, by cloning texlive.js
and running make
.
Environment
- Ubuntu 12.04 32-bit
- Emscripten 1.8.2
Issue
When running make, the compilation gets as far as llvm-linking in the make pdftex-worker.js
task (Line 112 of Makefile
) and then fails with the following error:
/home/username/llvm32build/bin/llvm-link: link error in
'/tmp/tmpIRh25X/access_15.o': Linking globals named 'main': symbol
multiply defined!
Cause
This error happens because access_15.o
does have a main
method, even though it is part of the kpathsea
library. This can be verified by running llvm-nm access.o
:
U access
U exit
U fprintf
U fputs
T main
U printf
U stderr
U stdout
U strcmp
At which point in becomes clear that access.c
is not intended to be part of the library, rather it produces a standalone executable when compiling kpathsea
.
There are many such files in both kpathsea
and web2c
, any of which will cause the build to fail in the same way.
Potential Solution
In order to compile successfully, we need to exclude all object files from these two libraries that contain a main
method, because these are clearly not library modules, they are standalone executables. This can be done with some bash magic, as seen in my commit.
I would be happy to submit that commit as a pull request if you think it would be useful. I suspect this whole issue has only arisen because the behaviour of emscripten
has changed since @manuels last updated.
Warning
Even after applying this fix, texlive.js
will still not successfully compile with emscripten 1.8.2
. See issue #14 for details.