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

redirecting incorrect #include <sys/poll.h> to <poll.h> , compilation failed #5447

Closed
DimTheo opened this issue Aug 8, 2017 · 8 comments
Closed
Labels

Comments

@DimTheo
Copy link

DimTheo commented Aug 8, 2017

screenshot from 2017-08-08 23-45-24

I'm trying to compile MAME (https://github.com/mamedev/mame) but this is what I get. The first time I tried to compile, it converted, compressed, compiled some stuff, then it threw this error. Now every time I try to compile, I get the same error right away.

I haven't run ./configure by the way, because I can't figure a proper way to do it.

@kripken
Copy link
Member

kripken commented Aug 8, 2017

It says "gcc 5.4.0 detected" which I think means it is not using emcc. So it is compiling using the wrong compiler, and you may need to run a configure script or something like that. Might be best to ask the MAME project directly, I believe their emscripten port is upstream (another possible place is the jsmess irc channel on EFNet, some people working on that port are usually there i believe).

@DopefishJustin
Copy link
Contributor

DopefishJustin commented Aug 9, 2017

The GCC message is not meaningful, the MAME build system prints it even when compiling under Emscripten and I haven't bothered figuring out why.

The poll.h error on the other hand is real and I get it as well. It can be worked around by adding NOWERROR=1 to the make command line.

MAME does not have a configure script.

@DimTheo
Copy link
Author

DimTheo commented Aug 10, 2017

Un-commenting NOWERROR=1 in the makefile of the mame directory solved the problem.
Thank you for your help.

@juj
Copy link
Collaborator

juj commented Aug 10, 2017

The history of that warning is that at least POSIX.1-2001, POSIX.1-2008 and Single Unix Specification (at http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html) state that the include directive should be #include <poll.h>.

Looking at Android's implementation, there exist both sys/poll.h, and poll.h, where poll.h includes to sys/poll.h without issuing a warning:

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/sys/poll.h
https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/poll.h

Perhaps we should then just drop the warning as well, it looks a bit pedantic in nature, given that other platforms support the nonstandard(?) #include <sys/poll.h> in addition to #include <poll.h>.

juj added a commit to juj/emscripten that referenced this issue Aug 10, 2017
….h> as opposed to the POISX and Unix standard #include <poll.h>, and keep supporting both. This is what Android glibc does as well, see emscripten-core#5447.
@juj
Copy link
Collaborator

juj commented Aug 10, 2017

Oh, on other thought, it looks like that warning is not an Emscripten-specific added warning, but comes directly from upstream musl: https://git.musl-libc.org/cgit/musl/tree/include/sys/poll.h. So perhaps we don't want to change this then.

Would it be possible for MAME to change to using the standard(?) #include <poll.h> instead of #include <sys/poll.h>? What motivates #include <sys/poll.h> ? I wonder if there is some other BSD or other related standard that has sys/poll.h instead?

@DopefishJustin
Copy link
Contributor

It's not MAME code, it comes from upstream asio. It seems to have recently been fixed there so we should be able to just update: chriskohlhoff/asio@5adce6e

@DopefishJustin
Copy link
Contributor

The commit mentioned above does not actually fix the problem for Emscripten but I have created a pull request that does: chriskohlhoff/asio#260

@stale
Copy link

stale bot commented Sep 19, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Sep 19, 2019
@stale stale bot closed this as completed Sep 26, 2019
overhacked added a commit to overhacked/infnoise that referenced this issue Jan 27, 2022
`poll.h` is the POSIX standard include location, and MUSL
libc issues a warning (which infnoise's `-Werror` in CFLAGS
makes into an error).

For more context:
- [Linux manpage for `poll(2)`][1]
- [Open Group UNIX Specification][2]
- [Relevant discussion over at the `emscripten` project][3]

[1]: https://man7.org/linux/man-pages/man2/poll.2.html
[2]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html
[3]: emscripten-core/emscripten#5447 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants