1

I have a self-written C++ application that uses cmake as its build tool. The CMakeLists.txt has used worked perfectly on Debian 7 (Wheezy) but not for Debian 8 (Jessie) and it drives me crazy. In particular, cmake cannot find the boost libraries. The relevant part of CMakeLists.txt is:

#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}" )

The output is

# 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

As you can see the fourth line of output is empty (no libraries after "Boost libraries). The variable ${Boost_LIBRARIES} is empty.

If I uncomment the line find_package( Boost REQUIRED COMPONENTS system program_options date_time ), i.e. if I specify particular libraries, the script fails miserably.

The same script works perfectly for Debian Wheezy with Boost 1.49. My installed libraries:

# 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

What am I doing wrong?


Update

I narrowed the problem down further. On Debian 7 (Wheezy) I get

# 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                                                                                                                                                                            

If I do the same on Debian 8 (Jessie), I get

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

What?! Further, on Debian Wheezy I looked up the package that provide the 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, I would suspect libboost-system1.55.0 to provide the counterpart on Debian 8 (Jessie), but

# 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

We see that Debian 8 (Jessie) puts the library into another sub-directory x86_64-linux-gnu where cmake does not find it. I guess this is the root of the problem. However, even if I manually set BOOST_LIBRARYDIR in order to point cmake to the correct directory, it does not work. Moreover, this cannot be the correct solution, because it can't be correct to fix all build scripts. This must be some broader generic problem.

  • 1
    Does it work if you drop COMPONENTS? find_package(Boost REQUIRED system program_options date_time). That’s what lgogdownloader does, and that builds fine in Debian 8. – Stephen Kitt Jun 11 '17 at 18:52
  • No. Same negativ result. – user2690527 Jun 11 '17 at 19:08
0

I know this is an old question, but did you try setting the path to Boost 1.55 in your LD_LIBRARY_PATH?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.