Debian Jessie에서 cmake find_package 부스트가 실패합니다.

Debian Jessie에서 cmake find_package 부스트가 실패합니다.

cmake를 빌드 도구로 사용하는 C++ 응용 프로그램을 작성했습니다. Debian 7(Wheezy)에서는 훌륭하게 작동 CMakeLists.txt하지만 Debian 8(Jessie)에서는 작동하지 않아 미치게 만듭니다. 특히 cmake는 부스트 라이브러리를 찾을 수 없습니다. 관련 부분은 CMakeLists.txt다음과 같습니다.

#find_package( Boost REQUIRED COMPONENTS system program_options date_time )
find_package( Boost REQUIRED )

message( "Boost include dir is ${Boost_INCLUDE_DIRS}" )
message( "Boost library dir is ${Boost_LIBRARY_DIRS}" )
message( "Boost libraries ${Boost_LIBRARIES}" )

출력은 다음과 같습니다

# make rebuild_cache
Running CMake to regenerate build system...
-- Boost version: 1.55.0
Boost include dir is /usr/include
Boost library dir is /usr/lib
Boost libraries 
RRDTool library found: TRUE
RRDTool include dir is: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/lm50client

보시다시피 출력의 네 번째 줄은 비어 있습니다("Boost library" 다음에는 라이브러리가 없음). 변수 ${Boost_LIBRARIES}가 비어 있습니다.

해당 줄의 주석 처리를 제거하면 find_package( Boost REQUIRED COMPONENTS system program_options date_time ), 즉 특정 라이브러리를 지정하면 스크립트가 심하게 실패합니다.

Boost 1.49를 사용하는 Debian Wheezy에서도 동일한 스크립트가 작동합니다. 내가 설치한 라이브러리:

# aptitude search 'boost' 
i   libboost-all-dev                                                                                               - Boost C++ Libraries development files (ALL) (default version)                                                           
i A libboost-atomic-dev                                                                                            - atomic data types, operations, and memory ordering constraints (default version)                                        
i A libboost-atomic1.55-dev                                                                                        - atomic data types, operations, and memory ordering constraints                                                          
i A libboost-atomic1.55.0                                                                                          - atomic data types, operations, and memory ordering constraints                                                          
i A libboost-chrono-dev                                                                                            - C++ representation of time duration, time point, and clocks (default version)                                           
i A libboost-chrono1.55-dev                                                                                        - C++ representation of time duration, time point, and clocks                                                             
i A libboost-chrono1.55.0                                                                                          - C++ representation of time duration, time point, and clocks                                                             
i A libboost-context-dev                                                                                           - provides a sort of cooperative multitasking on a single thread (default version)                                        
i A libboost-context1.55-dev                                                                                       - provides a sort of cooperative multitasking on a single thread                                                          
i A libboost-context1.55.0                                                                                         - provides a sort of cooperative multitasking on a single thread                                                          
i A libboost-coroutine-dev                                                                                         - provides a sort of cooperative multitasking on a single thread (default version)                                        
i A libboost-coroutine1.55-dev                                                                                     - provides a sort of cooperative multitasking on a single thread                                                          
i A libboost-date-time-dev                                                                                         - set of date-time libraries based on generic programming concepts (default version)                                      
i A libboost-date-time1.55-dev                                                                                     - set of date-time libraries based on generic programming concepts                                                        
i A libboost-date-time1.55.0                                                                                       - set of date-time libraries based on generic programming concepts                                                        
p   libboost-dbg                                                                                                   - Boost C++ Libraries with debug symbols (default version)                                                                
i A libboost-dev                                                                                                   - Boost C++ Libraries development files (default version)                                                                 
p   libboost-doc                                                                                                   - Boost.org libraries documentation (default version)                                                                     
i A libboost-exception-dev                                                                                         - library to help write exceptions and handlers (default version)                                                         
i A libboost-exception1.55-dev                                                                                     - library to help write exceptions and handlers                                                                           
i A libboost-filesystem-dev                                                                                        - filesystem operations (portable paths, iteration over directories, etc) in C++ (default version)                        
i A libboost-filesystem1.55-dev                                                                                    - filesystem operations (portable paths, iteration over directories, etc) in C++                                          
i A libboost-filesystem1.55.0                                                                                      - filesystem operations (portable paths, iteration over directories, etc) in C++                                          
p   libboost-geometry-utils-perl                                                                                   - Perl module providing bindings to the Boost Geometry library                                                            
i A libboost-graph-dev                                                                                             - generic graph components and algorithms in C++ (default version)                                                        
i A libboost-graph-parallel-dev                                                                                    - generic graph components and algorithms in C++ (default version)                                                        
i A libboost-graph-parallel1.55-dev                                                                                - generic graph components and algorithms in C++                                                                          
i A libboost-graph-parallel1.55.0                                                                                  - generic graph components and algorithms in C++                                                                          
i A libboost-graph1.55-dev                                                                                         - generic graph components and algorithms in C++                                                                          
i A libboost-graph1.55.0                                                                                           - generic graph components and algorithms in C++                                                                          
i A libboost-iostreams-dev                                                                                         - Boost.Iostreams Library development files (default version)                                                             
i A libboost-iostreams1.55-dev                                                                                     - Boost.Iostreams Library development files                                                                               
i A libboost-iostreams1.55.0                                                                                       - Boost.Iostreams Library                                                                                                 
i A libboost-locale-dev                                                                                            - C++ facilities for localization (default version)                                                                       
i A libboost-locale1.55-dev                                                                                        - C++ facilities for localization                                                                                         
i A libboost-locale1.55.0                                                                                          - C++ facilities for localization                                                                                         
i A libboost-log-dev                                                                                               - C++ logging library (default version)                                                                                   
i A libboost-log1.55-dev                                                                                           - C++ logging library                                                                                                     
i A libboost-log1.55.0                                                                                             - C++ logging library                                                                                                     
i A libboost-math-dev                                                                                              - Boost.Math Library development files (default version)                                                                  
i A libboost-math1.55-dev                                                                                          - Boost.Math Library development files                                                                                    
i A libboost-math1.55.0                                                                                            - Boost.Math Library                                                                                                      
i A libboost-mpi-dev                                                                                               - C++ interface to the Message Passing Interface (MPI) (default version)                                                  
i A libboost-mpi-python-dev                                                                                        - C++ interface to the Message Passing Interface (MPI), Python Bindings (default version)                                 
i A libboost-mpi-python1.55-dev                                                                                    - C++ interface to the Message Passing Interface (MPI), Python Bindings                                                   
i A libboost-mpi-python1.55.0                                                                                      - C++ interface to the Message Passing Interface (MPI), Python Bindings                                                   
i A libboost-mpi1.55-dev                                                                                           - C++ interface to the Message Passing Interface (MPI)                                                                    
i A libboost-mpi1.55.0                                                                                             - C++ interface to the Message Passing Interface (MPI)                                                                    
i A libboost-program-options-dev                                                                                   - program options library for C++ (default version)                                                                       
i A libboost-program-options1.55-dev                                                                               - program options library for C++                                                                                         
i A libboost-program-options1.55.0                                                                                 - program options library for C++                                                                                         
i A libboost-python-dev                                                                                            - Boost.Python Library development files (default version)                                                                
i A libboost-python1.55-dev                                                                                        - Boost.Python Library development files                                                                                  
i A libboost-python1.55.0                                                                                          - Boost.Python Library                                                                                                    
i A libboost-random-dev                                                                                            - Boost Random Number Library (default version)                                                                           
i A libboost-random1.55-dev                                                                                        - Boost Random Number Library                                                                                             
i A libboost-random1.55.0                                                                                          - Boost Random Number Library                                                                                             
i A libboost-regex-dev                                                                                             - regular expression library for C++ (default version)                                                                    
i A libboost-regex1.55-dev                                                                                         - regular expression library for C++                                                                                      
i A libboost-regex1.55.0                                                                                           - regular expression library for C++                                                                                      
i A libboost-serialization-dev                                                                                     - serialization library for C++ (default version)                                                                         
i A libboost-serialization1.55-dev                                                                                 - serialization library for C++                                                                                           
i A libboost-serialization1.55.0                                                                                   - serialization library for C++                                                                                           
i A libboost-signals-dev                                                                                           - managed signals and slots library for C++ (default version)                                                             
i A libboost-signals1.55-dev                                                                                       - managed signals and slots library for C++                                                                               
i A libboost-signals1.55.0                                                                                         - managed signals and slots library for C++                                                                               
i A libboost-system-dev                                                                                            - Operating system (e.g. diagnostics support) library (default version)                                                   
i A libboost-system1.55-dev                                                                                        - Operating system (e.g. diagnostics support) library                                                                     
i A libboost-system1.55.0                                                                                          - Operating system (e.g. diagnostics support) library                                                                     
i A libboost-test-dev                                                                                              - components for writing and executing test suites (default version)                                                      
i A libboost-test1.55-dev                                                                                          - components for writing and executing test suites                                                                        
i A libboost-test1.55.0                                                                                            - components for writing and executing test suites                                                                        
i A libboost-thread-dev                                                                                            - portable C++ multi-threading (default version)                                                                          
i A libboost-thread1.55-dev                                                                                        - portable C++ multi-threading                                                                                            
i A libboost-thread1.55.0                                                                                              - portable C++ multi-threading                                                                                            
i A libboost-timer-dev                                                                                             - C++ wall clock and CPU process timers (default version)                                                                 
i A libboost-timer1.55-dev                                                                                         - C++ wall clock and CPU process timers                                                                                   
i A libboost-timer1.55.0                                                                                           - C++ wall clock and CPU process timers                                                                                   
i A libboost-tools-dev                                                                                             - Boost C++ Libraries development tools (default version)                                                                 
i A libboost-wave-dev                                                                                              - C99/C++ preprocessor library (default version)                                                                          
i A libboost-wave1.55-dev                                                                                          - C99/C++ preprocessor library                                                                                            
i A libboost-wave1.55.0                                                                                            - C99/C++ preprocessor library                                                                                            
i   libboost1.55-all-dev                                                                                           - Boost C++ Libraries development files (ALL)                                                                             
p   libboost1.55-dbg                                                                                               - Boost C++ Libraries with debug symbols                                                                                  
i A libboost1.55-dev                                                                                               - Boost C++ Libraries development files                                                                                   
p   libboost1.55-doc                                                                                               - Boost.org libraries documentation                                                                                       
i A libboost1.55-tools-dev                                                                                         - Boost C++ Libraries development tools                                                                                   
p   pianobooster                                                                                                   - learn the piano just by playing a game                                                                                  
p   pianobooster-dbg                                                                                               - learn the piano just by playing a game - debug                                                                          
p   shinken-mod-booster-nrpe                                                                                       - Shinken booster-nrpe module

