Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

킹드래곤 짹짹 개발노트

cppcheck 설치, 빌드 본문

C++

cppcheck 설치, 빌드

킹드래곤 2018. 12. 5. 18:33

cppcheck 설치

설치 환경 : Ubuntu 16.04 amd64

$ sudo apt-get install cppcheck

현재 cppcheck 1.72 버전이 설치됩니다.

cppcheck 빌드

Github : https://github.com/danmar/cppcheck

2018-10-15 에 최신 버전인 1.85 가 release 되었습니다.

최신 버전을 사용하기 위해서는 cppcheck를 직접 빌드하여 사용해야 합니다.


빌드 환경 : Ubuntu 16.04 amd64

1. release 버전의 소스를 다운로드 한다.

https://github.com/danmar/cppcheck/releases

소스를 빌드할 것이기 때문에 source code (tar.gz) 을 다운로드 합니다.


2. 다운로드 받은 위치로 이동한다.


3. 압축을 해제한다.

$ cd ~

$ tar -xvf cppcheck-1.85.tar.gz

저는 /home/xxx/cppcheck-1.85 위치에 압축해제 하였습니다.


4. 소스를 빌드한다.

아래 링크를 참고하여 빌드한다.

https://github.com/danmar/cppcheck/tree/1.85#gnu-make

$ cd cppcheck-1.85

$ sudo make SRCDIR=build CFGDIR=/home/xxx/cppcheck-1.85/cfg HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"


5. 빌드된 결과물을 설치한다.

$sudo make install CFGDIR=/home/xxx/cppcheck-1.85/cfg

중요 : make install 시에 CFGDIR 값을 입력하지 않으면 cppcheck 실행 시에 아래의 에러가 발생한다.

Failed to load std.cfg. Your Cppcheck installation is broken, please re-install. The Cppcheck binary was compiled without CFGDIR set. Either the std.cfg should be available in cfg or the CFGDIR should be configured.

아래 링크도 참고하세요.

https://sourceforge.net/p/cppcheck/discussion/general/thread/d2026b1a/

https://stackoverflow.com/questions/22486573/cppcheck-std-cfg-not-found-error-when-std-cfg-file-is-available/26650139


6. 설치를 확인한다.

$ which cppcheck

/usr/bin/cppcheck


참고

소스를 빌드하여 설치하는 방법이 다소 어렵다면 아래 링크에서 deb 파일을 다운로드하여 설치한다.

https://launchpad.net/ubuntu/+source/cppcheck


'C++' 카테고리의 다른 글

cppcheck html report 사용법  (0) 2018.12.05