title: How do you statically link Boost libraries only?
body: <p>I've got a project which links against various common libraries, as well as Boost. Testing this on computers other than my own has proven to be difficult since various flavors of Linux come with different versions of Boost. I would prefer to avoid having to download and compile the same version of Boost on every machine. </p>
  
  <p>Is there a way to link my program statically only with the Boost libraries and have everything else linked normally? I've tried linking everything statically (-static), but that causes other problems (namely lGL is not found). Is there an other potential way I could package only the necessary dynamic libraries with my program (say in the same folder as the executable) and distribute it that way?</p>
  
  <p>Link error when trying to link everything statically:</p>
  
  <pre><code>g++ -static -o"acmserver"  ./src/acmserver.o ./src/airplane.o ./src/bullet.o ./src/control.o ./src/detail.o ./src/game.o ./src/gamelog.o ./src/gamelogitem.o ./src/guns.o ./src/map.o ./src/missile.o ./src/missilepod.o ./src/object.o ./src/server.o   -lboost_system -lboost_filesystem -lboost_thread -lboost_serialization -lboost_date_time -lpthread -lGLU -lGL
  /usr/bin/ld: cannot find -lGL
  collect2: ld returned 1 exit status
  make: *** [acmserver] Error 1
  </code></pre>
  
  <p>EDIT (SOLUTION):</p>
  
  <p>count0 mentioned exactly what I was looking for. In Eclipse I removed all the Boost libraries (e.g., boost_system) form Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Libraries -> Libraries (-l). Then I added the Boost .a files (e.g., /usr/lib/libboost_system.a) under Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Miscellaneous -> Other Objects. I also removed the "-static" from the linker flags. This produced an executable with all of the boost libraries linked statically instead of dynamically.</p>