On Tue, Mar 27, 2012 at 10:23 AM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 27.03.12 09:45:47, Kyle Leber wrote:<br>
> On Fri, Mar 23, 2012 at 4:20 PM, Kyle Leber <<a href="mailto:kleber@fastemail.us">kleber@fastemail.us</a>> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > I'm using cmake 2.8 and having an issue when I issue a 'make<br>
> > install/strip'. My project includes two libraries: one static and one<br>
> > shared. The shared library gets properly stripped, but the static one does<br>
> > not. Do I need to specify a special parameter to get the static library to<br>
> > be stripped or am I doing something else wrong?<br>
> ><br>
> > Thanks for the help!<br>
> ><br>
> > OS: Ubuntu 10.10<br>
> > Compiler: g++ 4.4.5<br>
> ><br>
> > Kyle<br>
> ><br>
><br>
> OK, I've done a little more research. It looks like cmake_install.cmake<br>
> that is generated in my build directory has install lines handling the<br>
> shared libraries and the static libraries.<br>
><br>
> After the shared library is installed, there's a section like this:<br>
><br>
> IF(EXISTS "${file}" AND<br>
> NOT IS_SYMLINK "${file}")<br>
> IF(CMAKE_INSTALL_DO_STRIP)<br>
> EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "${file}")<br>
> ENDIF(CMAKE_INSTALL_DO_STRIP)<br>
> ENDIF()<br>
><br>
> That clearly strips the files after they are installed. However, in the<br>
> section that installs my static library there is no such check to handle<br>
> stripping the library. Is this a missing feature in CMake, or is there a<br>
> reason this is not supported? I can run /usr/bin/strip on my .a static<br>
> library without issue so I think it's a reasonable thing to expect.<br>
<br>
</div></div>Did you actually try linking against such a stripped static library? A<br>
simple call of strip libfoo.a will remove all symbols from that library,<br>
making it totally useless since you cannot link against it anymore. For<br>
a shared library things are different since its not just a bundle of<br>
object files (like a static library is), but rather contains additional<br>
information allowing strip to just strip the stuff that cannot be used<br>
from outside (i.e. private functions/classes etc.).<br>
<br>
Looking at strip's commandline parameters it might be possible to<br>
manually strip just the symbols you don't want in the static library,<br>
but this cannot be done by cmake automatically. So you'll have to create<br>
a custom post-install command to do this for you.<br>
<br>
Andreas<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>Andreas,<br><br>Thanks much for the reply. I did not realize the limitations of stripping static libraries. I think what I really want is the "strip --strip-unneeded" option. I will look into the post-install options to take care of this.<br>
<br>Thanks again,<br>Kyle<br>