cmake o boost find_package falha no Debian Jessie

1

Eu tenho um aplicativo C ++ auto-escrito que usa o cmake como sua ferramenta de compilação. O CMakeLists.txt tem funcionado perfeitamente no Debian 7 (Wheezy) mas não no Debian 8 (Jessie) e isso me deixa louco. Em particular, o cmake não pode encontrar as bibliotecas de reforço. A parte relevante de 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}" )

A saída é

# 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

Como você pode ver, a quarta linha de saída está vazia (nenhuma biblioteca depois de "Boost libraries"). A variável ${Boost_LIBRARIES} está vazia.

Se eu descomentar a linha find_package( Boost REQUIRED COMPONENTS system program_options date_time ) , ou seja, se eu especificar bibliotecas específicas, o script falhará miseravelmente.

O mesmo script funciona perfeitamente para o Debian Wheezy com o Boost 1.49. Minhas bibliotecas instaladas:

# 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

O que estou fazendo de errado?

Atualizar

Eu reduzi o problema ainda mais. No Debian 7 (Wheezy) eu recebo

# 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                                                                                                                                                                            

Se eu fizer o mesmo no Debian 8 (Jessie), eu obtenho

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

O que?! Além disso, no Debian Wheezy eu procurei o pacote que fornece o 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

Equivalenty, eu suspeito que libboost-system1.55.0 forneça a contraparte no Debian 8 (Jessie), mas

# 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

Nós vemos que o Debian 8 (Jessie) coloca a biblioteca em outro subdiretório x86_64-linux-gnu onde o cmake não o encontra. Eu acho que esta é a raiz do problema. No entanto, mesmo se eu definir manualmente BOOST_LIBRARYDIR para apontar o cmake para o diretório correto, ele não funcionará. Além disso, essa não pode ser a solução correta, porque não pode ser correto consertar todos os scripts de compilação. Este deve ser um problema genérico mais amplo.

    
por user2690527 11.06.2017 / 20:42

1 resposta

0

Eu sei que esta é uma pergunta antiga, mas você tentou definir o caminho para o Boost 1.55 no seu LD_LIBRARY_PATH?

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu
    
por 08.11.2018 / 22:40