Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows上的CMake、Android NDK工具链_Android_C++_Android Ndk_Cmake - Fatal编程技术网

Windows上的CMake、Android NDK工具链

Windows上的CMake、Android NDK工具链,android,c++,android-ndk,cmake,Android,C++,Android Ndk,Cmake,我知道安卓cmake,但首先我开始简单地理解所有东西是如何组合在一起的 我确保\prebuild\windows-x86\u 64\bin在我的路径中这是make的所在地,我确保\toolschains\x86-4.9\prebuild\windows-x86\u 64\bin在我的路径中这是g++的所在地。然后我设置CC=i686linux-android-gcc和CXX=i686-linux-android-g++。到目前为止,一切似乎都很好;cmake可以识别make和编译器,但是当它检查

我知道安卓cmake,但首先我开始简单地理解所有东西是如何组合在一起的

我确保\prebuild\windows-x86\u 64\bin在我的路径中这是make的所在地,我确保\toolschains\x86-4.9\prebuild\windows-x86\u 64\bin在我的路径中这是g++的所在地。然后我设置CC=i686linux-android-gcc和CXX=i686-linux-android-g++。到目前为止,一切似乎都很好;cmake可以识别make和编译器,但是当它检查C编译器是否正常工作时,它会失败,我无法理解错误消息以了解出了什么问题

以下是cmake输出:

C:\test_project\build>cmake -G "Unix Makefiles" ..

