floooh / oryol

A small, portable and extensible C++ 3D coding framework
MIT License
1.98k stars 198 forks source link

Cannot build emsc-ninja-release in Windows10 #269

Closed ivandrodri closed 6 years ago

ivandrodri commented 6 years ago

I am following the cross-compiling instructions in :

https://github.com/floooh/oryol/blob/master/doc/BUILD.md

and I'm getting some problems to build emsc-ninja-release .

First I run the command 'fips setup emscripten', but I get this error:

downloading 'emsdk-1.35.0-portable-64bit.zip'... 100%uncompressing 'emsdk-1.35.0-portable-64bit.zip'... setup emscripten SDK... Error parsing emsdk_manifest.json!

I have solved it by including the last emsdk-portable-64bit.zip from

https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html

in in fips-sdks/win and changing its name to emsdk-1.35.0-portable-64bit.zip .

However, when I try to build 'emsc-ninja-release' with 'fips build emsc-ninja-release' I get this output:

C:\Users\ivand\Documents\UI_WASS\oryol>fips build wasm-ninja-release === dependency: 'fips-unittestpp': dir 'C:/Users/ivand/Documents/UI_WASS/fips-unittestpp' exists === dependency: 'fips-remotery': dir 'C:/Users/ivand/Documents/UI_WASS/fips-remotery' exists === dependency: 'fips-glm': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glm' exists === dependency: 'fips-glfw': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glfw' exists === dependency: 'gliml': dir 'C:/Users/ivand/Documents/UI_WASS/gliml' exists === dependency: 'fips-zlib': dir 'C:/Users/ivand/Documents/UI_WASS/fips-zlib' exists === dependency: 'fips-vld': dir 'C:/Users/ivand/Documents/UI_WASS/fips-vld' exists === dependency: 'fips-libcurl': dir 'C:/Users/ivand/Documents/UI_WASS/fips-libcurl' exists === building: wasm-ninja-release ninja.exe -j 3 all ninja: error: loading 'build.ninja': The system cannot find the file specified.

Thanks a lot in advanced for any help!

floooh commented 6 years ago

Hi, thanks for the bug report. Not sure yet why the initial install is failing, I'll look into that.

The second problem looks like cmake build files had been partially created, so that cmake isn't rerun, and the expected ninja build file isn't there.

Could you try this to start from a clean slate:

> fips clean all
> fips set config emsc-ninja-release
> fips gen
> fips build

If anything fails, please copy the output of the "fips gen" and "fips build" steps here. Thanks :)

ivandrodri commented 6 years ago

Thanks for the quick reply!

please find below the outputs of 'fips gen' and 'fips build'. The commands emsdk and emcc are recognize in the terminal and I almost sure that emsdk-portable is correctly installed. However from the output of 'fips gen' it seems like SDK cannot be find. Thanks for any help!

########################################

C:\Users\ivand\Documents\UI_WASS\oryol>fips gen === dependency: 'fips-unittestpp': dir 'C:/Users/ivand/Documents/UI_WASS/fips-unittestpp' exists === dependency: 'fips-remotery': dir 'C:/Users/ivand/Documents/UI_WASS/fips-remotery' exists === dependency: 'fips-glm': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glm' exists === dependency: 'fips-glfw': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glfw' exists === dependency: 'gliml': dir 'C:/Users/ivand/Documents/UI_WASS/gliml' exists === dependency: 'fips-zlib': dir 'C:/Users/ivand/Documents/UI_WASS/fips-zlib' exists === dependency: 'fips-vld': dir 'C:/Users/ivand/Documents/UI_WASS/fips-vld' exists === dependency: 'fips-libcurl': dir 'C:/Users/ivand/Documents/UI_WASS/fips-libcurl' exists === generating: emsc-ninja-release Using Toolchain File: C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:/Users/ivand/Documents/UI_WASS/fips/tools/win32/ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake -DFIPS_CONFIG=emsc-ninja-release -DFIPS_NO_ASSERTS_IN_RELEASE=ON -DFIPS_USE_CCACHE=OFF -DFIPS_AUTO_IMPORT=ON -BC:/Users/ivand/Documents/UI_WASS/fips-build/oryol/emsc-ninja-release -HC:/Users/ivand/Documents/UI_WASS/oryol CMake Error at C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake:32 (message): Could not find emscripten SDK! Please run 'fips setup emscripten'! Call Stack (most recent call first): C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake:37 (find_emscripten_sdk) C:/Program Files/CMake/share/cmake-3.9/Modules/CMakeDetermineSystem.cmake:94 (include) CMakeLists.txt

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! [ERROR] failed to generate build files for config 'emsc-ninja-release' [ERROR] 1 out of 1 configs failed!

