2016-05-07 17 views
0

私はcmakeで何かをコンパイルしようとしていますが、ソースが必要でないというエラーが出ます。このエラーに関する詳細はどうすればわかりますか? はここでここで出力cmakeのoutofsourceエラーは何ですか

C:\Users\sansari\Downloads\tpm_emulator-0.7.4\tpm_emulator-0.7.4\build>cmake ../ 
CMake Error at CMakeLists.txt:17 (message): 
    TPM_Emulator requires an out of source build. 


-- Configuring incomplete, errors occurred! 
See also "C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/CMakeFiles/CMakeOutput.log". 

であるダンShepler @ CMakeLists.txt

# Software-based Trusted Platform Module (TPM) Emulator 
# Copyright (C) 2004-2010 Mario Strasser <[email protected]> 
# 
# $Id: CMakeLists.txt 475 2011-12-20 18:21:19Z mast $ 

project(TPM_Emulator C) 

cmake_minimum_required(VERSION 2.4) 
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) 
if(COMMAND cmake_policy) 
cmake_policy(SET CMP0003 NEW) 
endif() 

# enforce out of source build 
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" IS_INSOURCE) 
if(IS_INSOURCE) 
    message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build.") 
endif() 

# set project and build version 
set(${PROJECT_NAME}_VERSION_MAJOR 0) 
set(${PROJECT_NAME}_VERSION_MINOR 7) 
string(REGEX REPLACE ".*Revision: ([0-9]+).*" "\\1" ${PROJECT_NAME}_VERSION_BUILD "$Revision: 475 $") 

# create project configuration 
if(WIN32) 
STRING(REGEX REPLACE "\\\\" "/" PROGRAMFILES "$ENV{PROGRAMFILES}/${PROJECT_NAME}") 
set(TPM_LOG_FILE "${PROGRAMFILES}/tpmd.log") 
set(TPM_STORAGE_NAME "${PROGRAMFILES}/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR} 
") 
set(TPM_DEVICE_NAME "//./pipe/tpmd:0") 
elseif(APPLE) 
set(TPM_LOG_FILE "/private/var/log/tpmd.log") 
set(TPM_SOCKET_NAME "/private/var/run/tpm/tpmd_socket:0") 
set(TPM_STORAGE_NAME "/private/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}") 
set(TPM_DEVICE_NAME "/dev/tpm") 
else() 
set(TPM_LOG_FILE "/var/log/tpmd.log") 
set(TPM_SOCKET_NAME "/var/run/tpm/tpmd_socket:0") 
set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}") 
set(TPM_DEVICE_NAME "/dev/tpm") 
endif() 
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 
add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings) 
if("${CMAKE_SYSTEM}" MATCHES "Linux") 
    add_definitions(-Wextra) 
endif() 
if(USE_OPENSSL) 
    add_definitions(-DUSE_OPENSSL) 
endif() 
include_directories("/opt/local/include") 
link_directories("/opt/local/lib") 

# configure CPack 
set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR}) 
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR}) 
set(CPACK_SOURCE_PACKAGE_FILE_NAME "tpm_emulator-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.4") 
set(CPACK_SOURCE_GENERATOR "TGZ") 
set(CPACK_SOURCE_IGNORE_FILES ".svn/" "/build/" "/.project" "/.cproject") 
set(CPACK_GENERATOR "ZIP") 
set(CPACK_SET_DESTDIR ON) 
include(CPack) 

# include root directories 
include_directories(${CMAKE_SOURCE_DIR}) 
include_directories(${CMAKE_BINARY_DIR}) 

# add internal libraries 
add_subdirectory(tpm) 
add_subdirectory(mtm) 
add_subdirectory(crypto) 

# add TDDL 
add_subdirectory(tddl) 

# add kernel modules 
add_subdirectory(tpmd_dev) 

# add executables 
add_subdirectory(tpmd) 

の内容である - 感謝。私はソースを削除し、再度解凍しました。次のように今、私は別のメッセージが表示されます。

$ cmake ../ 
-- The C compiler identification is unknown 
CMake Error at CMakeLists.txt:6 (project): 
    The CMAKE_C_COMPILER: 

    cl 

    is not a full path and was not found in the PATH. 

    To use the NMake generator with Visual C++, cmake must be run from a shell 
    that can use the compiler cl from the command line. This environment is 
    unable to invoke the cl compiler. To fix this problem, run cmake from the 
    Visual Studio Command Prompt (vcvarsall.bat). 

    Tell CMake where to find the compiler by setting either the environment 
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to 
    the compiler, or to the compiler name if it is in the PATH. 


-- Configuring incomplete, errors occurred! 
See also "C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build/CMakeFiles/CMakeError.log". 
Given that I have installed MinGw. I believe I have to set my compiler as gcc. And I believe this would be my path 

C:\MinGW\bin 

は、私はちょうど私が知っているコンパイラのパスに環境変数を設定するには、これらの2つのコマンドをやったが、私はまだエラーを取得します。私はgcc.exeをC:\ MinGw \ binに見ました。 gcc.exeの名前を環境変数のパスに追加しようとしています。

set CC=C:\MinGW\bin 



set CMAKE_C_COMPILER=C:\MinGW\bin 

私はビルドディレクトリに変更する必要がある変数を発見し、それを変更しました。今では私が実際にユーザーのパスを追加する必要がありましたthisリンクを発見したし、Windows 10上で私のパス変数を確認

$ cmake ../ 
-- The C compiler identification is GNU 4.9.3 
-- Check for working C compiler: C:/MinGW/bin/gcc.exe 
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_5e307\fast" 
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken 
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message): 
    The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test 
    program. 

    It fails with the following output: 

    Change Dir: C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build/CMakeFiles/CMakeTmp 



    Run Build Command:"nmake" "/NOLOGO" "cmTC_5e307\fast" 



    Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" 
    "cmTC_5e307\fast" 





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


-- Configuring incomplete, errors occurred! 
See also "C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build/CMakeFiles/CMakeError.log". 

言います。私はちょうどシステムパスを持っていた。私はMInGw \ bin、msys \ bin、msys \ local \ bin、そしてcmakeを自分のパスに入れます。

今回はうまくいったと思います。私はMinGwシェルではなくAdminモードでcmdを実行しました。ここで出力...

C:\Users\sansari\Downloads\tpm_emulator-0.7.4\tpm_emulator-0.7.4\build>cmake ../ 
-- The C compiler identification is GNU 4.9.3 
-- Check for working C compiler: C:/MinGW/bin/gcc.exe 
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Detecting C compile features 
-- Detecting C compile features - done 
-- Configuring done 
-- Generating done 
-- Build files have been written to: C:/Users/sansari/Downloads/tpm_emulator-0.7.4/tpm_emulator-0.7.4/build 

答えて

0

メッセージがこのラインで明示的に出力されている:

message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build.") 

通常は、私が期待していない状態では、あなたが与えたcmakeコマンドに基づいてトリガされる場合。私は最初に、CMakeアーティファクトがソースディレクトリC:\Users\sansari\Downloads\tpm_emulator-0.7.4\tpm_emulator-0.7.4に残っているかどうかを確認してから、CMakeがビルドディレクトリの使用を拒否する可能性があります。その場合は、CMakeCache.txt、CMakeFiles /などをソースディレクトリから削除します(またはソースディレクトリ全体を削除して、再度展開します)。そうでなければ、何が起こっているかをデバッグするために、私はちょうどif(IS_INSOURCE)文の上に一時的にこのような何かを挿入します:

message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") 
message(STATUS "CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}") 
message(STATUS "IS_INSOURCE = ${IS_INSOURCE}") 
関連する問題