x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How would I go about adding a compiler option to emscripten for building to html5?

I want to add the --bind option to the emcc call when building for html5, would I add this in html5toolchain.cs? I'm just trying to use the embind, specifically the val functionality.

Product Version: UE 4.17
Tags:
more ▼

asked Oct 24 '17 at 02:42 PM in Packaging & Deployment

avatar image

JackJack321
12 2 1 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think there is currently no machinery to allow adding in custom Emscripten linker flags. You can achieve it if you compile UE4 from sources at GitHub. If doing that, go and edit the file Engine/Source/Programs/UnrealBuildTool/HTML5/HTML5ToolChain.cs, and find the function GetLinkArguments(), and add in --bind flag there.

Another way, which might be simpler if you're using a precompiled UE4 package, might be to go and hack the emcc.py script in the bundled compiler. Find the emcc.py file inside UE4 installation directory, and add e.g. on this line https://github.com/kripken/emscripten/blob/incoming/emcc.py#L1861 a directive

 newargs = newargs + ['--bind']

or something like that, to force the --bind flag to be present in UE4 link. Then try doing a full rebuild. Not sure if this will work, but it's probably so quick to test that it might be preferable if you don't currently have the sources installed.

more ▼

answered Oct 24 '17 at 05:08 PM

avatar image

juj
1.2k 15 4 17

avatar image JackJack321 Oct 24 '17 at 07:59 PM

so I'm now running the unreal engine I got off github and have added --bind to the getlinkarguments function, but now when I build for html5 it gets stuck at:

UATHelper: Packaging (HTML5): UnrealBuildTool: #include "..." search starts here: UATHelper: Packaging (HTML5): UnrealBuildTool: #include <...> search starts here: A list of paths in the engine folders where include header files may exist UATHelper: Packaging (HTML5): UnrealBuildTool: End of search list.

I can see in the output log right above this output that the --bind did something because now it has bind.cpp as the last thing when it tries to Link myproject.js.

I'm guessing one of the header files in bind.cpp can't be found at the locations listed? I've also found some posts where the original unresolved symbol errors in emscripten I was seeing are actually just warnings? Can I disable show warnings as errors on my custom ue4?

avatar image juj Oct 24 '17 at 08:30 PM

Iirc those lines get always printed out. If there is no explicit errors, then I would not assume those are a source of a problem. The final link can take a long time when rebuilding from scratch (~10 minutes, depending on CPU speed). Try checking e.g. in a process monitor tool to check if there's any real progress in the build, and where it's getting stuck at.

avatar image JackJack321 Oct 24 '17 at 09:15 PM

you were right! Thanks for your help. Now if only the optimizer would stop crashing randomly on packaging...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question