Corrade fails to compile with emscripten 3.1.22
kokulshan opened this issue · 4 comments
It seems Corrade fails trying to find the function isatty with emscripten 3.1.22. On my local copy, I managed to fix it by including unistd.h in Debug.cpp under #elif defined(CORRADE_TARGET_EMSCRIPTEN)
FAILED: src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Debug.cpp.o
C:\Source\mixedreality.vcpkgbuilder\packages\su-externals\BuildToolsRepo__toolPackages\Windows\Cpp\emsdk\upstream\emscripten\em++.bat -DCORRADE_IS_DEBUG_BUILD -IC:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src -IC:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/wasm32-emscripten-dbg/src -g -g -g -std=c++11 -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -Wpedantic -fvisibility=hidden -fvisibility-inlines-hidden -Wmissing-prototypes -Wno-shorten-64-to-32 -MD -MT src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Debug.cpp.o -MF src\Corrade\Utility\CMakeFiles\CorradeUtilityObjects.dir\Debug.cpp.o.d -o src/Corrade/Utility/CMakeFiles/CorradeUtilityObjects.dir/Debug.cpp.o -c C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:356:35: error: use of undeclared identifier 'isatty'; did you mean 'isTty'?
((output == &std::cout && isatty(1)) ||
^~~~~~
isTty
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:337:13: note: 'isTty' declared here
bool Debug::isTty(std::ostream* const output) {
^
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:356:42: error: cannot initialize a parameter of type 'std::ostream ' (aka 'basic_ostream ') with an rvalue of type 'int'
((output == &std::cout && isatty(1)) ||
^
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:337:39: note: passing argument to parameter 'output' here
bool Debug::isTty(std::ostream const output) {
^
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:357:35: error: use of undeclared identifier 'isatty'; did you mean 'isTty'?
(output == &std::cerr && isatty(2)))
^~~~~~
isTty
C:/Source/mixedreality.vcpkgbuilder/packages/su-externals/__vcpkg/buildtrees/corrade/src/ee686c341d-33b116b212.clean/src/Corrade/Utility/Debug.cpp:337:13: note: 'isTty' declared here
bool Debug::isTty(std::ostream const output) {
Try disabling CORRADE_UTILITY_USE_ANSI_COLORS
so that the #elsif
reserved for emscripten can kick in.
Huh, wait a moment. The code path that uses isatty()
shouldn't be used on Emscripten at all. That's a Vcpkg package bug, probably a leftover from the times when it was Windows-only -- i.e., this line should be there only for Windows and nothing else.
I'll work around it here but the package itself needs to be fixed.
Removing that line in portfile.cmake fixed it for me.
Should be worked around in fc36498, I'm tracking the vcpkg package fix in mosra/magnum#453.
Thanks for reporting this! 👍