-
Notifications
You must be signed in to change notification settings - Fork 252
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
Doesn't compile with -Werror on clang due to implicit addition of -Wa,noexecstack #171
Comments
Works for me, though the argument is spelled Assuming that wasn't your issue, are you using |
Not sure if @vlovich got to the error in the same way, but I got it by trying to build audio-echo NDK sample with cmake. This is with today's NDK build.
|
CMake automatically forwards all compiler flags to the linker, and clang doesn't like having -Wa flags being used for linking. To prevent CMake from doing this would require meddling with the CMAKE_<LANG>_COMPILE_OBJECT rules, which would get quite messy. Bug: android/ndk#171 Change-Id: I3295948db64d3459db3af7ba3f0d431689812f80 (cherry picked from commit 78eb716552a0b43c2fc36bebf8ad991e6c77dca9)
CMake automatically forwards all compiler flags to the linker, and clang doesn't like having -Wa flags being used for linking. To prevent CMake from doing this would require meddling with the CMAKE_<LANG>_COMPILE_OBJECT rules, which would get quite messy. Bug: android/ndk#171 Change-Id: I3295948db64d3459db3af7ba3f0d431689812f80
I uses NDK r16 with standalone toolchain, i pass
Then i change to use
So is there any side effect of the warning message? Can i just remove |
Are you passing that while compiling or while linking? |
I use cmake, and pass it to CFLAGS, then use cmake and make to build target. So i think it is used in compiling. |
Wait, are you using a standalone toolchain or are you using cmake? You've said both. |
Mixing standalone toolchain and cmake, is there any problem? Standalone toolchain just used to assign |
If you're not using our cmake toolchain file then you don't have the fix for this. See the commit message for the change up the thread for an explanation of why this happens with CMake. There's no reason to use a standalone toolchain with CMake. The whole point of standalone toolchains is to interface with build systems we don't natively support. Just use our cmake toolchain file. |
Could you show me how to? Now what i do is:
Currently everything works fine. I just use the building system to build 3rd party libraries used in game engine.
But i has the same warning messages. Is it any problem? |
3rd party libraries, such as png, doesn't use NDK cmake toolchain, but almost all uses |
I wanted to bump this issue for @DanAlbert. I'm seeing this error with ccache + linux + NDK r17 + clang. I'm using the toolchain as follows:
Here is the command that
I get error:
By removing the
|
@pirama-arumuga-nainar So basically I have to do:
I'll give it a shot. |
@jeduden See the link in the comment:
Since |
### Issues: Resolves #192 ### Description of changes: * Clang with the Android NDK doesn't compile with `-Werror` on clang due to implicit addition of `-Wa,noexecstack`. Since `--Wa,--noexecstack` is not used during the preprocessor step (because assembler is not invoked), Clang reports that argument as unused. Added a removal the flag during FIPS builds for Android. Context: android/ndk#171 * CMAKE inserts a `\` before whitespaces in arguments, which Android line does not recognize when using `add_custom_command`. This caused `${CMAKE_ASM_COMPILER}` to fail during the preprocessing step. Replacing whitespaces with `;` fixes this. Context: https://stackoverflow.com/questions/8925396/why-does-cmake-prefixes-spaces-with-backslashes-when-executing-a-command By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
### Issues: Resolves aws#192 ### Description of changes: * Clang with the Android NDK doesn't compile with `-Werror` on clang due to implicit addition of `-Wa,noexecstack`. Since `--Wa,--noexecstack` is not used during the preprocessor step (because assembler is not invoked), Clang reports that argument as unused. Added a removal the flag during FIPS builds for Android. Context: android/ndk#171 * CMAKE inserts a `\` before whitespaces in arguments, which Android line does not recognize when using `add_custom_command`. This caused `${CMAKE_ASM_COMPILER}` to fail during the preprocessing step. Replacing whitespaces with `;` fixes this. Context: https://stackoverflow.com/questions/8925396/why-does-cmake-prefixes-spaces-with-backslashes-when-executing-a-command By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
It looks like clang doesn't understand this argument so supplying Werror causes the build to break.
An example of this is libquic which fails to build because the project itself adds Werror (& -Wa,noexecstack) which results in an "argument unused during compilation" warning.
When the clang toolchain is used, then the correct set of arguments should be configured to be used instead.
The text was updated successfully, but these errors were encountered: