Skip to content

[BUG] clang.cmd doesn't work well with -march=armv7-a #1856

@Berrysoft

Description

@Berrysoft

Description

I've installed NDK 25.2.9519653 and want to work with rust. However, the content of *-*-*-clang.cmd causes issues. The content of such cmd script is:

@echo off
setlocal
call :find_bin
if "%1" == "-cc1" goto :L

set "_BIN_DIR=" && "%_BIN_DIR%clang.exe" --target=armv7a-linux-androideabi24 %*
if ERRORLEVEL 1 exit /b 1
goto :done

:L
rem Target is already an argument.
set "_BIN_DIR=" && "%_BIN_DIR%clang.exe" %*
if ERRORLEVEL 1 exit /b 1
goto :done

:find_bin
rem Accommodate a quoted arg0, e.g.: "clang"
rem https://github.com/android-ndk/ndk/issues/616
set _BIN_DIR=%~dp0
exit /b

:done

The fourth line, if "%1" == "-cc1" goto :L, causes issues. Rust put a param "-march=armv7-a" with armv7a target, and cmd will throw error

=armv7-a"" was unexpected at this time.

That's because the line is interpreted as if ""-march=armv7-a"" == "-cc1" goto :L. When I comment out this line, it works well.

Affected versions

r25

Canary version

No response

Host OS

Windows

Host OS version

Windows 11

Affected ABIs

armeabi-v7a

Build system

ndk-build

Other build system

No response

minSdkVersion

24

Device API level

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions