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

Compiling with Javascript tools=yes fails (no exceptions support for Clipper and Assimp build) #25262

Closed
LinuxUserGD opened this issue Jan 23, 2019 · 16 comments · Fixed by #29032

Comments

@LinuxUserGD
Copy link
Contributor

LinuxUserGD commented Jan 23, 2019

Godot version:
master (2c9536b)

OS/device including version:
Arch Linux

Issue description:
The javascript export (html5) fails with tools=yes.
I think it should work because there was the website http://godot.online.

[ 72%] Compiling ==> editor/collada/collada.cpp
thirdparty/misc/clipper.cpp:901:7: error: cannot use 'throw' with exceptions
      disabled
      throw clipperException("Coordinate outside allowed range");
      ^
thirdparty/misc/clipper.cpp:1049:5: error: cannot use 'throw' with exceptions
      disabled
    throw clipperException("AddPath: Open paths must be subject.");
    ^
thirdparty/misc/clipper.cpp:1081:5: error: cannot use 'throw' with exceptions
      disabled
    throw; //range test fails
    ^
thirdparty/misc/clipper.cpp:1065:3: error: cannot use 'try' with exceptions
      disabled
  try
  ^
thirdparty/misc/clipper.cpp:1445:5: error: cannot use 'throw' with exceptions
      disabled
    throw clipperException("UpdateEdgeIntoAEL: invalid call");
    ^
