-
Notifications
You must be signed in to change notification settings - Fork 250
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
Duplicate compiler flags on first CMake invocation #323
Comments
Given how temperamental cmake toolchain files seem to be, I'm going to get this into r15 beta 1 to try to flush out any issues early. |
Possibly related: When a build fails with an error in Android Studio the first time after having changed CMakeLists or its parameters, it immediately starts another gradle sync and wipes out the build log from the Gradle Console window, which is pretty annoying. |
Does that happen even with the snippet to fix this is added? If so it's probably something we should raise with the Studio team. |
Actually, still happens with the snipped fix added, so it's an unrelated issue. Repro:
After step 4, gradle will immediately wipe the build log when the build error happens and start a sync, as I mentioned above, requiring another click on the build button to see the error text. Guess I should go file that over at https://code.google.com/p/android/issues/entry?template=Tools%20bug%20report ? |
@hrydgard: Yeah, they should be able to help you. https://android-review.googlesource.com/c/353248/ to fix spurious rebuilds in r15 beta 1. Thanks for the fix, @kkaefer! |
CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds. This was causing the various flags to be added twice on the first build, and on a rebuild ninja would see only one set of the flags and rebuild the world. Test: ./validate.py Bug: android/ndk#323 Change-Id: I18ceb3b785ec7aea442b2cc226b5f515282c7097
Currently with the build instructions provided in README.md the build will fail. In the r25 NDK the CMake toolchain defaults to the legacy path, due to a bug in the current implementation. android/ndk#323
Currently with the build instructions provided in README.md the build will fail. In the r25 NDK the CMake toolchain defaults to the legacy path, due to a bug in the current implementation. android/ndk#323
Currently with the build instructions provided in README.md the build will fail. In the r25 NDK the CMake toolchain defaults to the legacy path, due to a bug in the current implementation. android/ndk#323
I'm using NDK r14, but have observed this behavior in earlier NDKs as well: When generating the build directory with CMake, the first invocation adds the Android-specific compiler flags twice. E.g. when compiling for
armeabiv7-a
, I'm seeing two sets of these flags:While this doesn't make the build fail, a subsequent rerun of CMake (e.g. triggered by a changed
CMakeLists.txt
file) will rebuild the ninja file to only include one set of these flags. This will in turn trigger a full recompile of all sources, since the compile flags changed. On larger project, this is undesirable since it takes a long time.The error happens because CMake invokes the toolchain file twice during the first build, but only once during subsequent build system rebuilds.
This can be solved by adding an include guard at the top of the toolchain file:
The text was updated successfully, but these errors were encountered: