LoginSignup
1

More than 5 years have passed since last update.

CMake で Could NOT find Boost と言われる。 @Ubuntu 12.04 & 14.04

Posted at

CMake で Could NOT find Boost と言われる。 @Ubuntu 12.04 & 14.04

CMakeとlibboostで苦しんだのでメモ

someone@anywhere:~/someproject$ cmake .
.... なんとかかんとか.. ..
-- Could NOT find Boost
.... なんとかかんとか.. ..

C系自分で作ってなくて cmake とか make とかあまりわかってない。
cmake で Boost が見つからないと怒られる。
system-mt というのが怒られているので libboost_system をインストールしたり
パス通してみたりオプション足してみたりしても動かない。
無視して make したら当たり前だけどこける。
CMakeLists の怒られてるところを一部変えてみたら make でこける。
とりあえず手当たりしだい系は動かなかった。

すごく時間かかったけど結局、apt-get のリポジトリを足してインストールしなおしたらあっさりうまく行きました。
やったこと

sudo add-apt-repository ppa:boost-latest/ppa -y
sudo apt-get update 
sudo apt-get purge boost* -y
sudo apt-get install libboost-all-dev -y

過激に全部とり直してるので大事な環境ではご注意ください。

助けられました。ありがとうございます: http://meme.biology.tohoku.ac.jp/students/iwasaki/cxx/boost.html

作業ログ

リポジトリ足して update

someone@anywhere:~/someproject$ sudo add-apt-repository ppa:boost-latest/ppa -y
gpg: keyring `/tmp/tmpg7rWWc/secring.gpg' created
gpg: keyring `/tmp/tmpg7rWWc/pubring.gpg' created
gpg: requesting key 029DB5C7 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpg7rWWc/trustdb.gpg: trustdb created
gpg: key 029DB5C7: public key "Launchpad boost-latest" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
someone@anywhere:~/someproject$ sudo apt-get update 
Hit http://packages.treasuredata.com precise Release.gpg
Hit http://dl.google.com stable Release.gpg                                                                  
Hit http://archive.ubuntulinux.jp precise Release.gpg                                                        
Hit http://archive.ubuntulinux.jp precise Release.gpg                                                        
Hit http://jp.archive.ubuntu.com precise Release.gpg                                                         
Hit http://jp.archive.ubuntu.com precise-updates Release.gpg                                                 
Hit http://jp.archive.ubuntu.com precise-backports Release.gpg                 
.
.
.

今までの libboost 全消し

someone@anywhere:~/someproject$ sudo apt-get purge boost* 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libboost-timer1.50-dev' for regex 'boost*'
Note, selecting 'libboost-test1.52-dev' for regex 'boost*'
Note, selecting 'libboost-regex1.53-dev' for regex 'boost*'
Note, selecting 'libboost-regex1.48-dev' for regex 'boost*'
Note, selecting 'libboost-system1.55-dev' for regex 'boost*'
Note, selecting 'libboost-chrono1.48.0' for regex 'boost*'
Note, selecting 'pianobooster-dbg' for regex 'boost*'
Note, selecting 'libboost-math1.53-dev' for regex 'boost*'
Note, selecting 'libboost-math1.48-dev' for regex 'boost*'
Note, selecting 'libboost-system1.48.0' for regex 'boost*'
Note, selecting 'libboost-chrono1.54.0' for regex 'boost*'
Note, selecting 'libboost-system1.54.0' for regex 'boost*'
.
.
.

-all-dev があるか確認、全インストール

someone@anywhere:~/someproject$ apt-cache search libboost*-all-dev
libboost-all-dev - Boost C++ Libraries development files (ALL, default version)
someone@anywhere:~/someproject$ sudo apt-get install libboost-all-dev -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libio-string-perl libclass-accessor-perl linux-image-3.2.0-95-generic-pae libcwidget3
  libparse-debianchangelog-perl libsub-name-perl linux-image-3.2.0-96-generic-pae
  linux-image-3.2.0-94-generic-pae
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  gccxml libboost-date-time-dev libboost-date-time1.46-dev libboost-date-time1.46.1 libboost-dev
  libboost-filesystem-dev libboost-filesystem1.46-dev libboost-filesystem1.46.1 libboost-graph-dev
  libboost-graph-parallel-dev libboost-graph-parallel1.46-dev libboost-graph-parallel1.46.1
.
.
.

cmake
バージョン下がってる気がするけどね...

someone@anywhere:~/someproject$ cmake .
-- Boost version: 1.46.1
-- Found the following Boost libraries:
--   system-mt
... なんとかかんとか ...
someone@anywhere:~/someproject$ make

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1