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.
I run into an interesting problem when trying to compile pdftex-worker.js from scratch, by cloning
texlive.js
and runningmake
.Environment
Issue
When running make, the compilation gets as far as llvm-linking in the
make pdftex-worker.js
task (Line 112 ofMakefile
) and then fails with the following error:Cause
This error happens because
access_15.o
does have amain
method, even though it is part of thekpathsea
library. This can be verified by runningllvm-nm access.o
: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 compilingkpathsea
.There are many such files in both
kpathsea
andweb2c
, 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 withemscripten 1.8.2
. See issue #14 for details.