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

Error: 'bits/alltypes.h' "file not found" in newer images #51

Closed
andrewleech opened this issue Sep 16, 2019 · 10 comments
Closed

Error: 'bits/alltypes.h' "file not found" in newer images #51

andrewleech opened this issue Sep 16, 2019 · 10 comments

Comments

@andrewleech
Copy link

Hi,
Thanks for your work on this image!
I'm attempting to use this for building the javascript port of micropython but on the latest images it throws a long list of

In file included from ../../extmod/moduwebsocket.c:27:
/emsdk_portable/emscripten/tag-1.38.42/system/include/libc/stdio.h:22:10: fatal error: 'bits/alltypes.h' file not found
#include <bits/alltypes.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.

Which looks very similar to emscripten-core/emscripten#9205

I tried a couple of versions back, trzeci/emscripten:sdk-tag-1.38.42-64bit had the same compile error, but trzeci/emscripten:sdk-tag-1.38.41-64bit so this lines up with the versions in the above issue.

Based on that issue, I suspect llvm may need updating?

@VirtualTim
Copy link
Contributor

Have you tried sdk-tag-1.38.43-64bit?

@andrewleech
Copy link
Author

I initially tried latest, which appears to be sdk-tag-1.38.43-64bit currently. That's where I first encountered this error.

@trzecieu
Copy link
Owner

I've found a similar issue in the main project: emscripten-core/emscripten#9205 Can you check if this is something that you can try?

@andrewleech
Copy link
Author

Yes that's the same issue I linked to, this comment on particular is the one that looks like it might be also related to the llvm version: emscripten-core/emscripten#9205 (comment)

After that point of discussion they move onto a different issue.

Fwiw I'm currently building successfully with .41 which I'm happy to stick with for now, it's basically just for demonstration use at this stage.

In case you're interested, CI build script:
https://gitlab.com/alelec/micropython_ci/blob/master/ports/javascript/.gitlab-ci.yml

Building micropython in the browser:
https://alelec.gitlab.io/micropython_ci/javascript.html

@kripken
Copy link

kripken commented Sep 16, 2019

It should be easy to debug this using emcc -v, which will print out the include paths. Then you can see if bits/alltypes.h is present in one of those.

Note that emscripten used to have a symlink for that, but removed it since it didn't work on windows. I'm not aware of any bugs atm in upstream. Perhaps the docker image is missing some of the necessary files?

@trzecieu
Copy link
Owner

Sorry @andrewleech, I missed that you've posted this issue in the main topic.

I've tried to reproduce this issue locally without success so far.

Sample

#include <stdio.h>
#include <bits/alltypes.h>

int main(int argc, char** argv) {
    printf("Test Test: %d\n", argc);
    fflush(stdout);
    return 0;
}

1.38.41

➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:sdk-tag-1.38.41-64bit find /emsdk_portable/ -name alltypes.h
/emsdk_portable/emscripten/tag-1.38.41/system/lib/libc/musl/arch/emscripten/bits/alltypes.h
➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:sdk-tag-1.38.41-64bit emcc -v test.c 
 /emsdk_portable/emscripten/tag-1.38.41/system/include/libcxx
 /emsdk_portable/emscripten/tag-1.38.41/system/lib/libcxxabi/include
 /emsdk_portable/emscripten/tag-1.38.41/system/include/compat
 /emsdk_portable/emscripten/tag-1.38.41/system/include
 /emsdk_portable/emscripten/tag-1.38.41/system/include/libc
 /emsdk_portable/emscripten/tag-1.38.41/system/lib/libc/musl/arch/emscripten
 /emsdk_portable/emscripten/tag-1.38.41/system/local/include
 /emsdk_portable/emscripten/tag-1.38.41/system/include/SDL
 /emsdk_portable/clang/tag-e1.38.41/build_tag-e1.38.41_64/lib/clang/6.0.1/include

1.38.43

➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:sdk-tag-1.38.43-64bit find /emsdk_portable/ -name alltypes.h
/emsdk_portable/emscripten/tag-1.38.43/system/lib/libc/musl/arch/emscripten/bits/alltypes.h
➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:sdk-tag-1.38.43-64bit emcc -v test.c
...
 /emsdk_portable/emscripten/tag-1.38.43/system/include/libcxx
 /emsdk_portable/emscripten/tag-1.38.43/system/lib/libcxxabi/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/compat
 /emsdk_portable/emscripten/tag-1.38.43/system/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/libc
 /emsdk_portable/emscripten/tag-1.38.43/system/lib/libc/musl/arch/emscripten
 /emsdk_portable/emscripten/tag-1.38.43/system/local/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/SDL
 /emsdk_portable/clang/tag-e1.38.43/build_tag-e1.38.43_64/lib/clang/6.0.1/include

latest

➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:latest find /emsdk_portable/ -name alltypes.h
/emsdk_portable/emscripten/tag-1.38.43/system/lib/libc/musl/arch/emscripten/bits/alltypes.
➜ docker run --rm -it -v `pwd`:/src trzeci/emscripten:latest emcc -v test.c                        
...
 /emsdk_portable/emscripten/tag-1.38.43/system/include/libcxx
 /emsdk_portable/emscripten/tag-1.38.43/system/lib/libcxxabi/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/compat
 /emsdk_portable/emscripten/tag-1.38.43/system/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/libc
 /emsdk_portable/emscripten/tag-1.38.43/system/lib/libc/musl/arch/emscripten
 /emsdk_portable/emscripten/tag-1.38.43/system/local/include
 /emsdk_portable/emscripten/tag-1.38.43/system/include/SDL

Tried also upstream just in case and looks that it works just fine. At least there is no sign that it shouldn't.

Do you thin that you can change ci script and check with emcc -v to see what we have there?

@trzecieu
Copy link
Owner

trzecieu commented Sep 16, 2019

@andrewleech
I was able to reproduce this issue with your repository, and indeed it's something changed in 1.38.42+

I've found:

ifdef EMSCRIPTEN
    CPP += -isystem $(EMSCRIPTEN)/system/include/libc -cxx-isystem $(EMSCRIPTEN)/system/include/libcxx
endif

In your make file, this looks incompatible with emscripten-core/emscripten#9197

Simple changing it to:

ifdef EMSCRIPTEN
	CPP += -isystem $(EMSCRIPTEN)/system/include/libc
	CPP += -isystem $(EMSCRIPTEN)/system/lib/libc/musl/arch/emscripten
	CPP += -cxx-isystem $(EMSCRIPTEN)/system/include/libcxx
endif

Fixed the problem with compilation

@andrewleech
Copy link
Author

andrewleech commented Sep 16, 2019

I was just testing it myself and it appears to be somewhat of a false alarm; the first stage of building is using clang to pre-process a bunch of stuff.
It's clang that can't find the header, not emcc.

Yes, your change looks good and makes sense based on my findings, I'll submit a patch for that to the micropython project upstream.

Thanks so much for your help!

@trzecieu
Copy link
Owner

Happy to help!
Cheers,

@fei2020
Copy link

fei2020 commented Apr 15, 2020

Thank you. I fix the same problem according to your way. Then I get another error that can't find wasi/api.h. I add
"CPP += -isystem $(EMSCRIPTEN)/system/include/" to fix it too.
BTW. @andrewleech I use upy 1.11 release. Is your submit realeased in upy 1.12?

But my questions are:
1 Why the same micropython project get different when use different emscripten version?
2 Why $EMSCRIPTEN env var was geted rid of after emscripten 1.38.29. I am not sure the exact version. I just know 1.38.29 has $EMSCRIPTEN. But when I use 1.38.33, I must set the env var handly to meet the micropython ports/javascript/makefile.

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

No branches or pull requests

5 participants