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

Can't compile code --please help #186

Closed
DragonOsman opened this issue Nov 16, 2018 · 3 comments
Closed

Can't compile code --please help #186

DragonOsman opened this issue Nov 16, 2018 · 3 comments

Comments

@DragonOsman
Copy link

I tried to compile the app I have on this GitHub repository to WebAssembly using em++, but I couldn't. I used this command:

em++ -std=c++17 -Wall -pedantic -D variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0 -I C:/Jinja2Cpp/install_x64/include -I C:/json/single_include -I C:/boost_1_68_0/ -c currency_converter.cpp -L C:/Jinja2Cpp/install_x64/lib/static -ljinja2cpp -L C:/boost_1_68_0/lib64-msvc-14.1 -lboost_system -lpthread -o currency_converter.js

And I had these warnings from em++:

WARNING:root:emcc: cannot find library "jinja2cpp"

and

WARNING:root:object c:\users\osman\appdata\local\temp\emscripten_temp_stn0tz_archive_contents\error_code.o is not LLVM bitcode, cannot link

What am I doing wrong? What do I need to do? Please help. Thanks in advance.

@DragonOsman
Copy link
Author

DragonOsman commented Nov 16, 2018

Okay, I managed to do it with this command:

em++ -std=c++17 -Wall -pedantic -D variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0 -I C:/Jinja2Cpp/install_x64/include -I C:/json/single_include -I C:/boost_1_68_0/ -c currency_converter.cpp -L C:/Jinja2Cpp/install_x64/lib/static/jinja2cpp.lib -L C:/boost_1_68_0/lib64-msvc-14.1/libboost_system-vc141-mt-x64-1_68.lib -lpthread -o currency_converter.js

Now I just require the currency_converter.js file in a Node app?

Edit: I got a .js file, but not a .wasm file. Even though I provided the -s WASM=1 compiler flag on the command line. Why?

Edit: It could be because I have to give special treatment to std::shared_ptr when trying to compile to WebAssembly. I'll have to read again about how to do that.

Also, if I want to pass API keys as environment variables to use in my WebAssembly application, and I want to use it as a Node.js module, should I use ENV in my Node.js code like this?

Module.preRun.push(function() {ENV.my_key = "value"})

@DragonOsman
Copy link
Author

I really can't generate the .wasm file no matter what I try. Someone please help. Thanks.

@juj
Copy link
Collaborator

juj commented Nov 19, 2018

Not sure, that looks like a project specific issue. This repository is about an Emscripten SDK bootstrapper script, so try raising the issue over at Emscripten tracker, or emscripten-discuss mailing list, if someone might have experience there.

@juj juj closed this as completed Nov 19, 2018
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