Software Test/자동화

[GoogleTest] linux에 googletest를 동적라이브러리로 설치

킁스 2017. 12. 27. 17:27
반응형

linux 환경에서 google test를 위한 설치 진행

cmake시 옵션을 사용하여 동적 라이브러리로 생성

 

1. google test download

실행 : wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz

--2017-12-26 15:15:00--  https://github.com/google/googletest/archive/release-1.7.0.tar.gz
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/google/googletest/tar.gz/release-1.7.0 [following]
--2017-12-26 15:15:01--  https://codeload.github.com/google/googletest/tar.gz/release-1.7.0
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121, 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 468653 (458K) [application/x-gzip]
Saving to: ‘release-1.7.0.tar.gz’


100%[=========================== ... =======================>] 468,653      171KB/s   in 2.7s   


2017-12-26 15:15:05 (171 KB/s) - ‘release-1.7.0.tar.gz’ saved [468653/468653]

 

2. 압축 해제

실행 : zcat release-1.7.0.tar.gz | tar xvf -

 

3. install (SHARED_LIB)

실행 : cd googletest-release-1.7.0/

실행 : cmake -DBUILD_SHARED_LIBS=ON .

-- The CXX compiler identification is GNU 4.8.5
-- The C compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /bin/python (found version "2.7.5") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/test4/googletest-release-1.7.0

 

실행 : make

Scanning dependencies of target gtest
[ 25%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 50%] Linking CXX shared library libgtest.so
[ 50%] Built target gtest
Scanning dependencies of target gtest_main
[ 75%] Building CXX object CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX shared library libgtest_main.so
[100%] Built target gtest_main

 

4. 환경변수 설정

실행 : export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/googletest-release-1.7.0

 

참고

INCLUDE path : $HOME/googletest-release-1.7.0/include

ldd : ldd libgtest_main.so

        linux-vdso.so.1 =>  (0x00007ffcb19d4000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbbf5ef9000)
        libgtest.so => /home/test4/googletest-release-1.7.0/libgtest.so (0x00007fbbf5c69000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fbbf5961000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fbbf565f000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fbbf5448000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fbbf5086000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fbbf6331000) 

 

 

 

 

 

 

반응형