######################################

C:\Users\ivand\Documents\UI_WASS\oryol>fips build === dependency: 'fips-unittestpp': dir 'C:/Users/ivand/Documents/UI_WASS/fips-unittestpp' exists === dependency: 'fips-remotery': dir 'C:/Users/ivand/Documents/UI_WASS/fips-remotery' exists === dependency: 'fips-glm': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glm' exists === dependency: 'fips-glfw': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glfw' exists === dependency: 'gliml': dir 'C:/Users/ivand/Documents/UI_WASS/gliml' exists === dependency: 'fips-zlib': dir 'C:/Users/ivand/Documents/UI_WASS/fips-zlib' exists === dependency: 'fips-vld': dir 'C:/Users/ivand/Documents/UI_WASS/fips-vld' exists === dependency: 'fips-libcurl': dir 'C:/Users/ivand/Documents/UI_WASS/fips-libcurl' exists === building: emsc-ninja-release ninja.exe -j 3 all ninja: error: loading 'build.ninja': The system cannot find the file specified.

floooh commented 6 years ago

Hmm this is the problem:

Could not find emscripten SDK! Please run 'fips setup emscripten'!

There should be a directory called

C:/Users/ivand/Documents/UI_WASS/fips-sdks/win/emsdk-portable/

...generated in 'fips setup emscripten', ...and in this the unpacked emscripten SDK files, and a directory called clang and one called emscripten. I guess it isn't there because the setup didn't work.

Fips cannot use a global emscripten installation, it will always attempt to use a local SDK in the fips 'workspace directory'.

I don't have access to a Windows PC until tomorrow or the day after, I will need to wait until then to try reproducing the setup problem, sorry :)

ivandrodri commented 6 years ago

Thanks for the quick reply!

I have checked in 'fips-sdks/win/emsdk-portable/' and I have both directories 'emscripten' and 'clang' so I don't know what could be the problem.

Thanks again for your help and I look forward for your reply :)

floooh commented 6 years ago

Ok, I can reproduce the emsdk_manifest.json problem, trying to find a solution...

floooh commented 6 years ago

Ok, I'm now downloading the file 'emsdk-portable-64bit.zip' now, which seems to work. This is fixed in the fips repository, so you need to do a git pull in the fips directory, then manually delete the whole fips-sdks directory, and attempt a new 'fips setup emscripten'.

The installation is still running here (I'm currently in China and everything internet-related is very slow), if the installation works I'll close this ticket.

ivandrodri commented 6 years ago

Ok, I'll reinstall fips-sdks following your instructions and I let you know ASAP.

Have you also been able to install emsc-ninja-release with 'fips build emsc-ninja-release' ?.

Last quick question: I was using the MeshViewer application (in oryol-samples) in linux and in the Desktop version I am able to upload mesh files from my local hard drive (through LocalFS) but in the emscripten/WebAssembly version I am not. So my question is if is it possible in the webassembly (browser) version to upload files from a local hard-disk or if I'm doing something wrong instead.

Thanks!

ivandrodri commented 6 years ago

Now the portable emscripten is correctly installed. However I'm still having the same problem I mentioned before to install emsc-ninja-release with 'fips build emsc-ninja-release' .

This is the output:

C:\Users\ivand\Documents\UI_WASS\oryol>fips gen === dependency: 'fips-unittestpp': dir 'C:/Users/ivand/Documents/UI_WASS/fips-unittestpp' exists === dependency: 'fips-remotery': dir 'C:/Users/ivand/Documents/UI_WASS/fips-remotery' exists === dependency: 'fips-glm': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glm' exists === dependency: 'fips-glfw': dir 'C:/Users/ivand/Documents/UI_WASS/fips-glfw' exists === dependency: 'gliml': dir 'C:/Users/ivand/Documents/UI_WASS/gliml' exists === dependency: 'fips-zlib': dir 'C:/Users/ivand/Documents/UI_WASS/fips-zlib' exists === dependency: 'fips-vld': dir 'C:/Users/ivand/Documents/UI_WASS/fips-vld' exists === dependency: 'fips-libcurl': dir 'C:/Users/ivand/Documents/UI_WASS/fips-libcurl' exists === generating: emsc-ninja-release Using Toolchain File: C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:/Users/ivand/Documents/UI_WASS/fips/tools/win32/ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake -DFIPS_CONFIG=emsc-ninja-release -DFIPS_NO_ASSERTS_IN_RELEASE=ON -DFIPS_USE_CCACHE=OFF -DFIPS_AUTO_IMPORT=ON -BC:/Users/ivand/Documents/UI_WASS/fips-build/oryol/emsc-ninja-release -HC:/Users/ivand/Documents/UI_WASS/oryol CMake Error at C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake:32 (message): Could not find emscripten SDK! Please run 'fips setup emscripten'! Call Stack (most recent call first): C:/Users/ivand/Documents/UI_WASS/fips/cmake-toolchains/emscripten.toolchain.cmake:37 (find_emscripten_sdk) C:/Program Files/CMake/share/cmake-3.9/Modules/CMakeDetermineSystem.cmake:94 (include) CMakeLists.txt

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! [ERROR] failed to generate build files for config 'emsc-ninja-release' [ERROR] 1 out of 1 configs failed!

Thanks in advanced for any help!

floooh commented 6 years ago

First a status update on the install: I had compiler errors during the clang-fastcomp build, I guess the clang source code isn't compatible yet with Visual Studio 2017 :/

In general I would recommend building emscripten versions in a Linux VM. The Windows emscripten SDK is just too fragile (and clang is also extremely slow on Windows).

As for loading data: when running in a browser, all data has to be loaded through HTTP since the browser cannot access the local file systems. The original MeshViewer sample does this for instance (through the HTTPFIleSystem).

floooh commented 6 years ago

The error Could not find emscripten SDK! Please run 'fips setup emscripten'! is created here:

https://github.com/floooh/fips/blob/fc24ce6fbf6ad6b507f290747e0903f67753e389/cmake-toolchains/emscripten.toolchain.cmake#L32

Could you check if the following file exists?

C:/Users/ivand/Documents/UI_WASS/fips-sdks/win/emsdk-portable/emscripten/incoming/emcc
ivandrodri commented 6 years ago

Okay now, as you suggested, I have generated 'emscripten' in linux and after include it in fips-sdk/win (and emsk update/install last/activate again) it works perfectly! :)

Thanks a lot for your help!

ivandrodri commented 6 years ago

I would like to ask you a last question. I am running the MeshViewer application using the emsc-ninja-release and webgl2-emsc-ninja-release but I cannot see the mesh files in the browser. I am using Chrome, Firefox and Firefox Nightly and the test mesh files in your web, through:

ioSetup.Assigns.Add("msh:", "http://floooh.github.io/oryol-samples/data/");

Do you know what could be the problem?

Thanks!

floooh commented 6 years ago

When running in a browser, the data files must be served from the same location as the web page itself (because of cross-origin restrictions, see CORS for details: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), long story short, the required data files must be served by the same web server as the emscripten application.

Without hacks in the source code, the easiest way to achieve this for the Oryol samples is to build and serve a local copy of the samples web page:

oryol-samples > ./fips webpage build
oryol-samples > ./fips webpage serve

The "./fips webpage build" will copy all the required asset files into the right places (the result of this will be the directory "../fips-deploy/oryol-samples-webpage".

ivandrodri commented 6 years ago

Thanks for the information!

I've never worked with a web page before so sorry for the naive questions!

In order to run MeshViewer on the browser what I did is to create a github page and I've included in the server the tiger.omsh.txt (with the other .omsh.txt) files together with the MeshViewer.html file generated in /fips-deploy/oryol-samples/webgl2-wasm-ninja-release/ . I've also changed the path in MeshViewer.cpp to the one of my page. However it is not working so I think what I am doing is wrong.

I don't understand what ./fips webpage serve is doing so may be this is the piece of information I'm missing...

Thanks in advance for any help!

floooh commented 6 years ago

"./fips webpage serve" is starting a local web server (same as python -m SimpleHTTPServer), and starts the default web browser, details are here: https://github.com/floooh/oryol-samples/blob/master/fips-verbs/webpage.py#L171

ivandrodri commented 6 years ago

Thank you very much. Now it works! :)