[cmake-developers] Build failure due to {cd bindir} failed on Windows/Ninja
Jom O'Fisher
jomofisher at gmail.com
Fri Dec 29 16:32:54 EST 2017
>> Ninja should be using relative paths for the build tree and absolute
for anything outside of it.
That appears to be the case, so I need a better theory. I noticed another
difference between compilation phase and link phase. The link phase is
bracketed by cmd.exe /C "cd . && <actual-link-command> && cd .".
I'm wondering problem those "cd ." calls are solving? Their presences is
what's causing everything to be wrapped in "cmd /C"
Here's the error that encapsulates the failure
CMake Error at D:/Android/sdk/cmake/3.6.3155560/share/cmake-3.6/
Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"D:/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/
windows-x86_64/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/src/MyApplication/app/.externalNativeBuild/cmake/
debug/armeabi/CMakeFiles/CMakeTmp
Run Build Command:"D:\Android\sdk\cmake\3.6.3155560\bin\ninja.exe"
"cmTC_0dcd8"
[1/2] Building C object CMakeFiles/cmTC_0dcd8.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_0dcd8
FAILED: cmd.exe /C "cd . &&
D:\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\
windows-x86_64\bin\clang.exe
--target=armv5te-none-linux-androideabi
--gcc-toolchain=D:/Android/sdk/ndk-bundle/toolchains/arm-
linux-androideabi-4.9/prebuilt/windows-x86_64
--sysroot=D:/Android/sdk/ndk-bundle/sysroot -isystem
D:/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-D__ANDROID_API__=14 -g -DANDROID -ffunction-sections -funwind-tables
-fstack-protector-strong -no-canonical-prefixes -march=armv5te
-mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack
-Wformat -Werror=format-security -Wl,--exclude-libs,libgcc.a --sysroot
D:/Android/sdk/ndk-bundle/platforms/android-14/arch-arm -Wl,--build-id
-Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined
-Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now
-Wl,--gc-sections -Wl,-z,nocopyreloc
CMakeFiles/cmTC_0dcd8.dir/testCCompiler.c.o -o cmTC_0dcd8 -lm && cd ."
clang.exe: error: no such file or directory:
'CMakeFiles/cmTC_0dcd8.dir/testCCompiler.c.o'
ninja: build stopped: subcommand failed.
Notes:
(1) The change dir doesn't appear to have any non-ascii characters:
Change Dir: D:/src/MyApplication/app/.externalNativeBuild/cmake/
debug/armeabi/CMakeFiles/CMakeTmp
(2) The compile phase succeeds and produces a .o file:
[1/2] Building C object CMakeFiles/cmTC_0dcd8.dir/testCCompiler.c.o
(3) The link phase fails to consume the exact same _relative_ .o file:
clang.exe: error: no such file or directory:
'CMakeFiles/cmTC_0dcd8.dir/testCCompiler.c.o'
On Fri, Dec 29, 2017 at 7:02 AM, Ben Boeckel <ben.boeckel at kitware.com>
wrote:
> On Thu, Dec 28, 2017 at 12:51:20 -0800, Jom O'Fisher wrote:
> > (1) Invoke cmake to generate ninja project. Success.
> > * Note that generated rules.ninja has .o compilation dependencies with
> > absolute paths and .so link dependencies with relative paths.
>
> Ninja should be using relative paths for the build tree and absolute for
> anything outside of it.
>
> > (3) CMake changes tries to change it's working directory here:
> > https://github.com/Kitware/CMake/blob/08ce62bee5bee6805fbb01c1821c43
> > 8028e858dc/Source/cmGlobalGenerator.cxx#L1811
>
> What would cause `ChangeDirectory` to fail? Is there some non-ASCII in
> the directory path?
>
> --Ben
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20171229/069d88d1/attachment.html>
More information about the cmake-developers
mailing list