thirdparty/misc/clipper.cpp:1513:5: error: cannot use 'throw' with exceptions
      disabled
    throw clipperException("Error: PolyTree struct is needed for open pa...
    ^
thirdparty/misc/clipper.cpp:1563:3: error: cannot use 'try' with exceptions
      disabled
  try {
  ^
thirdparty/misc/clipper.cpp:2841:5: error: cannot use 'throw' with exceptions
      disabled
    throw clipperException("ProcessIntersections error");
    ^
thirdparty/misc/clipper.cpp:2830:3: error: cannot use 'try' with exceptions
      disabled
  try {
  ^
thirdparty/misc/clipper.cpp:3005:8: error: cannot use 'throw' with exceptions
      disabled
  else throw clipperException("DoMaxima error");
       ^
10 errors generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting
scons: *** [thirdparty/misc/clipper.javascript.opt.tools.64.bc] Error 1
scons: building terminated because of errors.

Steps to reproduce:
scons p=javascript tools=yes target=release_debug bits=64 -j 8

@LinuxUserGD LinuxUserGD changed the title javascript tools=yes export fails Compiling with Javascript tools=yes fails Jan 23, 2019
@Calinou
Copy link
Member

Calinou commented Jan 23, 2019

I think it should work because there was the website http://godot.online.

That project had to make some modifications to get the editor to build for WebAssembly. Unfortunately, they never shared those modifications to my knowledge, so we would have to start from scratch.

@Xrayez
Copy link
Contributor

Xrayez commented Jan 24, 2019

The Clipper library which is used in sprite editor plugin uses exceptions which are not supported on several platforms (Android, iOS, HTML5). It can be made to resolve these exceptions by using Godot's way to handle them:

if (!Closed && PolyTyp == ptClip)
    throw clipperException("AddPath: Open paths must be subject.");

to:

ERR_EXPLAIN("AddPath: Open paths must be subject.");
ERR_FAIL_COND_V(!Closed && PolyTyp == ptClip, false);

These fixes were made in #23559, for instance, but that's for newer Clipper version.

@LinuxUserGD
Copy link
Contributor Author

@Xrayez Thank you, compiling works now but the screen is black when running godot.html.
Should I close this issue now?

@LinuxUserGD
Copy link
Contributor Author

LinuxUserGD commented Jan 24, 2019

Ok, it fully works! The only problem: It's showing the project list. I've used an empty .zip file as the game pack.

@LinuxUserGD
Copy link
Contributor Author

project

@Xrayez
Copy link
Contributor

Xrayez commented Jan 24, 2019

@LinuxUserGD nice! I could bring in your fixes to master branch via pull request, or you could make a pull request yourself for that if you managed to compile it. Apart from fixing compilation issue I have no clue how web file system works.

EDIT: I don't see the point of fixing this issue for now if the new Clipper implementation has a chance to be merged at some point, including fixes to exception-safety.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jan 26, 2019
@LinuxUserGD
Copy link
Contributor Author

@Xrayez I just deleted all ifs that contain the clipperException so it's better if you make the pull request.

@Xrayez
Copy link
Contributor

Xrayez commented May 19, 2019

OS: Windows 10 WSL
Godot version: 33897d9

While trying to resolve this issue and in order to test #29003 I got this error:

$ scons platform=javascript target=release_debug tools=yes bits=64 -j4 warnings=extra
scons: Reading SConscript files ...
Using custom build name: Xrayez
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
Checking for C header file mntent.h... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[  2%] Compiling ==> platform/javascript/os_javascript.cpp
[  5%] Linking Static Library ==> main/libmain.javascript.opt.tools.64.bc
[  5%] Compiling ==> main/tests/test_astar.cpp
[  5%] Compiling ==> main/tests/test_gdscript.cpp
Ranlib Library         ==> main/libmain.javascript.opt.tools.64.bc
[  5%] Compiling ==> main/tests/test_gui.cpp
[  5%] Compiling ==> main/tests/test_main.cpp
platform/javascript/os_javascript.cpp:997:6: error: use of undeclared identifier 'emscripten_sample_gamepad_data'
        if (emscripten_sample_gamepad_data() == EMSCRIPTEN_RESULT_SUCCESS)
            ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
scons: *** [platform/javascript/os_javascript.javascript.opt.tools.64.bc] Error 1
scons: building terminated because of errors.

@Xrayez
Copy link
Contributor

Xrayez commented May 19, 2019

Ok, I've had an outdated 1.38.4 Emscripten SDK, updated to 1.38.31 now, but I get these errors now:

$ scons platform=javascript target=release_debug tools=yes bits=64 debug_symbols=no -j4 warnings=extra
scons: Reading SConscript files ...
Using custom build name: Xrayez
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
Checking for C header file mntent.h... yes
scons: done reading SConscript files.
scons: Building targets ...
[  2%] Compiling ==> platform/javascript/os_javascript.cpp
[  5%] Linking Static Library ==> main/libmain.javascript.opt.tools.64.bc
[  5%] Compiling ==> main/tests/test_math.cpp
[  5%] Compiling ==> main/tests/test_oa_hash_map.cpp
Ranlib Library         ==> main/libmain.javascript.opt.tools.64.bc
[  5%] Compiling ==> main/tests/test_ordered_hash_map.cpp
[  5%] Compiling ==> main/tests/test_physics.cpp
[  5%] Compiling ==> main/tests/test_physics_2d.cpp
[  5%] Compiling ==> main/tests/test_render.cpp
[  5%] Compiling ==> main/tests/test_shader_lang.cpp
[  6%] Compiling ==> main/tests/test_string.cpp
[  6%] Compiling ==> modules/register_module_types.gen.cpp
[  7%] Compiling ==> thirdparty/assimp/code/BaseImporter.cpp
[  7%] Compiling ==> thirdparty/assimp/code/BaseProcess.cpp
[  7%] Compiling ==> thirdparty/assimp/code/Bitmap.cpp
[  7%] Linking Static Library ==> main/tests/libtests.javascript.opt.tools.64.bc
In file included from thirdparty/assimp/code/BaseImporter.cpp:48:
In file included from thirdparty/assimp/include/assimp/BaseImporter.h:47:
thirdparty/assimp/include/assimp/Exceptional.h:96:13: error: cannot use 'throw' with exceptions disabled
            throw;
            ^
thirdparty/assimp/include/assimp/Exceptional.h:95:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
In file included from thirdparty/assimp/code/BaseProcess.cpp:46:
In file included from thirdparty/assimp/include/assimp/BaseImporter.h:47:
thirdparty/assimp/include/assimp/Exceptional.h:96:13: error: cannot use 'throw' with exceptions disabled
            throw;
            ^
thirdparty/assimp/include/assimp/Exceptional.h:95:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
In file included from thirdparty/assimp/code/BaseImporter.cpp:50:
In file included from thirdparty/assimp/code/FileSystemFilter.h:51:
thirdparty/assimp/include/assimp/fast_atof.h:190:9: error: cannot use 'throw' with exceptions disabled
        throw std::invalid_argument( std::string( "The string \"" ) + in + "\" cannot be converted into a value." );
        ^
thirdparty/assimp/include/assimp/fast_atof.h:288:9: error: cannot use 'throw' with exceptions disabled
        throw std::invalid_argument("Cannot parse string "
        ^
[  7%] Compiling ==> thirdparty/assimp/code/CInterfaceIOWrapper.cpp
thirdparty/assimp/code/BaseImporter.cpp:99:5: error: cannot use 'try' with exceptions disabled
    try
    ^
In file included from thirdparty/assimp/code/BaseImporter.cpp:323:
In file included from thirdparty/assimp/code/../contrib/utf8cpp/source/utf8.h:31:
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:76:13: error: cannot use 'throw' with exceptions disabled
            throw invalid_code_point(cp);
            ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:110:21: error: cannot use 'throw' with exceptions disabled
                    throw not_enough_room();
                    ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:145:17: error: cannot use 'throw' with exceptions disabled
                throw not_enough_room();
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:149:17: error: cannot use 'throw' with exceptions disabled
                throw invalid_utf8(*it);
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:151:17: error: cannot use 'throw' with exceptions disabled
                throw invalid_code_point(cp);
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:167:13: error: cannot use 'throw' with exceptions disabled
            throw not_enough_room();
            ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:173:17: error: cannot use 'throw' with exceptions disabled
                throw invalid_utf8(*it); // error - no lead byte in the sequence
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:184:17: error: cannot use 'throw' with exceptions disabled
                throw invalid_utf8(*it); // error - no lead byte in the sequence
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:218:25: error: cannot use 'throw' with exceptions disabled
                        throw invalid_utf16(static_cast<uint16_t>(trail_surrogate));
                        ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:221:21: error: cannot use 'throw' with exceptions disabled
                    throw invalid_utf16(static_cast<uint16_t>(cp));
                    ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:226:17: error: cannot use 'throw' with exceptions disabled
                throw invalid_utf16(static_cast<uint16_t>(cp));
                ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:280:15: error: cannot use 'throw' with exceptions disabled
              throw std::out_of_range("Invalid utf-8 iterator position");
              ^
thirdparty/assimp/code/../contrib/utf8cpp/source/utf8/checked.h:292:15: error: cannot use 'throw' with exceptions disabled
              throw std::logic_error("Comparing utf-8 iterators defined with different ranges");
              ^
thirdparty/assimp/code/BaseImporter.cpp:331:9: error: cannot use 'throw' with exceptions disabled
        throw DeadlyImportError("File is too small");
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting
scons: *** [thirdparty/assimp/code/BaseImporter.javascript.opt.tools.64.bc] Error 1
thirdparty/assimp/code/BaseProcess.cpp:80:5: error: cannot use 'try' with exceptions disabled
    try
    ^
3 errors generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting
scons: *** [thirdparty/assimp/code/BaseProcess.javascript.opt.tools.64.bc] Error 1
Ranlib Library         ==> main/tests/libtests.javascript.opt.tools.64.bc
scons: building terminated because of errors.

@fire seems like your assimp module fails too in platforms with disabled exceptions, this needs to be fixed by either disabling assimp for web with tools enabled, or provide similar fixes like I did with Clipper (see #29003). 😃

@LinuxUserGD
Copy link
Contributor Author

@Xrayez throw and try errors are expected. I just deleted those when compiling with tools=yes

@Xrayez
Copy link
Contributor

Xrayez commented May 19, 2019

@LinuxUserGD yeah, I could do the same but the aim is to fix this for all users. I fixed it for your original issue, but more thirdparty libraries were added since the issue was created.

@akien-mga akien-mga changed the title Compiling with Javascript tools=yes fails Compiling with Javascript tools=yes fails (no exceptions support for Clipper and Assimp build) May 20, 2019
akien-mga added a commit to akien-mga/godot that referenced this issue May 20, 2019
Those were disable to keep size small, and on Android avoid the dependency on the STL,
but for tools build (editor) this is not really a concern.

Note: as of today it's not possible to build tools=yes for those platforms, but this
change is one of the necessary steps to enable it.

Fixes godotengine#25262.
myhalibobo pushed a commit to myhalibobo/godot that referenced this issue Sep 3, 2019
Those were disable to keep size small, and on Android avoid the dependency on the STL,
but for tools build (editor) this is not really a concern.

Note: as of today it's not possible to build tools=yes for those platforms, but this
change is one of the necessary steps to enable it.

Fixes godotengine#25262.
akien-mga added a commit to akien-mga/godot that referenced this issue Nov 8, 2019
Those were disable to keep size small, and on Android avoid the dependency on the STL,
but for tools build (editor) this is not really a concern.

Note: as of today it's not possible to build tools=yes for those platforms, but this
change is one of the necessary steps to enable it.

Fixes godotengine#25262.

(cherry picked from commit 4b20959)
@Aunter1992
Copy link

@Xrayez Thank you, compiling works now but the screen is black when running godot.html.
Should I close this issue now?

compiling works with : scons platform=javascript tools=no target=release
the screen is black when running godot.html ,used chrome
console :
image
how to deal with the problem

@Calinou
Copy link
Member

Calinou commented Jul 23, 2020

@Aunter1992 Did you start a local Web server? This is most likely required to bypass browser security restrictions. See the top of this page.

@Aunter1992
Copy link

@Aunter1992 Did you start a local Web server? This is most likely required to bypass browser security restrictions. See the top of this page.
godot version release 3.2.2
yes, used Nginx.
it seems the compiled result is a template, not a online editor
image

@Calinou
Copy link
Member

Calinou commented Jul 23, 2020

@Aunter1992 When you compile using tools=no, you get an export template, not an editor. Building the editor for HTML5 isn't fully supported yet.

@Aunter1992
Copy link

@Aunter1992 When you compile using tools=no, you get an export template, not an editor. Building the editor for HTML5 isn't fully supported yet.

i see,
thank u very much
looking forward to the futhure release version _

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants