Hi,
Emscripten uses clang/LLVM and not gcc, if makes any difference to you.

Setting /etc/alternatives has no effect on emscripten as essentially we are cross compiling.

Perhaps you might try adding
 CONFIG += c++17
If you are using c++-17 ?

emcc -v

 $> emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.14 clang version 13.0.0 (/opt/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 5f3c99085d4c2ebf57fd0586b013b02e32a8e20b)
Target: wasm32-unknown-emscripten
Thread model: posix


On 27/12/2021 9:56 PM, Axel Spoerl wrote:
I can narrow down the issue as follows:


The problem at hand occurs on a compile server, compiling desktop executables for Qt 5.15.2 (with GCC-7), Qt 6.2.2 (with GCC-9). To make both configurations work, QMAKE_CXX=g++-7 / QMAKE_CXX=g++-9 arguments are added in the respective Qt Creator build steps (which is necessary for Qt 6.2.2 even if g++-9 is specified as compiler in the kit itself).


Emscripten (intended as a 3rd compile target) has been installed according to https://doc.qt.io/qt-6/wasm.html <https://doc.qt.io/qt-6/wasm.html>  and https://emscripten.org/docs/getting_started/index.html <https://emscripten.org/docs/getting_started/index.html>

The emscripten installation is able to compile the latest openssl pulled from github.


No matter which GCC version is chosen in /etc/alternatives and no matter which emscripten version is activated (3.0.1 or 2.0.14): .../upstream/emscripten/cache/sysroot/include/c++ only contains the v1 directory.

The server's /usr/include/c++ contains v1, 7 and 9 according to the GCC versions installed. This is where my emscripten knowledge ends and I can only experiment (e.g. by manually linking the 9 directory into the emscripten cache, which is being ignored).


Compiling basic C++ code with #include <cmath> works for GCC 7 and produces the errors mentioned earlier for GCC 9 (i.e. Qt 6.2.2).


Makefiles are generated by qmake out of a single .pro file. The .pro file contains a WASM specific section to link against its own libcrypto and libssl. Apart from the compilers used, all Makefiles look almost identical.


=> It appears to me as if emscripten uses a default GCC version, which in case of GCC 9 being expected is the wrong one. This leads to the lib incompatibility as described by Thiago. I have not found options for em++, 'emsdk install' or 'emsdk activate', that provide a GCC selection. That may well be attributable to a lack of knowledge on my side.


> Well, Qt is a bit relevant if the qt-cmake of the Qt 6.2.2 WASM installation

 > results in broken make files.

 >

 > So the question is perhaps: Axel, assuming that you installed emscripten

 > following the instruction and that you can verify that you can compile

 > basic C++ code as Thiago suggested, how do you then generate your make

 > files?

 >

 > Volker

 >


_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

--
Lorn Potter
Freelance Qt Developer. Platform Maintainer Qt WebAssembly, Maintainer QtSensors
Author, Hands-on Mobile and Embedded Development with Qt 5

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to