ninja compile gives an error in Winodws10 MSVS2017 - visual-studio-2017

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

Related

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

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

"error: unable to find library -latomic" when using clang

I am trying to build a project (PDFium) using clang.
It keeps giving me this error
ld.lld: error: unable to find library -latomic
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I have these installed on my system
libatomic_ops 7.6.14-1
clang 14.0.6-2
lib32-clang 14.0.6-1
libatomic1
And about LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=/usr/lib64:/usr/lib32:/usr/local/lib:/usr/lib
$ sudo ldconfig
I have tried it on Debian, Arch and Ubuntu.

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?

I have error in cmake make make install fmm

I want to install fast map matching fmm on windows (win7)
and cmake has an error: after command "cmake .."
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /cygdrive/c/MinGW/bin/c++.exe
-- Check for working CXX compiler: /cygdrive/c/MinGW/bin/c++.exe - broken
CMake Error at /usr/share/cmake-3.20.0/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/cygdrive/c/MinGW/bin/c++.exe"
It's not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe -f Makefile cmTC_c3891/fast && /usr/bin/make -f CMakeFiles/cmTC_c3891.dir/build.make CMakeFiles/cmTC_c3891.dir/build
make[1]: Entering directory `/cygdrive/e/fmm/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o
/cygdrive/c/MinGW/bin/c++.exe -O3 -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE -o CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o -c /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
c++.exe: error: /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx: No such file or directory
c++.exe: fatal error: no input files
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory `/cygdrive/e/fmm/build/CMakeFiles/CMakeTmp'
make: *** [cmTC_c3891/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
and because cmake not success, make -j8 has error
make -j8
make: *** No targets specified and no makefile found. Stop.
update:cmake has successed,the error is that i don't install enough librarys.
but i have error in make and make install
E:/anaconda/include/pyport.h:726:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
726 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
| ^~~~~
In file included from /usr/include/cpl_progress.h:33,
from /usr/include/ogrsf_frmts.h:34,
from /cygdrive/e/fmm/src/core/geometry.hpp:14,
from /cygdrive/e/fmm/build/python/CMakeFiles/pyfmm.dir/fmmPYTHON_wrap.cxx:3392:
/usr/include/cpl_port.h:156:12: fatal error: direct.h: No such file or directory
156 | # include <direct.h>
i have tried to switch anaconda to the 64 bit ,it has the same error

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.