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

Corrade fails to compile with emscripten 3.1.22 #153

Closed
kokulshan opened this issue Nov 1, 2022 · 4 comments
Closed

Corrade fails to compile with emscripten 3.1.22 #153

kokulshan opened this issue Nov 1, 2022 · 4 comments

Comments

@kokulshan
Copy link

kokulshan commented Nov 1, 2022

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) {

@kokulshan kokulshan changed the title Corrade fails to compile with emscripten 3.12.3 Corrade fails to compile with emscripten 3.1.22 Nov 1, 2022
@sthalik
Copy link
Contributor

sthalik commented Nov 2, 2022

Try disabling CORRADE_UTILITY_USE_ANSI_COLORS so that the #elsif reserved for emscripten can kick in.

@mosra mosra added this to the 2022.0a milestone Nov 2, 2022
@mosra
Copy link
Owner

mosra commented Nov 2, 2022

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.

@kokulshan
Copy link
Author

Removing that line in portfile.cmake fixed it for me.

@mosra
Copy link
Owner

mosra commented Nov 2, 2022

Should be worked around in fc36498, I'm tracking the vcpkg package fix in mosra/magnum#453.

Thanks for reporting this! 👍

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

No branches or pull requests

3 participants