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

Building with Emscripten fails #77

Closed
zikaari opened this issue Feb 13, 2018 · 5 comments
Closed

Building with Emscripten fails #77

zikaari opened this issue Feb 13, 2018 · 5 comments

Comments

@zikaari
Copy link

zikaari commented Feb 13, 2018

Followed this guide: http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#building-projects

These steps work without spitting non-zero exit code

# Run emconfigure with the normal configure command as an argument.
./emconfigure ./configure

# Run emmake with the normal make to generate linked LLVM bitcode.
./emmake make

But fails at last one : (

$ emcc src/.libs/libonig.a -s WASM=1 -o onig.js
error: Linking globals named 'regcomp': symbol multiply defined!
ERROR:root:Failed to run llvm optimizations:

At this point (4 days of struggle with all this) I'd owe anyone for life. Help much appreciated.

@zikaari zikaari changed the title Building with Emscripten fails: Building with Emscripten fails Feb 13, 2018
@kkos
Copy link
Owner

kkos commented Feb 13, 2018

I don't know about Emscripten.
But regcomp() is a Oniguruma API function that provide POSIX API to user.
If you don't use Oniguruma POSIX API regcomp() etc.. you can remove it from libonig.a.
Please remove regposix.c and regposerr.c from src/Makefile.am.

@kkos
Copy link
Owner

kkos commented Feb 14, 2018

I have added a new configure option "--enable-posix-api" in develop branch.

$ make clean
$ ./configure --enable-posix-api=no
$ make

@zikaari
Copy link
Author

zikaari commented Feb 14, 2018

Thank you for being so nice!

I created the same issue in emscripten's repo and based on author's pointer, it turns out that regcomp symbol is also defined in libc.bc which I believe must be packed together with anything emscripten builds (WASM binary in this case)

libc.bc

sweetslush@ubuntu:~/.emscripten_cache/asmjs$ llvm-nm libc.bc | grep "regcomp"
-------- T regcomp

libonig.a

sweetslush@ubuntu:~/.../oniguruma$ llvm-nm src/.libs/libonig.a | grep "regcomp"
regcomp_64e0bb8d.o:
-------- T regcomp

In search for all possible solutions, will there be any side effects (missing features) of not including regposix.c and regposerr.c?

Or does regcomp from libc has same behaviour as regcomp in oniguruma?

Once again, I thank for being epic 🎉

@kkos
Copy link
Owner

kkos commented Feb 14, 2018

regcomp() in Oniguruma provides POSIX interface to users by using Oniguruma regex engine.
If you don't use POSIX interface (regcomp, regexec, regfree etc.. defined in onigposix.h) to use Oniguruma and use only Oniguruma native interface (onig_new, onig_search etc.. defined in oniguruma.h) then you don't need regposix.c and regposerr.c.

@zikaari
Copy link
Author

zikaari commented Feb 14, 2018

Everything's now nominal. Thank you for the help!

🙂

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

2 participants