드디어 cmake 파일을 빌드하는데 성공했다

이거땜에 얼마나 많은 시간을 날리고 낭비했는지 ..ㅂㄷㅂㄷ


결론은 파이토치 튜토리얼에 나오것을 그대로 따라하면 안된다


일단 cmake가 버전업되면서 명령어가 바뀌었다

또한, libtorch를 cuda버전이 아닌 cpu버전으로 하니까 성공했다


빌드명령어는 cmake -S '소스코드있는 경로' -DCMAKE_PREFIX_PATH='cpu버전 libtorch폴더의 경로'


이렇게하면 빌드가 되고

이후에 make 명령어를 입력하면 exe파일을 만들어준다


아 그리고 그 사이 우분투로 OS를 바꿔 환경은 16.04, python 3.6, pytorch 1.0, cuda 9.0, libcudnn 7.4.2.24-1 이 되었다

(단 libtorch는 언급한대로 cpu 버전이다)

터미널에 출력 결과는 다음과 같다


***@******:~/example-app/build$ cmake -S ~/example-app -DCMAKE_PREFIX_PATH=~/libtorch-cpu/libtorch

-- The C compiler identification is GNU 5.4.0

-- The CXX compiler identification is GNU 5.4.0

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- 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  

-- Found torch: /home/lab/libtorch-cpu/libtorch/lib/libtorch.so  

-- Configuring done

-- Generating done

-- Build files have been written to: /home/lab/example-app/build

***@******:~/example-app/build$ make

Scanning dependencies of target example-app

[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o

[100%] Linking CXX executable example-app

[100%] Built target example-app



+ Recent posts