내가 뭘 잘못했나요?


고쳐 쓰다

문제를 더 좁혀봤습니다. Debian 7(Wheezy)에서는 다음과 같은 결과를 얻습니다.

# ls -lh /usr/lib/libboost_system*
-rw-r--r-- 1 root root 32K Feb  4  2013 libboost_system.a                                                                                                                                                                                    
lrwxrwxrwx 1 root root  17 Feb  4  2013 libboost_system-mt.a -> libboost_system.a                                                                                                                                                            
lrwxrwxrwx 1 root root  25 Feb  4  2013 libboost_system-mt.so -> libboost_system.so.1.49.0                                                                                                                                                   
lrwxrwxrwx 1 root root  25 Feb  4  2013 libboost_system.so -> libboost_system.so.1.49.0                                                                                                                                                      
-rw-r--r-- 1 root root 14K Feb  4  2013 libboost_system.so.1.49.0                                                                                                                                                                            

Debian 8(Jessie)에서 동일한 작업을 수행하면 다음을 얻습니다.

# ls -lh /usr/lib/libboost_system*
ls: cannot access /usr/lib/libboost_system*: No such file or directory

무엇? !또한 Debian Wheezy에서 lib를 제공하는 패키지를 찾았습니다.

# dpkg -S /usr/lib/libboost_system.so.1.49.0 
libboost-system1.49.0: /usr/lib/libboost_system.so.1.49.0

# dpkg -L libboost-system1.49.0
/.
/usr
/usr/lib
/usr/lib/libboost_system.so.1.49.0
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libboost-system1.49.0
/usr/share/doc
/usr/share/doc/libboost-system1.49.0
/usr/share/doc/libboost-system1.49.0/changelog.Debian.gz
/usr/share/doc/libboost-system1.49.0/NEWS.Debian.gz
/usr/share/doc/libboost-system1.49.0/README.Debian.gz
/usr/share/doc/libboost-system1.49.0/copyright

libboost-system1.55.0이에 상응하는, Debian 8(Jessie)에 해당 버전을 사용할 수 있다고 생각 하지만,

# dpkg -L libboost-system1.55.0
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.55.0
/usr/share
/usr/share/doc
/usr/share/doc/libboost-system1.55.0
/usr/share/doc/libboost-system1.55.0/copyright
/usr/share/doc/libboost-system1.55.0/changelog.Debian.gz
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libboost-system1.55.0

x86_64-linux-gnuDebian 8(Jessie)이 라이브러리를 cmake가 찾을 수 없는 다른 하위 디렉터리에 넣는 것을 볼 수 있습니다. 나는 이것이 문제의 근원이라고 생각한다. 그러나 cmake가 올바른 디렉터리를 가리키도록 수동으로 설정해도 BOOST_LIBRARYDIR작동하지 않습니다. 또한 모든 빌드 스크립트를 수정하는 것이 올바른 솔루션이 될 수 없기 때문에 이는 올바른 솔루션이 될 수 없습니다. 이것은 좀 더 광범위한 일반적인 문제임에 틀림없습니다.

답변1

이것이 오래된 질문이라는 것을 알고 있지만 LD_LIBRARY_PATH에서 Boost 1.55에 대한 경로를 설정해 보셨습니까?

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu

관련 정보