Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CMakeLists.txt improvements.#318

Merged
nsurbay merged 1 commit intoQBDI:dev-nextfrom
Redbeanw44602:dev-next
Jan 5, 2026
Merged

CMakeLists.txt improvements.#318
nsurbay merged 1 commit intoQBDI:dev-nextfrom
Redbeanw44602:dev-next

Conversation

@Redbeanw44602
Copy link
Contributor

Hello, this PR is more accurately described as an improvement than a fix.

This project fails to compile when ANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF with android x86/x86-64. Some higher-level build systems may define this switch globally to prevent the NDK toolchain file from modifying CXXFLAGS/CFLAGS.

-- Targeting X86
-- The ASM-ATT compiler identification is unknown
-- Didn't find assembler
CMake Error at CMakeLists.txt:257 (enable_language):
  No CMAKE_ASM-ATT_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM-ATT" or the CMake cache entry CMAKE_ASM-ATT_COMPILER to the
  full path to the compiler, or to the compiler name if it is in the PATH.

This is due to the combined implicit behavior of both CMake and NDK toolchain files:

  • CMake: enable_language(ASM-ATT) The actual behavior is to look up GNU as (not any assembler that supports AT&T syntax!).
  • NDK: The legacy behavior implicitly defines CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER, causing CMake to look for tools on the host machine.

This results in GNU-as being available under NDK legacy behavior (requires the host machine to have the GNU toolchain installed).

I suggest using enable_language(ASM) instead of enable_language(ASM-ATT). The former actually behaves in CMake as follows: uses the compiler as the assembler. Since the NDK always uses clang, and clang supports AT&T input, so you do not need to modify any assembly code.

The only thing that needs to be modified is --noexecstack. Since clang is a compiler driver and not a real assembler, it does not support this option, so I passed it to the linker.

@Redbeanw44602 Redbeanw44602 changed the title CMakelists.txt improvements. CMakeLists.txt improvements. Jan 2, 2026
@nsurbay nsurbay mentioned this pull request Jan 5, 2026
@nsurbay nsurbay merged commit 15856c1 into QBDI:dev-next Jan 5, 2026
68 of 69 checks passed
@nsurbay nsurbay added this to the Next Release (0.12.1) milestone Jan 5, 2026
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

Successfully merging this pull request may close these issues.

2 participants

Comments