-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp



  Run Build
  Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe"
  "cmTryCompileExec924087958/fast"


  C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe
  -f CMakeFiles/cmTryCompileExec924087958.dir/build.make
  CMakeFiles/cmTryCompileExec924087958.dir/build

  make.exe[1]: Entering directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
  C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  "Building C object
  CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj"


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe
  -o CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj -c
  C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c


  "Linking C executable cmTryCompileExec924087958.exe"

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f
  CMakeFiles/cmTryCompileExec924087958.dir/objects.a

  CMAKE_AR-NOTFOUND cr CMakeFiles/cmTryCompileExec924087958.dir/objects.a
  @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp

  process_begin: CreateProcess(NULL, CMAKE_AR-NOTFOUND cr
  CMakeFiles/cmTryCompileExec924087958.dir/objects.a
  @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp, ...) failed.

  make (e=2): The system cannot find the file specified.

  make.exe[1]: *** [cmTryCompileExec924087958.exe] Error 2

  make.exe[1]: Leaving directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  make.exe: *** [cmTryCompileExec924087958/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/test_project/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_project/build/CMakeFiles/CMakeError.log".

C:\test_project\build>
C:\test_project\build>cmake -G "Unix Makefiles" ..

-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp



  Run Build
  Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe"
  "cmTryCompileExec2113787949/fast"


  C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe
  -f CMakeFiles/cmTryCompileExec2113787949.dir/build.make
  CMakeFiles/cmTryCompileExec2113787949.dir/build

  make.exe[1]: Entering directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
  C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  "Building C object
  CMakeFiles/cmTryCompileExec2113787949.dir/testCCompiler.c.obj"


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
  -o CMakeFiles/cmTryCompileExec2113787949.dir/testCCompiler.c.obj -c
  C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c


  "Linking C executable cmTryCompileExec2113787949.exe"

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f
  CMakeFiles/cmTryCompileExec2113787949.dir/objects.a


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/ar.exe
  cr CMakeFiles/cmTryCompileExec2113787949.dir/objects.a
  @CMakeFiles/cmTryCompileExec2113787949.dir/objects1.rsp


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
  -Wl,--whole-archive CMakeFiles/cmTryCompileExec2113787949.dir/objects.a
  -Wl,--no-whole-archive -o cmTryCompileExec2113787949.exe
  -Wl,--out-implib,libcmTryCompileExec2113787949.dll.a
  -Wl,--major-image-version,0,--minor-image-version,0


  c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe:
  --out-implib: unknown option


  c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe:
  use the --help option for usage information

  collect2.exe: error: ld returned 1 exit status

  make.exe[1]: *** [cmTryCompileExec2113787949.exe] Error 1

  make.exe[1]: Leaving directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  make.exe: *** [cmTryCompileExec2113787949/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/test_project/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_project/build/CMakeFiles/CMakeError.log".
下面是错误日志:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe 
Build flags: 
Id flags: 

The output was:
1
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtbegin_dynamic.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtend_android.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-g++.exe 
Build flags: 
Id flags: 

The output was:
1
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtbegin_dynamic.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtend_android.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lstdc++
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lm
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl
collect2.exe: error: ld returned 1 exit status


Determining if the C compiler works failed with the following output:
Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe" "cmTryCompileExec924087958/fast"
C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe -f CMakeFiles/cmTryCompileExec924087958.dir/build.make CMakeFiles/cmTryCompileExec924087958.dir/build

make.exe[1]: Entering directory `C:/test_project/build/CMakeFiles/CMakeTmp'

"C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles 1

"Building C object CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj"

C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe    -o CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj   -c C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c

"Linking C executable cmTryCompileExec924087958.exe"

"C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f CMakeFiles/cmTryCompileExec924087958.dir/objects.a

CMAKE_AR-NOTFOUND cr CMakeFiles/cmTryCompileExec924087958.dir/objects.a @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp

process_begin: CreateProcess(NULL, CMAKE_AR-NOTFOUND cr CMakeFiles/cmTryCompileExec924087958.dir/objects.a @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp, ...) failed.

make (e=2): The system cannot find the file specified.


make.exe[1]: *** [cmTryCompileExec924087958.exe] Error 2

make.exe[1]: Leaving directory `C:/test_project/build/CMakeFiles/CMakeTmp'

make.exe: *** [cmTryCompileExec924087958/fast] Error 2
想法

编辑:Tsyvarev的评论修复了这个问题,cmake现在可以找到ar了。但不幸的是,这只揭示了下一个错误,这似乎是一个坏的选择链接器?我不知道为什么会这样,也不知道最好的解决方法

Cmake输出:

C:\test_project\build>cmake -G "Unix Makefiles" ..

-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp



  Run Build
  Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe"
  "cmTryCompileExec924087958/fast"


  C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe
  -f CMakeFiles/cmTryCompileExec924087958.dir/build.make
  CMakeFiles/cmTryCompileExec924087958.dir/build

  make.exe[1]: Entering directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
  C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  "Building C object
  CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj"


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc.exe
  -o CMakeFiles/cmTryCompileExec924087958.dir/testCCompiler.c.obj -c
  C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c


  "Linking C executable cmTryCompileExec924087958.exe"

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f
  CMakeFiles/cmTryCompileExec924087958.dir/objects.a

  CMAKE_AR-NOTFOUND cr CMakeFiles/cmTryCompileExec924087958.dir/objects.a
  @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp

  process_begin: CreateProcess(NULL, CMAKE_AR-NOTFOUND cr
  CMakeFiles/cmTryCompileExec924087958.dir/objects.a
  @CMakeFiles/cmTryCompileExec924087958.dir/objects1.rsp, ...) failed.

  make (e=2): The system cannot find the file specified.

  make.exe[1]: *** [cmTryCompileExec924087958.exe] Error 2

  make.exe[1]: Leaving directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  make.exe: *** [cmTryCompileExec924087958/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/test_project/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_project/build/CMakeFiles/CMakeError.log".

C:\test_project\build>
C:\test_project\build>cmake -G "Unix Makefiles" ..

-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
-- Check for working C compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp



  Run Build
  Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe"
  "cmTryCompileExec2113787949/fast"


  C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe
  -f CMakeFiles/cmTryCompileExec2113787949.dir/build.make
  CMakeFiles/cmTryCompileExec2113787949.dir/build

  make.exe[1]: Entering directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
  C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  "Building C object
  CMakeFiles/cmTryCompileExec2113787949.dir/testCCompiler.c.obj"


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
  -o CMakeFiles/cmTryCompileExec2113787949.dir/testCCompiler.c.obj -c
  C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c


  "Linking C executable cmTryCompileExec2113787949.exe"

  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f
  CMakeFiles/cmTryCompileExec2113787949.dir/objects.a


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/ar.exe
  cr CMakeFiles/cmTryCompileExec2113787949.dir/objects.a
  @CMakeFiles/cmTryCompileExec2113787949.dir/objects1.rsp


  C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe
  -Wl,--whole-archive CMakeFiles/cmTryCompileExec2113787949.dir/objects.a
  -Wl,--no-whole-archive -o cmTryCompileExec2113787949.exe
  -Wl,--out-implib,libcmTryCompileExec2113787949.dll.a
  -Wl,--major-image-version,0,--minor-image-version,0


  c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe:
  --out-implib: unknown option


  c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe:
  use the --help option for usage information

  collect2.exe: error: ld returned 1 exit status

  make.exe[1]: *** [cmTryCompileExec2113787949.exe] Error 1

  make.exe[1]: Leaving directory
  `C:/test_project/build/CMakeFiles/CMakeTmp'

  make.exe: *** [cmTryCompileExec2113787949/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/test_project/build/CMakeFiles/CMakeOutput.log".
See also "C:/test_project/build/CMakeFiles/CMakeError.log".
错误日志:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe 
Build flags: 
Id flags: 

The output was:
1
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtbegin_dynamic.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtend_android.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/c++.exe 
Build flags: 
Id flags: 

The output was:
1
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtbegin_dynamic.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot open crtend_android.o: No such file or directory
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lstdc++
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lm
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl
collect2.exe: error: ld returned 1 exit status


Determining if the C compiler works failed with the following output:
Change Dir: C:/test_project/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe" "cmTryCompileExec3892407508/fast"
C:/android-ndk-r10d-windows-x86_64/prebuilt/windows-x86_64/bin/make.exe -f CMakeFiles/cmTryCompileExec3892407508.dir/build.make CMakeFiles/cmTryCompileExec3892407508.dir/build

make.exe[1]: Entering directory `C:/test_project/build/CMakeFiles/CMakeTmp'

"C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report C:/test_project/build/CMakeFiles/CMakeTmp/CMakeFiles 1

"Building C object CMakeFiles/cmTryCompileExec3892407508.dir/testCCompiler.c.obj"

C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe    -o CMakeFiles/cmTryCompileExec3892407508.dir/testCCompiler.c.obj   -c C:/test_project/build/CMakeFiles/CMakeTmp/testCCompiler.c

"Linking C executable cmTryCompileExec3892407508.exe"

"C:/Program Files (x86)/CMake/bin/cmake.exe" -E remove -f CMakeFiles/cmTryCompileExec3892407508.dir/objects.a

C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/ar.exe cr CMakeFiles/cmTryCompileExec3892407508.dir/objects.a @CMakeFiles/cmTryCompileExec3892407508.dir/objects1.rsp

C:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/gcc.exe      -Wl,--whole-archive CMakeFiles/cmTryCompileExec3892407508.dir/objects.a -Wl,--no-whole-archive  -o cmTryCompileExec3892407508.exe -Wl,--out-implib,libcmTryCompileExec3892407508.dll.a -Wl,--major-image-version,0,--minor-image-version,0  

c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: --out-implib: unknown option

c:/android-ndk-r10d-windows-x86_64/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld.exe: use the --help option for usage information

collect2.exe: error: ld returned 1 exit status

make.exe[1]: *** [cmTryCompileExec3892407508.exe] Error 1

make.exe[1]: Leaving directory `C:/test_project/build/CMakeFiles/CMakeTmp'

make.exe: *** [cmTryCompileExec3892407508/fast] Error 2

CMAKE_AR-NOTFOUND表示未找到用于链接静态库的归档工具。您需要在CMake工具链文件中设置此工具的路径:setCMAKE_AR i686 linux android AR缓存文件路径Archiver。@Tsyvarev谢谢。这解决了这个问题,cmake现在可以找到ar了。但不幸的是,这只揭示了下一个错误,这似乎是一个坏的选择链接器?我不知道为什么会这样,也不知道最好的解决方法。我用新的错误编辑了我的原始问题并记录下来。Linker的选项-out implib对应于dll库,当然,这对android没有任何意义。您需要工具链文件,它不仅设置编译器,还设置CMAKE_系统_名称。例如,请参见以下答案:。