Why does cleaning my Android project generate C++ build system [clean] failed - c++

My current Android application contains some cpp code
It was gradle synching, cleaning, building, and running fine with no errors until i installed the latest version of cmake with homebrew
the version of cmake installed on my mac is 3.24.1
and my Android project has
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.24.1)
and gradle of
kotlinOptions {
jvmTarget = '11'
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.24.1'
}
}
i can synch gradle, build, refresh linked c++ projects without any issues
however when i clean project i get the following errors
> Task :shared:covert:externalNativeBuildCleanDevelopmentDebug FAILED
Clean native-lib-armeabi-v7a
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
> Task :shared:covert:externalNativeBuildCleanDevelopmentRelease FAILED
Clean native-lib-x86
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
> Task :shared:covert:externalNativeBuildCleanProductionDebug FAILED
Clean native-lib-armeabi-v7a
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
> Task :shared:covert:externalNativeBuildCleanProductionRelease FAILED
Clean native-lib-x86
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
> Task :shared:covert:externalNativeBuildCleanStagingDebug FAILED
Clean native-lib-armeabi-v7a
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
> Task :shared:covert:externalNativeBuildCleanStagingRelease FAILED
Clean native-lib-x86
C/C++: /bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
C/C++: ninja: error: rebuilding 'build.ninja': subcommand failed
and this
FAILURE: Build completed with 6 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:covert:externalNativeBuildCleanDevelopmentDebug'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/frank/github/mobile-android-showcase/shared/covert/.cxx/Debug/5u70473e/armeabi-v7a'
[0/1] Re-running CMake...
FAILED: build.ninja
/usr/local/Cellar/cmake/3.23.2/bin/cmake --regenerate-during-build -S/Users/frank/github/mobile-android-showcase/shared/covert/src/main/cpp -B/Users/frank/github/mobile-android-showcase/shared/covert/.cxx/Debug/5u70473e/armeabi-v7a
C++ build system [clean] failed while executing:
/Users/frank/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-C \
/Users/frank/github/mobile-android-showcase/shared/covert/.cxx/Debug/5u70473e/armeabi-v7a \
clean
from /Users/frank/github/mobile-android-showcase/shared/covert
/bin/sh: /usr/local/Cellar/cmake/3.23.2/bin/cmake: No such file or directory
ninja: error: rebuilding 'build.ninja': subcommand failed
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
Android studio only allows me to install highest cmake version of 3.22.1
my gradle file resembles this
buildscript {
ext {
compose_version = '1.3.0-beta02'
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}
plugins {
id 'com.android.application' version '7.3.0-rc01' apply false
id 'com.android.library' version '7.3.0-rc01' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
id 'com.google.dagger.hilt.android' version '2.43.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
how can i resolve these project clean errors?
the android studio version i am employing is
Android Studio Dolphin | 2021.3.1 RC 1
Build #AI-213.7172.25.2113.8913347, built on August 6, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 12
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
com.android.aas (3.5.1)

Its OK
I found a really simple (if surprising) fix
i searched replaced the entire file system in android studio
replacing 3.23.2 with 3.24.1

Related

Error while building Aseprite : ninja: build stopped: subcommand failed

I have been having this issue repeatedly in the last step where we build it with the command "ninja aseprite".
The error is as follows :
C:\aseprite\third_party\json11\json11.cpp : warning C4710: '__cdecl json11::Statics::~Statics(void) __ptr64': function not inlined
[398/1526] Building C object third_party\cmark\src\CMakeFiles\cmark_static.dir\utf8.c.obj
cl : Command line warning D9025 : overriding '/W3' with '/W4'
ninja: build stopped: subcommand failed.
Any help on the given issue would be much appreciated!
Aseprite and System version :
Aseprite v1.2.34.1
Windows 10 (64bit)
CMake-3.23.1-windows-x86_64
Ninja v1.11.0
Skia-m102
Visual Studio 2022 (SDK and the other requirements already installed)

Build and config Glow (Pytorch)

I tried to build and config Glow-Pytorch from this:
https://github.com/pytorch/glow
on Ubuntu 18.04 with llvm-7.0 and when i write this command:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../glow
and after this I did
ninja all
told me this errors:
[1/387] Generating ../../../libjit/libjit_cpu.bc
FAILED: libjit/libjit_cpu.bc
cd /home/user/glow/lib/Backends/CPU && /usr/lib/llvm-7/bin/llvm-link /home/user/build_Debug/libjit/libjit_cpu_obj/libjit.o /home/user/build_Debug/libjit/libjit_cpu_obj/libjit_conv.o /home/user/build_Debug/libjit/libjit_cpu_obj/libjit_matmul.o /home/user/build_Debug/libjit/libjit_cpu_obj/libjit_cpu.o /home/user/build_Debug/libjit/libjit_cpu_obj/libjit_cpu_conv.o -o /home/user/build_Debug/libjit/libjit_cpu.bc
/usr/lib/llvm-7/bin/llvm-link: /home/user/build_Debug/libjit/libjit_cpu_obj/libjit.o: error: Invalid record
/usr/lib/llvm-7/bin/llvm-link: error: loading file '/home/user/build_Debug/libjit/libjit_cpu_obj/libjit.o'
[3/387] Building CXX object tools/ClassGen/CMakeFiles/InstrGen.dir/InstrGen.cpp.o
ninja: build stopped: subcommand failed.
Does anyone know how it is solve?

ninja compile gives an error in Winodws10 MSVS2017

C:\Users\UAL\Desktop\New folder\New folder\v8>ninja -C out.gn/x64.release
ninja: Entering directory `out.gn/x64.release'
[1/9] LINK cctest.exe cctest.exe.pdb
FAILED: cctest.exe cctest.exe.pdb
ninja -t msvc -e environment.x64 -- ../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /OUT:./cctest.exe /PDB:./cctest.exe.pdb #./cctest.exe.rsp
lld-link: error: <root>: undefined symbol: mainCRTStartup
ninja: build stopped: subcommand failed.
I have also set the environment variables as:
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_MSVS_VERSION =2015
I am just trying to build the hello world application with the steps provided here

arm-none-eabi-g++: command not found in Eclipse

I'm attempting to build firmware from a GitHub project, which uses GCC-ARM, SCons, and OpenOCD (I'm using a Mac btw). If I run "scons" from the command line, the project builds just fine.
However, I want to use Eclipse to build the project. I installed "SConsolidator" and "GNU ARM on Eclipse" plugins, and I imported the project as a Scons project. I also went into project Properties -> C/C++ General -> Paths and Symbols and I added the GNU ARM includes directory for GNU C and GNU C++ under the includes tab.
However, when I try to build the project, I get this:
=== Running SCons at 10/5/16 10:04 PM ====
Command line: /usr/local/bin/scons -u --jobs=8
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build/lpc11c14 build/lpc1549 build
CXX build/BMS/src/ADT7470Fan.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/pins.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/pins.o
sh: arm-none-eabi-g++: command not found
scons: *** [build/BMS/src/ADT7470Fan.o] Error 127
CXX build/Dashboard/src/can_dash.o
scons: *** [build/BMS/src/main.o] Error 127
scons: *** [build/BMS/src/peripherals.o] Error 127
scons: *** [build/BMS/src/pins.o] Error 127
scons: *** [build/Cutoff/src/main.o] Error 127
scons: *** [build/Cutoff/src/peripherals.o] Error 127
scons: *** [build/Cutoff/src/pins.o] Error 127
sh: arm-none-eabi-g++: command not found
scons: *** [build/Dashboard/src/can_dash.o] Error 127
scons: building terminated because of errors.
Duration 9132 ms.
I'm following the instructions on the Github's page, and it works for other people, so I'm not sure what I'm doing wrong. I suspect it has to do with the $PATH not registering for Eclipse, since I added /usr/local/gcc-arm-none-eabi-5_4-2016q3/bin to the $PATH using ~/.bash_profile so "scons" would work in command line.
You may need to enable running 32 bit binaries on your 64 bit userland.
For debian:
dpkg --add-architecture i386
sudo apt-get install libstdc++6:i386

Building c++ project on Windows with CMake, Clang and Ninja

I currently have cmake, clang and ninja installed on windows. I am trying to use CMake to generate a ninja build file to compile a very simple hello world program.
My CMakeLists.txt looks like this:
cmake_minimum_required(VERSION 2.8)
project(test_project)
add_executable(main main.cpp)
main.cpp is a simple hello world program.
On the command line I run this: cmake -G Ninja .. and I get the following errors:
-- The C compiler identification is Clang 3.5.0
clang.exe: error: no such file or directory: '/nologo'
clang.exe: error: no such file or directory: '/showIncludes'
-- The CXX compiler identification is Clang 3.5.0
clang.exe: error: no such file or directory: '/nologo'
clang.exe: error: no such file or directory: '/showIncludes'
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/llvm_build/RelWithDebInfo/bin/clang.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/test_proj/build/CMakeFiles/CMakeTmp
Run Build Command:C:/ninja/ninja.exe cmTryCompileExec375034429
[1/2] Building C object
CMakeFiles\cmTryCompileExec375034429.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTryCompileExec375034429.exe
FAILED: cmd.exe /c cd . &&
C:\llvm_build\RelWithDebInfo\bin\clang.exe
CMakeFiles\cmTryCompileExec375034429.dir\testCCompiler.c.obj -o
cmTryCompileExec375034429.exe && cd .
clang.exe: error: unable to execute command: program not executable
clang.exe: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/test_proj/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_proj/build/CMakeFiles/CMakeError.log".
The CMakeError.log file looks like this:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/llvm_build/RelWithDebInfo/bin/clang.exe
Build flags:
Id flags:
The output was:
1
clang.exe: error: unable to execute command: program not executable
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/llvm_build/RelWithDebInfo/bin/clang++.exe
Build flags:
Id flags:
The output was:
1
clang++.exe: error: unable to execute command: program not executable
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
Determining if the C compiler works failed with the following output:
Change Dir: C:/test_proj/build/CMakeFiles/CMakeTmp
Run Build Command:C:/ninja/ninja.exe cmTryCompileExec2120850158
[1/2] Building C object CMakeFiles\cmTryCompileExec2120850158.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTryCompileExec2120850158.exe
FAILED: cmd.exe /c cd . && C:\llvm_build\RelWithDebInfo\bin\clang.exe CMakeFiles\cmTryCompileExec2120850158.dir\testCCompiler.c.obj -o cmTryCompileExec2120850158.exe && cd .
clang.exe: error: unable to execute command: program not executable
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
It appears that cmake is trying to test clang with windows options /nologo and /showIncludes. I cannot figure out how to tell cmake to pass the proper arguments.
FWIW I'm running 64bit Windows 7
EDIT:
So I looked through the built in cmake files and I found that the CMakeClDeps.cmake file was the culprit for adding the /nologo /showIncludes options. It appears that if I set Clang as the compiler then cmake thinks that visual studio is the compiler (it sets MSVC_C_ARCHITECTURE_ID to x86).
I removed the line in CMakeDetermineCompilerId.cmake that sets MSVC_C_ARCHITECTURE_ID and after trying again I get the following errors:
-- The C compiler identification is Clang 3.5.0
-- The CXX compiler identification is Clang 3.5.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/llvm_build/RelWithDebInfo/bin/clang.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/test_proj/build/CMakeFiles/CMakeTmp
Run Build Command:C:/ninja/ninja.exe cmTryCompileExec2815594422
[1/2] Building C object
CMakeFiles\cmTryCompileExec2815594422.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTryCompileExec2815594422.exe
FAILED: cmd.exe /c cd . &&
C:\llvm_build\RelWithDebInfo\bin\clang.exe
CMakeFiles\cmTryCompileExec2815594422.dir\testCCompiler.c.obj -o
cmTryCompileExec2815594422.exe && cd .
clang.exe: error: unable to execute command: program not executable
clang.exe: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/test_proj/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_proj/build/CMakeFiles/CMakeError.log".
Don't know if it can be helpful but I had the same error. Now I can compile with clang(3.7.1)/ninja(1.6)/cmake(3.4.1) on Windows performing the following actions in a build directory:
load the relevant vcvarsXX.bat file (e.g. "<Your Visual Studio location>\VC\vcvarsall.bat" x86)
set both CC and CXX to clang-cl (instead of clang and clang++)
run cmake -G Ninja <project>
run cmake --build .
Turns out the second set of errors I received were because clang could not find the linker. I had built clang using visual studio but at the time it couldn't find the visual studio linker. All I had to do was run it in the visual studio development console.
CMake still thinks that clang is a visual studio compiler so in the CMakeDetermineCompilerId.cmake file there is a line that looks like this:
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
and I changed it to look like this
if (COMPILER_ID MATCHES "MSVC")
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
endif()
Hopefully this doesn't break any other CMake functionality.