Skip to content
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

[BUG] standalone clang batch files point to clang++ on Windows #920

Closed
eliasnaur opened this issue Feb 27, 2019 · 2 comments
Closed

[BUG] standalone clang batch files point to clang++ on Windows #920

eliasnaur opened this issue Feb 27, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@eliasnaur
Copy link


Description

Invoking the new in r19b standalone clang on Windows gave me this weird error:

clang++.exe: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

It turns out that the Windows clang *.cmd actually points to clang++. For example, the content of toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang.cmd is below. Note the references to "clang++.exe"

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

set "_BIN_DIR=" && %_BIN_DIR%clang++.exe --target=armv7a-linux-androideabi16 -fno-addrsig -stdlib=libc++ %*
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

Using the builtin standalone clangs from Linux or macOS works fine. Editing the Windows batch files to refer to clang.exe instead of clang++.exe also fixes the problem.

Another thing is that it seems that there are no clang++ Windows batch files included. I don't need clang++, but that might be part of the issue.

Environment Details

  • NDK Version: r19b
  • Build system: Using clang directly with CC= for a Go Android project.
  • Host OS: Windows 10 64-bit
  • Compiler: clang
@DanAlbert
Copy link
Member

Another thing is that it seems that there are no clang++ Windows batch files included. I don't need clang++, but that might be part of the issue.

Yep, typo meant both wrappers were written to the same location, so the clang++ one clobbered the clang one.

https://android-review.googlesource.com/c/platform/ndk/+/914453

@DanAlbert DanAlbert self-assigned this Feb 27, 2019
@DanAlbert DanAlbert added this to the r19c milestone Feb 27, 2019
disigma pushed a commit to wimal-build/ndk that referenced this issue Feb 27, 2019
The clang++ script was clobbering the clang one.

Test: ./checkbuild.py --system windows64 toolchain  # check scripts
Bug: android/ndk#920
Change-Id: I605cb47fa7ec3156d3a84eda1ea3918a47400f05
disigma pushed a commit to wimal-build/ndk that referenced this issue Feb 28, 2019
The clang++ script was clobbering the clang one.

Test: ./checkbuild.py --system windows64 toolchain  # check scripts
Bug: android/ndk#920
Change-Id: I605cb47fa7ec3156d3a84eda1ea3918a47400f05
disigma pushed a commit to wimal-build/ndk that referenced this issue Feb 28, 2019
The clang++ script was clobbering the clang one.

Test: ./checkbuild.py --system windows64 toolchain  # check scripts
Bug: android/ndk#920
Change-Id: I605cb47fa7ec3156d3a84eda1ea3918a47400f05
(cherry picked from commit 1d395bf)
@DanAlbert
Copy link
Member

Merged into r19.

grendello added a commit to grendello/xamarin-android that referenced this issue Mar 21, 2019
Upstream [changes][0]:

 * [Issue 912][1]: Prevent the CMake toolchain file from clobbering a user
   specified `CMAKE_FIND_ROOT_PATH`.
 * [Issue 920][2]: Fix clang wrapper scripts on Windows.

[0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c
[1]: android/ndk#912
[2]: android/ndk#920
grendello added a commit to grendello/xamarin-android that referenced this issue Mar 21, 2019
Upstream [changes][0]:

 * [Issue 912][1]: Prevent the CMake toolchain file from clobbering a user
   specified `CMAKE_FIND_ROOT_PATH`.
 * [Issue 920][2]: Fix clang wrapper scripts on Windows.

[0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c
[1]: android/ndk#912
[2]: android/ndk#920
jonpryor pushed a commit to xamarin/xamarin-android that referenced this issue Mar 22, 2019
Upstream [changes][0]:

  * [Issue 912][1]: Prevent the CMake toolchain file from clobbering
    a user specified `CMAKE_FIND_ROOT_PATH`.
  * [Issue 920][2]: Fix clang wrapper scripts on Windows.

[0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c
[1]: android/ndk#912
[2]: android/ndk#920
mehulagg pushed a commit to mehulagg/superproject that referenced this issue Dec 21, 2019
* Update ndk from branch 'ndk-release-r20'
  to ba9b52c9be94c60468698486716fdc7c85e5f002
  - Merge "Fix <prefix>clang++.cmd script." into ndk-release-r20
  - Fix <prefix>clang++.cmd script.
    
    The clang++ script was clobbering the clang one.
    
    Test: ./checkbuild.py --system windows64 toolchain  # check scripts
    Bug: android/ndk#920
    Change-Id: I605cb47fa7ec3156d3a84eda1ea3918a47400f05
    (cherry picked from commit 1d395bf96eac080dfd909e3f2900305e75239b87)
mehulagg pushed a commit to mehulagg/superproject that referenced this issue Dec 21, 2019
* Update ndk from branch 'ndk-release-r19'
  to 88350f28abb09af110bc7e4fba1b8bc473a2c331
  - Merge "Fix <prefix>clang++.cmd script." into ndk-release-r19
  - Fix <prefix>clang++.cmd script.
    
    The clang++ script was clobbering the clang one.
    
    Test: ./checkbuild.py --system windows64 toolchain  # check scripts
    Bug: android/ndk#920
    Change-Id: I605cb47fa7ec3156d3a84eda1ea3918a47400f05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants