2014-11-25 4 views
1

내가이 간단한 CMake 명령을 실행하기 위해 노력하고있어 실패 오류는 다음과 같다 :CMake는 (2.8.12.2) 우분투 14.04에 컴파일러 체크

gcc: error: unrecognized command line option ‘-rpath’

CMake는 다음 명령을 사용하여 연결을 시도하기 때문에 :

/usr/bin/gcc -rpath /usr/local/openblas/lib CMakeFiles/cmTryCompileExec1190183239.dir/testCCompiler.c.o -o cmTryCompileExec1190183239 -rdynamic

내 지식에는 gcc의 독립 실행 형 '-rpath'옵션이 없습니다. 왜 CMake가이 작업을 시도하는지 잘 모르겠습니다.

다른 사람이이 문제를 발견 했습니까? 솔루션?

감사합니다. 내가 CMake를 사용하는 방법을 배우려고 노력하고있어 그래서 디렉토리 구조가 매우 간단합니다 :

PS : 어쩌면 유용한 몇 가지 추가 정보를

-cmake_test/
    -bin/
    -src/
            -executable.cpp
            -CMakeLists.txt
    -CMakeLists.txt

편집 :

전체 출력 내가 모든 사람에게 사과

$ cmake ./src/ 
-- The C compiler identification is GNU 4.8.2 
-- The CXX compiler identification is GNU 4.8.2 
-- Check for working C compiler: /usr/bin/cc 
-- Check for working C compiler: /usr/bin/cc -- broken 
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): 
    The C compiler "/usr/bin/cc" is not able to compile a simple test program. 

    It fails with the following output: 

    Change Dir: /home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp 



    Run Build Command:/usr/bin/make "cmTryCompileExec961681416/fast" 

    /usr/bin/make -f CMakeFiles/cmTryCompileExec961681416.dir/build.make 
    CMakeFiles/cmTryCompileExec961681416.dir/build 

    make[1]: Entering directory 
    `/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp' 

    /usr/bin/cmake -E cmake_progress_report 
    /home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp/CMakeFiles 
    1 

    Building C object 
    CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o 

    /usr/bin/cc -o CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o 
    -c 
    /home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp/testCCompiler.c 


    Linking C executable cmTryCompileExec961681416 

    /usr/bin/cmake -E cmake_link_script 
    CMakeFiles/cmTryCompileExec961681416.dir/link.txt --verbose=1 

    /usr/bin/cc -rpath /usr/local/openblas/lib 
    CMakeFiles/cmTryCompileExec961681416.dir/testCCompiler.c.o -o 
    cmTryCompileExec961681416 -rdynamic 

    cc: error: unrecognized command line option ‘-rpath’ 

    make[1]: *** [cmTryCompileExec961681416] Error 1 

    make[1]: Leaving directory 
    `/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeTmp' 

    make: *** [cmTryCompileExec961681416/fast] Error 2 





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



-- Configuring incomplete, errors occurred! 
See also "/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeOutput.log". 
See also "/home/gyorgy/Workspace/CPP_Tests/src/cmake_test/CMakeFiles/CMakeError.log". 
+0

* $ cmake ./src/*와 같은 간단한 명령을 입력하면 오류가 발생합니까? 완전한 출력물을 쓸 수 있습니까? – fenix688

+0

답변 해 주셔서 감사합니다. 같은 오류가 발생합니다. $ cmake ./src/ – George

+0

에 대한 전체 출력으로 원본 게시물을 업데이트했습니다. 컴파일러 구성을 제거한 후에도 동일한 오류가 발생하는 것이 정상입니다. CMake는 캐시 시스템과 함께 작동하여 이전 구성의 정보를 저장합니다. CMakeCache.txt 파일을 삭제하고'cmake./src'를 다시 실행하십시오. – Antwane

답변

2

은 ... 오류의 결과 나 한참 전에 실수 했어.

짧은 대답은 내의 .bashrc 파일에 다음과 같은 잘못된 라인을 가지고 있다는 것입니다 :

export LDFLAGS="-rpath /usr/local/openblas/lib "$LDFLAGS

및 CMake는 CMakeCommonLanguageInclude.cmake 모듈에 다음 줄이 있습니다

set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"

명백히 CMAKE_EXE_LINKER_FLAGS를 -rpath /usr/local/openblas/lib 및 으로 설정 한 결과 오류가 발생했습니다. 에의 .bashrc 파일을 변경 한 후 :

export LDFLAGS="-Wl,-rpath=/usr/local/openblas/lib "$LDFLAGS

문제가 해결되었습니다.

나는 :-)

나는 아마 OSX 포럼 또는 무언가를 읽어의 .bashrc 파일을 엉망하지만이 GUI 버전을 마련하지 않은 이유를 모르겠어요.

어쨌든 답변 주셔서 감사합니다!

관련 문제