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
Cygwin build fixes #1332
Cygwin build fixes #1332
Conversation
On cygwin, `__STRICT_ANSI__` does not show POSIX definitions. Use gnu++11 language instead.
Silence -Wsign-compare warning, by using unsigned literal one.
Use `%u` instead of `%lu` as we use `uint32_t` here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks!
Cool! Can you point to the code where use used the C-API? I'm keen to see it an action. |
else() | ||
# On Cygwin, POSIX extensions are not visible with std=c++11 | ||
# because it defines __STRICT_ANSI__. | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to define _POSIX_SOURCE or something like that to signal that we want POSIX rather than asking for GNU extensions? I also don't think its a great idea to use different -std
on different platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, there's room for improvement. Currently, the only POSIX consumers are
Line 69 in 4ba97c1
return isatty(fileno(file)); |
color.cc
we'd just have _POSIX_C_SOURCE
on it but I'm not sure how do we want to deal with gtest...
So I choose to limit gnu++11
to Cygwin and leave it as-is on the other (major) implementations such as glibc(Linux) or BSD libc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to define _POSIX_C_SOURCE for the whole project (assuming that works) than turn on GNU extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll try. I found gtest upstream also have a proposed patch https://github.com/google/googletest/pull/2653/files so we should be able to do the same here.
The only culprit seems strcasecmp
which is also POSIX. I'll chase why Cygwin does not export it under _POSIX_C_SOURCE=200809L
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed: #1333
Not more than copy/pasted from hello.c: https://github.com/okuoku/freestandoom/blob/9150923c78a169d1563100fbc85a1302c0bab5df/host-common/callwasm.c I found current C API implementation lacks Currently it does not have any proper build system/instructions(sorry!) video instead: https://www.youtube.com/watch?v=EBF7E6_qkn8 |
Build fixes to run wabt tools on Cygwin64. I haven't tested it much, but at least it runs DOOM okuoku/freestandoom#2 with the interpreter + WASM C-API :)
fileno
under-std=c++11
; use-std=gnu++11
instead.%lu
here would take some garbage, as argument isuint32_t
. I guess it can bePRIu32
but followed other occurrences there.1U