-
Notifications
You must be signed in to change notification settings - Fork 786
Fix warning (treated as error) when building with Emscripten #2605
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
Conversation
seen this happen with upstream. to be sure.
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.
PIC part lgtm, but some questions about the rest.
.travis.yml
Outdated
- docker exec -it emscripten bash ./travis-emcc-tests.sh | ||
- kill $PID | ||
# printing something every 5 minutes prevents Travis from timing out. |
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.
have you seen such timeouts?
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.
Yes, compiling Binaryen.js used to time out when I first tried the emscripten-upstream instead of the emscripten-fastcomp image (not here, but in my branch while investigating why upstream builds are broken), because compilation didn't print to console for more than 10 minutes, which Travis considers a stalled build, cancelling it. My expectation is that we will run into this sooner or later, so I thought why not add it.
@@ -107,11 +107,15 @@ jobs: | |||
services: | |||
- docker | |||
before_install: | |||
- docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash | |||
# TODO: Emscripten upstream produces a broken build in CI environments only :( |
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.
Is this fixing an actual issue on this CI? (If so why don't tests fail?)
If it's trying to prevent an issue we only see on other CI, is that necessary?
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.
Edit: See comment below first.
This is a common thing on Travis, which cancels jobs when it doesn't see console output for 10 minutes, usually affecting long-running build tasks like this one (also see comment above). They have a bash function named travis_wait
for this, but the last time I checked it suppressed output while the task executes so one can't watch the build. Adding this doesn't seem strictly necessary based on the latest test runs, but is very likely to prevent issues in the future.
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.
Just noticed that your question was about something different. Tests do indeed fail when using the emscripten-upstream
image, but it works when using the legacy emscripten-fastcomp
image (emscripten:sdk-incoming-64bit
is an outdated variant of fastcomp not updated anymore). This is happening since the first day Emscripten switched to upstream by default and I started testing it, so I thought a TODO would be appropriate to raise awareness. This is a very odd problem in that
- Affects only upstream, not fastcomp
- It compiles fine, but the output is broken (hits assertions)
- It only happens on CI (both Travis and GitHub Actions)
- I can't reproduce it locally
- It does not affect debug builds
- It affects any release build (without closure etc. etc.)
- Apparently isolated to building Binaryen.js
- Happens with both the Docker image and just Emsdk
(At least the last time I checked)
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.
This sounds worth investigating. The fact that you can't repro it locally is very strange, especially since using the docker image should produce identical results.
I guess I'm OK landing this if its urgent but I'd rather try to fix instead.
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.
This PR is unrelated to the upstream breakage, though, it only updates the outdated fastcomp image to a recent fastcomp image (both work) and adds the TODO comment.
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.
Oh I see sdk-incoming
is also fastcomp?
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.
Yeah, I believe that's Emscripten before upstream became the default, and they then switched to the other naming.
@@ -185,7 +185,7 @@ else() | |||
if(WIN32) | |||
add_compile_flag("-D_GNU_SOURCE") | |||
add_link_flag("-Wl,--stack,8388608") | |||
else() | |||
elseif(NOT EMSCRIPTEN) | |||
add_compile_flag("-fPIC") |
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.
What is this flag even doing here in the first place? CMake should be adding this automatically when it knows its building a DLL, no? I'm OK with landing this part of the change for now, but would like to look into removing this line completely
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.
Might this have something to do with this warning?
CMake Warning (dev) at CMakeLists.txt:272 (add_library):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
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 we not be trying to build with SHARED using emscripten, as the warning says.
Other platforms can use SHARED but the emscripten build should only use STATIC.
Agree the timeout bash timeout thing doesn't belong as part of this change. Hopefully we can find a solution to that issue which isn't quite so hacky.. doesn't travis maybe have way to extend the timeout? |
Removed the timeout thing for now but tried to elaborate a bit why I considered it a good idea in the comments above. If you like, I can make it a separate PR. |
Friendly ping :) |
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.
In that case LGTM
@@ -107,11 +107,15 @@ jobs: | |||
services: | |||
- docker | |||
before_install: | |||
- docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash | |||
# TODO: Emscripten upstream produces a broken build in CI environments only :( |
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.
Oh I see sdk-incoming
is also fastcomp?
Omits the
-fPIC
option when building with Emscripten and updates the Docker image.The buildbot is currently failing with latest-fastcomp Emscripten due to
so this PR excludes the flag when building the JS or Wasm versions. I guess CI didn't catch this because it uses an outdated docker image.