본문 바로가기
연구관련/연구생활

autodock vina를 직접 compile 해서 사용하기

by adnoctum 2014. 11. 25.

 

 

 

   protein-chemical binding affinity 를 계산하는 프로그램인 autodock vina 를 컴파일 해보자. 컴파일을 하는 이유는 실제로 이 프로그램을 실행시킬 컴퓨터에서 컴파일을 해서 사용하면 제공되는 실행 파일을 이용하는 것보다 속도가 좀 더 빠르기 때문이다. 정확한 test 는 아니지만 linux > windows 8 > windows 7 순서로 속도가 빠른 것을 확인할 수 있었고, 각 경우 언제나 직접 컴파일 한 실행 파일이 속도가 더 빠르게 나왔다. 위 결과는 컴퓨터가 아주 안좋은 경우부터 아주 좋은 경우까지 모두 해당된다. 

 

리눅스에서의 컴파일

윈도우즈에서의 컴파일

 

 


 

 

 

 

리눅스에서의 컴파일

우선 결론적으로 정리된 절차는 다음과 같다. 32bit 운영체제(OS)에서 한 것이기 때문에 아래 .i686 이 붙는데, 64bit 이면 보통 i686 대신 x86_64 을 사용하면 된다. 

 

yum install gcc

yum install gcc-c++ libstdc++-static

yum install python-devel

yum install bzip2-devel bzip2-libs bzip2

yum install glibc-static

 

그 후 boost 를 설치함. boost 를 download 하여 압축을 풀고, 그 곳으로 가서

 

./bootstrap.sh

 

./b2

 

그 후 ~/.bash_profile 에 다음과 같은 부분을 추가하고,

 

CPLUS_INCLUDE_PATH=/home/adnoctum/boost_1_57_0
export CPLUS_INCLUDE_PATH

LIBRARY_PATH=/home/adnoctum/boost_1_57_0/stage/lib
export LIBRARY_PATH

BOOST_INCLUDE=/home/adnoctum/boost_1_57_0
export BOOST_INCLUDE

그 후,

source ~/.bash_profile


를 해서 설정 파일을 적용함. 그 후 vina source directory (아마도 autodock_vina_1_1_2/build/linux/release) 에 가서

 

make depend

make

하면 끝. 이 때 사용하는 makefile_common 은 다음과 같다.

 

 

더보기

 

LIBOBJ = cache.o coords.o current_weights.o everything.o grid.o szv_grid.o manifold.o model.o monte_carlo.o mutate.o my_pid.o naive_non_cache.o non_cache.o parallel_mc.o parse_pdbqt.o pdb.o quasi_newton.o quaternion.o random.o ssd.o terms.o weighted_terms.o
MAINOBJ = main.o
SPLITOBJ = split.o

INCFLAGS = -I $(BOOST_INCLUDE)

CC = ${GPP} ${C_PLATFORM} -ansi -Wno-long-long ${C_OPTIONS} $(INCFLAGS)

LDFLAGS = -L$(BASE)/lib
LIB_PATH=/home/adnoctum/boost_1_57_0/stage/lib
LIBS = $(LIB_PATH)/libboost_system.a $(LIB_PATH)/libboost_thread.a $(LIB_PATH)/libboost_serialization.a $(LIB_PATH)/libboost_filesystem.a $(LIB_PATH)/libboost_program_options.a -lrt

.SUFFIXES: .cpp .o

%.o : ../../../src/lib/%.cpp
    $(CC) $(CFLAGS) -o $@ -c $<

%.o : ../../../src/design/%.cpp
    $(CC) $(CFLAGS) -I ../../../src/lib -o $@ -c $<
   
%.o : ../../../src/main/%.cpp
    $(CC) $(CFLAGS) -I ../../../src/lib -o $@ -c $<

%.o : ../../../src/split/%.cpp
    $(CC) $(CFLAGS) -I ../../../src/lib -o $@ -c $<

all: vina


vina: $(MAINOBJ) $(LIBOBJ)
    $(CC) -o $@ $^ $(LIBS)

vina_split: $(SPLITOBJ)
    $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

clean:
    rm -f *.o

depend:
    ln -sf `${GPP} -print-file-name=libstdc++.a`
    rm -f dependencies_tmp dependencies_tmp.bak
    touch dependencies_tmp
    g++ -MM ../../../src/lib/*.cpp > dependencies_tmp
    g++ -I ../../../src/lib -MM ../../../src/main/*.cpp >> dependencies_tmp
    g++ -I ../../../src/lib -MM ../../../src/split/*.cpp  >> dependencies_tmp
    sed -e "s/^\.\.\/\.\.\/\.\.\/src\/[a-z]*\//.\//" dependencies_tmp > dependencies
    rm -f dependencies_tmp dependencies_tmp.bak

 

이 때, 위에서 붉은색으로 표시한 부분은 각자 상황에 맞는 경로로 수정하여 사용한다. 원래 제공되던 makefile_common 을 많이 수정하였다.

 


 

   아래는 내가 위와 같은 정리된 절차로 하기 전까지 경험했던 과정이다. 보통 아래와 같은 과정이 source compile 을 할 때 겪는, 일반적인 ㅜ.ㅜ 과정이지... >.<""

 

우선 운영체제 - CentOS 6.6 - 만 설치한 컴퓨터였기 때문에 gcc 를 설치.

yum install gcc

 

그 후 vina 설치 경로(~~linux/release) 에서 make 를 하면 여전히

 

make: /usr/local/bin/g++: 명령을 찾지 못했음

make: *** [main.o] 오류 127


위와 같은 에러 발생. 그러나 실제로 g++ 은 설치가 되어 있는 상태.

[adnoctum@csbi release]$ g++
g++: no input files
[adnoctum@csbi release]$
 
즉, 환경 변수에 아직 반영이 안 된 듯. g++ 을 찾아서,

locate g++
/usr/bin/g++
/usr/bin/x86_64-redhat-linux-g++
/usr/share/man/man1/g++.1.gz
 
환경 변수에 반영

[adnoctum@csbi release]$ vi ~/.bash_profile
[adnoctum@csbi release]$ source ~/.bash_profile
[adnoctum@csbi release]$

 

아, 실수. 

 

make: /usr/local/bin/g++: 명령을 찾지 못했음
make: *** [main.o] 오류 127
[adnoctum@csbi release]$ vi Makefile

 
즉, Makefile 에 문제가 있음.

BASE=/usr/local
BOOST_VERSION=1_41
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-static -pthread
GPP=/usr/local/bin/g++
C_OPTIONS= -O3 -DNDEBUG
BOOST_LIB_VERSION=
 
include ../../makefile_common
 
위에서 GPP 의 위치를 /usr/bin/g++ 로 바꿔 줌. 그 후 다시 make 실행. 겁나게 많은 에러.

[adnoctum@csbi release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include  -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
../../../src/main/main.cpp:28:37: error: boost/program_options.hpp: 그런 파일이나 디렉토리가 없음
더보기
../../../src/main/main.cpp:29:40: error: boost/filesystem/fstream.hpp: 그런 파일이나 디렉토리가 없음
../../../src/main/main.cpp:30:42: error: boost/filesystem/exception.hpp: 그런 파일이나 디렉토리가 없음
../../../src/main/main.cpp:31:68: error: boost/filesystem/convenience.hpp: 그런 파일이나 디렉토리가 없음
../../../src/main/main.cpp:32:73: error: boost/thread/thread.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/model.h:26:45: error: boost/optional.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/file.h:27,
                 from ../../../src/lib/model.h:28,
                 from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/common.h:39:117: error: boost/serialization/vector.hpp: 그런 파일이나 디렉토리가 없음
../../../src/lib/common.h:40:94: error: boost/serialization/base_object.hpp: 그런 파일이나 디렉토리가 없음
../../../src/lib/common.h:41:51: error: boost/filesystem/path.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/tree.h:26,
                 from ../../../src/lib/model.h:29,
                 from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/conf.h:26:74: error: boost/ptr_container/ptr_vector.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/conf.h:28,
                 from ../../../src/lib/tree.h:26,
                 from ../../../src/lib/model.h:29,
                 from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/quaternion.h:26:37: error: boost/math/quaternion.hpp: 그런 파일이나 디렉토리가 없음
../../../src/lib/quaternion.h:27:46: error: boost/serialization/split_free.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/quaternion.h:30,
                 from ../../../src/lib/conf.h:28,
                 from ../../../src/lib/tree.h:26,
                 from ../../../src/lib/model.h:29,
                 from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/random.h:26:28: error: boost/random.hpp: 그런 파일이나 디렉토리가 없음
In file included from ../../../src/lib/model.h:33,
                 from ../../../src/lib/parse_pdbqt.h:26,
                 from ../../../src/main/main.cpp:33:
../../../src/lib/grid_dim.h:26:27: error: boost/array.hpp: 그런 파일이나 디렉토리가 없음
../../../src/lib/common.h:125: error: ‘boost’ has not been declared
../../../src/lib/common.h:125: error: friend declaration does not name a class or function
../../../src/lib/common.h:187: error: ‘boost’ has not been declared
../../../src/lib/common.h:187: error: expected initializer before ‘path’
../../../src/lib/file.h:30: error: ‘path’ does not name a type
../../../src/lib/file.h:32: error: expected ‘,’ or ‘...’ before ‘&’ token
../../../src/lib/file.h:32: error: ISO C++ forbids declaration of ‘path’ with no type
../../../src/lib/file.h: In constructor ‘file_error::file_error(int)’:
../../../src/lib/file.h:32: error: class ‘file_error’ does not have any field named ‘name’
../../../src/lib/file.h:32: error: ‘name_’ was not declared in this scope
../../../src/lib/file.h:32: error: ‘in_’ was not declared in this scope
../../../src/lib/file.h: At global scope:
../../../src/lib/file.h:35: error: ‘boost’ has not been declared
../../../src/lib/file.h:35: error: expected `{' before ‘ifstream’
../../../src/lib/file.h:35: error: invalid function declaration
../../../src/lib/file.h:46: error: ‘boost’ has not been declared
../../../src/lib/file.h:46: error: expected `{' before ‘ofstream’
../../../src/lib/file.h:46: error: invalid function declaration
../../../src/lib/random.h:29: error: ‘boost’ has not been declared
../../../src/lib/random.h:29: error: expected initializer before ‘rng’
../../../src/lib/random.h:31: error: ‘rng’ has not been declared
../../../src/lib/random.h:32: error: ‘rng’ has not been declared
../../../src/lib/random.h:33: error: ‘rng’ has not been declared
../../../src/lib/random.h:34: error: ‘rng’ has not been declared
../../../src/lib/random.h:35: error: ‘rng’ was not declared in this scope
../../../src/lib/random.h:35: error: ‘generator’ was not declared in this scope
../../../src/lib/random.h:36: error: ‘rng’ has not been declared
../../../src/lib/quaternion.h:32: error: ‘boost’ has not been declared
../../../src/lib/quaternion.h:32: error: expected initializer before ‘<’ token
../../../src/lib/quaternion.h:38: error: expected ‘,’ or ‘...’ before ‘&’ token
../../../src/lib/quaternion.h:38: error: ISO C++ forbids declaration of ‘qt’ with no type
../../../src/lib/quaternion.h: In function ‘void boost::serialization::save(Archive&, int)’:
../../../src/lib/quaternion.h:39: error: ‘q’ was not declared in this scope
../../../src/lib/quaternion.h: At global scope:
../../../src/lib/quaternion.h:50: error: ‘qt’ has not been declared
../../../src/lib/quaternion.h: In function ‘void boost::serialization::load(Archive&, int&, unsigned int)’:
../../../src/lib/quaternion.h:56: error: there are no arguments to ‘qt’ that depend on a template parameter, so a declaration of ‘qt’ must be available
../../../src/lib/quaternion.h:56: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../../src/lib/quaternion.h: At global scope:
../../../src/lib/quaternion.h:60: error: expected constructor, destructor, or type conversion before ‘(’ token
../../../src/lib/quaternion.h:63: error: ‘qt’ does not name a type
../../../src/lib/quaternion.h:64: error: ‘qt’ does not name a type
../../../src/lib/quaternion.h:65: error: ‘qt’ does not name a type
../../../src/lib/quaternion.h:66: error: expected ‘,’ or ‘...’ before ‘&’ token
../../../src/lib/quaternion.h:66: error: ISO C++ forbids declaration of ‘qt’ with no type
../../../src/lib/quaternion.h:67: error: expected ‘,’ or ‘...’ before ‘&’ token
../../../src/lib/quaternion.h:67: error: ISO C++ forbids declaration of ‘qt’ with no type
../../../src/lib/quaternion.h:69: error: expected ‘,’ or ‘...’ before ‘&’ token
../../../src/lib/quaternion.h:69: error: ISO C++ forbids declaration of ‘qt’ with no type
../../../src/lib/quaternion.h: In function ‘fl quaternion_norm_sqr(int)’:
../../../src/lib/quaternion.h:70: error: ‘q’ was not declared in this scope
../../../src/lib/quaternion.h: At global scope:
../../../src/lib/quaternion.h:73: error: variable or field ‘quaternion_normalize’ declared void
../../../src/lib/quaternion.h:73: error: ‘quaternion_normalize’ declared as an ‘inline’ variable
../../../src/lib/quaternion.h:73: error: ‘qt’ was not declared in this scope
../../../src/lib/quaternion.h:73: error: ‘q’ was not declared in this scope
../../../src/lib/quaternion.h:73: error: expected ‘,’ or ‘;’ before ‘{’ token
../../../src/lib/quaternion.h:82: error: variable or field ‘quaternion_normalize_approx’ declared void
../../../src/lib/quaternion.h:82: error: ‘quaternion_normalize_approx’ declared as an ‘inline’ variable
../../../src/lib/quaternion.h:82: error: ‘qt’ was not declared in this scope
../../../src/lib/quaternion.h:82: error: ‘q’ was not declared in this scope
../../../src/lib/quaternion.h:82: error: expected primary-expression before ‘const’
../../../src/lib/quaternion.h:82: error: initializer expression list treated as compound expression
../../../src/lib/quaternion.h:82: error: expected ‘,’ or ‘;’ before ‘{’ token
make: *** [main.o] 오류 1
 

간단함. boost 를 안 깔아서 그럼. 일단 간단히 yum install boost 실행. 그 후 make. 같은 에러.

[root@csbi release]# yum install boost.i386 boost-devel.i386

실행. 왜냐 하면 *.hpp 파일들이 없다니까... 그 후 다시 make. 에러가 조금 바뀜. 
 
[adnoctum@csbi release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include  -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
더보기
/usr/include/boost/ptr_container/detail/reversible_ptr_container.hpp: In copy constructor ‘boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>::ptr_sequence_adapter(const boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>&)’:
/usr/include/boost/ptr_container/detail/reversible_ptr_container.hpp:294: error: ‘boost::ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>::reversible_ptr_container(const boost::ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>&) [with Config = boost::ptr_container_detail::sequence_config<output_type, std::vector<void*, std::allocator<void*> > >, CloneAllocator = boost::heap_clone_allocator]’ is private
/usr/include/boost/ptr_container/ptr_sequence_adapter.hpp:148: error: within this context
/usr/include/boost/ptr_container/ptr_vector.hpp: In copy constructor ‘boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >::ptr_vector(const boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >&)’:
/usr/include/boost/ptr_container/ptr_vector.hpp:35: note: synthesized method ‘boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>::ptr_sequence_adapter(const boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>&)’ first required here
../../../src/main/main.cpp: In function ‘output_container remove_redundant(const output_container&, fl)’:
../../../src/main/main.cpp:150: note: synthesized method ‘boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >::ptr_vector(const boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >&)’ first required here
/usr/include/boost/ptr_container/detail/reversible_ptr_container.hpp: In member function ‘boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>& boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>::operator=(const boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>&)’:
/usr/include/boost/ptr_container/detail/reversible_ptr_container.hpp:295: error: ‘void boost::ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>::operator=(const boost::ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>&) [with Config = boost::ptr_container_detail::sequence_config<output_type, std::vector<void*, std::allocator<void*> > >, CloneAllocator = boost::heap_clone_allocator]’ is private
/usr/include/boost/ptr_container/ptr_sequence_adapter.hpp:148: error: within this context
/usr/include/boost/ptr_container/ptr_vector.hpp: In member function ‘boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >& boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >::operator=(const boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >&)’:
/usr/include/boost/ptr_container/ptr_vector.hpp:35: note: synthesized method ‘boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>& boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>::operator=(const boost::ptr_sequence_adapter<output_type, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>&)’ first required here
../../../src/main/main.cpp: In function ‘void do_search(model&, const boost::optional<model>&, const scoring_function&, const precalculate&, const igrid&, const precalculate&, const igrid&, non_cache&, const std::string&, const vec&, const vec&, const parallel_mc&, fl, sz, int, int, bool, bool, tee&, const terms&, const flv&)’:
../../../src/main/main.cpp:232: note: synthesized method ‘boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >& boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >::operator=(const boost::ptr_vector<output_type, boost::heap_clone_allocator, std::allocator<void*> >&)’ first required here
../../../src/main/main.cpp: In function ‘int main(int, char**)’:
../../../src/main/main.cpp:632: error: ‘hardware_concurrency’ is not a member of ‘boost::thread’
make: *** [main.o] 오류 1
 
구글에

‘hardware_concurrency’ is not a member of ‘boost::thread’

로 검색해 본 결과 이 페이지가 나왔고, 추측해 본 결과 yum package 저장소에 있는 boost 의 버전이 낮은 것 같음. 확인해보니 현재 yum 으로 설치된 것은 boost version 1.33 이고 내가 vina 를 성공적으로 설치한 linux 에는 boost 1.52가 설치되어 있음. 따라서 boost 1.52를 직접 설치하기 시작함. 
 
일단 boost 1.57 버전 source 를 받고, 압축을 풀어서 ./bootstrap.sh 를 실행. 그 후, ./b2 를 실행.하여튼간에 엄청난 에러 메세지가 뜸. 대략 python 관련된 에러인 듯.

[root@csbi ~]# yum install python-devel.i386
 
여러 에러가 사라짐, :) 이제 남은 에러는
 
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.1.2/release/threading-multi/bzip2.o
 
에서 시작. 물론 엄청 긴 에러가 남. 이것은 대략 zip library 가 없기 때문인 듯. 현재 설치 시도중인 컴퓨터는 OS 만 설치한 것이다. 
 
[root@csbi ~]# yum install zlib-devel.i386
 
위로 해도 결과가 같음. 혹시나 해서 bzip 으로 찾아 보니 bzip2 이 따로 있음. 그래서 다시 실행. 
 
[root@csbi ~]# yum install bzip2-devel.i386 bzip2-libs.i386
 
거의 다 온 듯. 위 실행 후 다시 ./b2 를 하면 주요 에러 중 
 
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.1.2/release/threading-multi/bzip2.o
gcc.link.dll bin.v2/libs/iostreams/build/gcc-4.1.2/release/threading-multi/libboost_iostreams.so.1.57.0
/usr/bin/ld: skipping incompatible /usr/lib/libbz2.so when searching for -lbz2
/usr/bin/ld: skipping incompatible /usr/lib/libbz2.a when searching for -lbz2
/usr/bin/ld: cannot find -lbz2
collect2: ld returned 1 exit status
 
얘가 있음. 그런데 libbz 를 찾아 보면, 
 
[root@csbi ~]# locate libbz2
더보기
/backup/back1/home/adnoctum/MikTex/Libraries/3rd/bzip2/libbz2-version.h
/backup/back1/home/adnoctum/MikTex/Libraries/3rd/bzip2/libbz2.def
/backup/back1/home/adnoctum/MikTex/Libraries/3rd/bzip2/libbz2.rc.in
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/lib/libbz2.so.1.0
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/lib/libbz2.so.1.0.5
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.digsigsums
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.list
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.md5sums
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.postinst
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.postrm
/backup/back1/home/adnoctum/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/dpkg/info/libbz2-1.0.shlibs
/home/adnoctum/R-3.0.2/src/extra/bzip2/libbz2.a
/root/.dropbox-dist/libbz2.so.1.0
/usr/lib/libbz2.a
/usr/lib/libbz2.so
/usr/lib/libbz2.so.1
/usr/lib/libbz2.so.1.0.3
/usr/lib64/libbz2.so.1
/usr/lib64/libbz2.so.1.0.3
[root@csbi ~]#
 
이렇게 나옴. 보통 64 bit 용을 컴파일할 때 64bit 용 library 를 못 찾아서 에러가 나는데, 이 경우는 아닌 듯. 현재 컴퓨터는 32bit 이고, library 역시 32 bit 용을 설치하고 있음. 으...

[root@csbi ~]# ld -lbz2 --verbose

실행 결과를 보면,

더보기
  .debug_ranges   0 : { *(.debug_ranges) }
  /DISCARD/ : { *(.note.GNU-stack) }
}
 
==================================================
attempt to open /usr/x86_64-redhat-linux/lib64/libbz2.so failed
attempt to open /usr/x86_64-redhat-linux/lib64/libbz2.a failed
attempt to open /usr/local/lib64/libbz2.so failed
attempt to open /usr/local/lib64/libbz2.a failed
attempt to open /lib64/libbz2.so failed
attempt to open /lib64/libbz2.a failed
attempt to open /usr/lib64/libbz2.so failed
attempt to open /usr/lib64/libbz2.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libbz2.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libbz2.a failed
attempt to open /usr/lib64/libbz2.so failed
attempt to open /usr/lib64/libbz2.a failed
attempt to open /usr/local/lib/libbz2.so failed
attempt to open /usr/local/lib/libbz2.a failed
attempt to open /lib/libbz2.so failed
attempt to open /lib/libbz2.a failed
attempt to open /usr/lib/libbz2.so succeeded
ld: skipping incompatible /usr/lib/libbz2.so when searching for -lbz2
attempt to open /usr/lib/libbz2.a succeeded
ld: skipping incompatible /usr/lib/libbz2.a when searching for -lbz2
ld: cannot find -lbz2
 
가 나옴. 혹시나 해서 
 
[root@csbi ~]# uname -a
Linux csbi.kaist.ac.kr 2.6.18-371.1.2.el5 #1 SMP Tue Oct 22 12:51:53 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
 
해보니... 현재 설치 중인 컴퓨터는 64 bit 였음...
 
[root@csbi ~]# yum bzip2.x86_64 bzip2-devel.x86_64 bzip2-libs.x86_64
 
그 후, 다시 ./b2 를 하니 !!
 
 
The Boost C++ Libraries were successfully built!
 
The following directory should be added to compiler include paths:
 
    /home/adnoctum/boost_1_57_0
 
The following directory should be added to linker library paths:
 
    /home/adnoctum/boost_1_57_0/stage/lib
 
[adnoctum@csbi boost_1_57_0]$
 
메세지가 나옴.

[adnoctum@csbi boost_1_57_0]$ vi ~/.bash_profile
 
해서
 
CPLUS_INCLUDE_PATH=/home/adnoctum/boost_1_57_0
export CPLUS_INCLUDE_PATH
 
LIBRARY_PATH=$LIBRARY_PATH:/home/adnoctum/boost_1_57_0/stage/lib
export LIBRARY_PATH
 
추가하고.

[adnoctum@csbi boost_1_57_0]$ source ~/.bash_profile
 
그 후, 생각해 보니 vina 는 홈페이지의 설명 대로 make depend 를 먼저 해야 했음. 그래서 하면,

[adnoctum@csbi release]$ make depend
ln -sf `/usr/bin/g++ -print-file-name=libstdc++.a`
rm -f dependencies_tmp dependencies_tmp.bak
touch dependencies_tmp
makedepend -f dependencies_tmp -Y -I ../../../src/lib ../../../src/lib/*.cpp ../../../src/tests/*.cpp ../../../src/design/*.cpp ../../../src/main/*.cpp ../../../src/split/*.cpp  ../../../src/tune/*.cpp
/bin/sh: makedepend: command not found
make: *** [depend] 오류 127
[adnoctum@csbi release]$
 
이런 오류가 남. 그래... 예전에 여기가 좀 문제였던 것이 생각남, ㅋㅋ. 여기서, make_common 파일을 수정했었음.
 
 

참 많은 것을 수정했었네... 어떻게 저렇게 다 수정했는지는 지금 기억이 잘 나지 않고, makedepend 라는 것이 좀 오래된 것이고, 현재는 g++ 의 -MM 옵션이 이 역할을 한다는 것을 검색 결과 알게 되어 위처럼 여기저기 수정한 듯 하다. 어쨌든 그 후 make depend 를 하면 제대로 되는 듯 하다. 그 후 make 를 하면,

[adnoctum@csbi release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include  -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
../../../src/main/main.cpp: In function ‘boost::filesystem::path make_path(const std::string&)’:
../../../src/main/main.cpp:50: error: invalid conversion from ‘bool (*)(const std::string&)’ to ‘void*’
../../../src/main/main.cpp:50: error:   initializing argument 2 of ‘boost::filesystem::path::path(const Source&, typename boost::enable_if<boost::filesystem::path_traits::is_pathable<typename boost::decay<T>::type>, void>::type*) [with Source = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’
../../../src/main/main.cpp: In function ‘int main(int, char**)’:
../../../src/main/main.cpp:664: error: ‘class path’ has no member named ‘native_file_string’
../../../src/main/main.cpp:676: error: ‘class path’ has no member named ‘native_file_string’
make: *** [main.o] 오류 1
[adnoctum@csbi release]$
 
이 나온다. 그래, 이 메세지 역시 기억이 난다. 그런데 어떻게 고쳤는지는 기억이 안나네... 혹시나 하여 원본 main.cpp 파일을 컴파일이 성공했던 컴퓨터의 main.cpp 파일을 비교해 보니 위의 에러 난 곳이 수정되어 있다. 그냥 주석 처리 했다, ㅋㅋㅋ. 
 
그 후 컴파일하면

[adnoctum@csbi release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include  -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
../../../src/main/main.cpp: In function ‘boost::filesystem::path make_path(const std::string&)’:
../../../src/main/main.cpp:50: error: invalid conversion from ‘bool (*)(const std::string&)’ to ‘void*’
../../../src/main/main.cpp:50: error:   initializing argument 2 of ‘boost::filesystem::path::path(const Source&, typename boost::enable_if<boost::filesystem::path_traits::is_pathable<typename boost::decay<T>::type>, void>::type*) [with Source = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’
make: *** [main.o] 오류 1
 
이런 오류가 나는데, 이 때 main.cpp 의 50번째 줄은,
 
path make_path(const std::string& str) {
        //return path(str, boost::filesystem::native);
        return path(str);
}

이다. 위에서처럼 주석 처리 및 수정하면 일단 컴파일은 제대로 된다. 여기까진 전에 했던 부분인데, 새로운 에러는, 
 
[adnoctum@csbi release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include -o vina main.o cache.o coords.o current_weights.o everything.o grid.o szv_grid.o manifold.o model.o monte_carlo.o mutate.o my_pid.o naive_non_cache.o non_cache.o parallel_mc.o parse_pdbqt.o pdb.o quasi_newton.o quaternion.o random.o ssd.o terms.o weighted_terms.o /home/adnoctum/boost_1_57_0/stage/lib/libboost_system.a /home/adnoctum/boost_1_57_0/stage/lib/libboost_thread.a /home/adnoctum/boost_1_57_0/stage/lib/libboost_serialization.a /home/adnoctum/boost_1_57_0/stage/lib/libboost_filesystem.a /home/adnoctum/boost_1_57_0/stage/lib/libboost_program_options.a
/home/adnoctum/boost_1_57_0/stage/lib/libboost_thread.a(thread.o): In function `boost::this_thread::no_interruption_point::hiden::sleep_until(timespec const&)':
thread.cpp:(.text+0x116): undefined reference to `clock_gettime'
thread.cpp:(.text+0x18e): undefined reference to `clock_gettime'
thread.cpp:(.text+0x1f7): undefined reference to `clock_gettime'
thread.cpp:(.text+0x260): undefined reference to `clock_gettime'
thread.cpp:(.text+0x2c9): undefined reference to `clock_gettime'
/home/adnoctum/boost_1_57_0/stage/lib/libboost_thread.a(thread.o):thread.cpp:(.text+0x32e): more undefined references to `clock_gettime' follow
collect2: ld returned 1 exit status
make: *** [vina] 오류 1
 
구글에서

thread.cpp:(.text+0x116): undefined reference to `clock_gettime'

로 검색을 하면 compile option의 가장 마지막에 -lrt 를 추가하라는 말이 있다. 그래서 make_common 파일을 
 
LIBS = $(LIB_PATH)/libboost_system.a $(LIB_PATH)/libboost_thread.a $(LIB_PATH)/libboost_serialization.a $(LIB_PATH)/libboost_filesystem.a $(LIB_PATH)/libboost_program_options.a -lrt
 
로 수정해서 컴파일, 끝!

 


 

 

이것은 다른 컴퓨터에 설치하면서 만난 과정.

CentOS 6.6, 32bit. 일단 Desktop 으로 설치 후 ssh 를 통해 vina compile 을 시도 중. 우선 boost 를 설치하기 위해 bootstrap.sh 를 실행시키면 다음과 같은 에러가 발생. 

 

[adnoctum@localhost boost_1_57_0]$ ./bootstrap.sh

Building Boost.Build engine with toolset ...

Failed to build Boost.Build build engine

Consult 'bootstrap.log' for more details

[adnoctum@localhost boost_1_57_0]$ vi bootstrap.log

 

마지막 두 줄에 의해  bootstrap.log 파일을 보면 제일 끝에 

 
./build.sh: line 16: cc: command not found
 
이런 말로 미루어 보아 gcc 가 설치가 안 되어 있어서 그런 듯(cc는 compile 을 위한 명령어로 보임). 그래서 root 계정으로 gcc 관련된 것들 설치.

[root@localhost boost_1_57_0]# yum install gcc
 
그 후 bootstrap.sh 자체는 성공, b2 가 만들어짐. 그러나 ./b2 실행하면 
 
[adnoctum@localhost boost_1_57_0]$ ./b2
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/tools/gcc.jam:148: in gcc.init from module gcc
error: toolset gcc initialization:
error: no command provided, default command 'g++' not found
더보기
error: initialized from project-config.jam:12
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/build/toolset.jam:43: in toolset.using from module toolset
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/build/project.jam:1007: in using from module project-rules
project-config.jam:12: in modules.load from module project-config
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/build-system.jam:249: in load-config from module build-system
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/build-system.jam:412: in load-configuration-files from module build-system
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/build-system.jam:524: in load from module build-system
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/kernel/modules.jam:289: in import from module modules
/home/adnoctum/docking/vina_install/boost_1_57_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
/home/adnoctum/docking/vina_install/boost_1_57_0/boost-build.jam:17: in module scope from module
 
발생. 에러 메세지 자체는 아마도 g++ 이 없기 떄문에 생긴 듯. 그래서 다시 yum 으로 g++ 설치. 뭐야, gcc 설치할 때 다 안 설치되는 거 아니야? >.<""
 
[adnoctum@localhost boost_1_57_0]$ g++
-bash: g++: command not found
[adnoctum@localhost boost_1_57_0]$ locate g++
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[adnoctum@localhost boost_1_57_0]$ su
Password:
[root@localhost boost_1_57_0]# yum install gcc-c++.i686
 
그 후 다시 ./b2 하면 어마어마한 warning 과 error 가 뜨는데, 결국 python-devel 과 bzip2 가 없어서 그런 것이라는 것을 어제 알았으므로 yum 으로 그것들을 설치 후 ./b2 하면 끝.
 
그 후 다시 vina 설치 하는 곳으로 가서 make depend  하면 성공. 그러나 make 하면 
 
[adnoctum@localhost release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include -o vina main.o cache.o coords.o current_weights.o everything.o grid.o szv_grid.o manifold.o model.o monte_carlo.o mutate.o my_pid.o naive_non_cache.o non_cache.o parallel_mc.o parse_pdbqt.o pdb.o quasi_newton.o quaternion.o random.o ssd.o terms.o weighted_terms.o /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_system.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_thread.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_serialization.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_filesystem.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_program_options.a -lrt
/usr/bin/ld: cannot find -lrt
collect2: ld returned 1 exit status
make: *** [vina] Error 1
 
이런 에러 뜸. 그래서 -lrt 를 없애고 다시 하면

[adnoctum@localhost release]$ make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -O3 -DNDEBUG -I /usr/local/include -o vina main.o cache.o coords.o current_weights.o everything.o grid.o szv_grid.o manifold.o model.o monte_carlo.o mutate.o my_pid.o naive_non_cache.o non_cache.o parallel_mc.o parse_pdbqt.o pdb.o quasi_newton.o quaternion.o random.o ssd.o terms.o weighted_terms.o /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_system.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_thread.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_serialization.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_filesystem.a /home/adnoctum/docking/vina_install/boost_1_57_0/stage/lib/libboost_program_options.a
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
make: *** [vina] Error 1
 
이거 뜸. 약간의 검색 결과 glibc-static library 가 없기 때문에 발생한 에러라는 것을 알게 됨. 그래서 설치.

[root@localhost release]# yum install glibc-static.i686

그 후, 다시 -lrt 를 추가하고, make 하면 약간의 warning 과 함께 끝. 
 

 


 

 

윈도우즈에서의 컴파일



여기선 그냥 한 프로젝트에 source code 전부 추가한 후 compile 하면 끝난다.

환경
+ Windows 7 Professional 64bit, Service Pack1 (English). 
+ Visual Studio 2010 Professional Version 10.0.40219.1 SP1Rel (English)



 

'연구관련 > 연구생활' 카테고리의 다른 글

드뎌! 서버 미러링 작업중.  (0) 2015.12.05
노가다에 의한 철야?  (0) 2015.03.05
일중독일 것이라 생각하여  (0) 2014.10.10
연구 자원(DB 등)  (2) 2014.09.27
100개가 넘는 core를 사용하는 요즘  (1) 2014.08.29