可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I recently upgraded from boost 1.40 to 1.45 by removing the previous boost directory completely, downloading the 1.45 sources and rebuilding the libraries I wanted. I then installed the libs using bjam install.
Nothing else has changed on my machine, yet, now when I am building my C++ program, I get the following link error:
/usr/bin/ld: cannot find -lboost_system-mt
I searched and the file really does not exist. It seems that the mt libraries are no longer part of the library - or am I missing something?
How may I resolve this?
回答1:
Well, I solved this error on ubuntu 12.04 (x86_64) by the good old scattergun approach
Installing openvrml with the error "cannot find -lboost_filesystem-mt" after make.
libboost-all-dev. installs 54 different packages. One of 'em must've done the trick, runs fine.
回答2:
This version probably doesn't bring multi-threading enabled by default.
Try passing -lboost_system
instead of -lboost_system-mt
Edit:
Also it's good to check if the new libs are really inside /usr/local/lib
. You should look for /usr/local/lib/libboost_system.so since you did not requested the libs to be built with multi-threading. If the file is there, then your $PATH (environment variable) could be missing /usr/local/lib
, and you should update the compilation command so the compiler knows where to find them:
-L/usr/local/lib -lboost_system-mt
回答3:
I had a strange encounter with this, too. My solution was a bid odd - but since it worked for me and i didn't read about it anywhere else, here it is.
In my case lboost_python3 was missing.
Hence, i loaded all 54 packages like @Kilgore Trout suggested
sudo apt-get install libboost-all-dev
Unfortunately, when i looked into the /usr/lib - folder only certain packages were available there. However, when I searched the /usr/lib-folder I got more results - the missing files were all in the /usr/lib/arm-linux-gnueabihf-folder.
I simply copy-pasted all libboost-related files into the /usr/lib-folder et voila - the next time I tried to build anything with the lboost_python3.so, everything worked.
It seems some paths got mixed up or something like this.
Hope this helps you or somebody else.
回答4:
Are your sure the /usr/lib/libboost_system-mt.so
sym-link point to the right file:
$ realpath /usr/lib/libboost_system-mt.so
Otherwise you have to install the project or use yours distribution package management. For Debian/Ubuntu it would be apt-get install libboost-system1.45-dev
-- but this package does not exists while writing this.
回答5:
I have saucy:
$ dpkg -S /usr/lib/libboost_system-mt.so
libboost-system1.49-dev: /usr/lib/libboost_system-mt.so
thus, you can do:
sudo apt-get install libboost-system1.49-dev
回答6:
Fixed this thanks to @KilgoreTrout's and @user3191035, so here's my notes: I'm on Ubuntu Natty 11.04; my usual state was:
$ dpkg -S libboost_filesystem
libboost-filesystem1.42.0: /usr/lib/libboost_filesystem.so.1.42.0
Then I installed:
sudo apt-get install libboost-all-dev # ton of packages
... and after that, I get this:
$ dpkg -S libboost_filesystem
libboost-filesystem1.42-dev: /usr/lib/libboost_filesystem-mt.a
libboost-filesystem1.42.0: /usr/lib/libboost_filesystem.so.1.42.0
libboost-filesystem1.42-dev: /usr/lib/libboost_filesystem.so
libboost-filesystem1.42-dev: /usr/lib/libboost_filesystem-mt.so
libboost-filesystem1.42-dev: /usr/lib/libboost_filesystem.a
So, that is where the libboost_filesystem-mt.so
is in this OS...
回答7:
change libboost_thread-mt to libboost_thread, first find the address of libboost_thread.so and libboost_thread.a then make softlinks to these files in the same address, so it should be
ln -s /...libboostSourceFiles.../libboost_thread.so /..RequestTOmtFiles.../libboost_thread-mt.so
it works for other libboost -mt files too, like serialization , iostreams, programoptions