[CMake] faq update?

Sanchez, Juan juan.sanchez at amd.com
Thu Sep 13 21:08:16 EDT 2007


Hi,

I was aware that fPIC induces a performance penalty, but I didn't realize it was bad as you mention (30% degradation).  My preference is not reusing the object files for static and dynamic libraries, but I am working with people who do.  I think your three variant system is attractive (.so .pic.a .a).

The secret is:

Some people worry about disk space.

The shared library is for other packages depending on these library functions.

The static library is so binaries in the package can link.  The rpath is not known at compile time.  It is only known when our internal release system is done.  Some people don't want a wrapper script setting the LD_LIBRARY_PATH.  Others don't want to hack the binary to encode the proper rpath after the fact.

Don't worry, this code is for internal use only.

Regards,

Juan


-----Original Message-----
From: cmake-bounces+juan.sanchez=amd.com at cmake.org on behalf of Goswin von Brederlow
Sent: Thu 9/13/2007 7:06 PM
To: Brandon Van Every
Cc: cmake at cmake.org
Subject: Re: [CMake] faq update?
 
"Brandon Van Every" <bvanevery at gmail.com> writes:

> On 9/13/07, Juan Sanchez <Juan.Sanchez at amd.com> wrote:
>> The statement in the FAQ is untrue:
>>
>> >> That means I have to build all my library objects twice, once for shared
>> >> and once for static. I don't like that!
>>
>> This statement may also be a dealbreaker for those maintaining huge
>> projects.
>
> You know, if you're as huge as AMD, you've got the bucks to find
> workarounds.  You could even pay Kitware to implement something
> better.  The vast majority of CMake developers should be doing
> whatever works reliably.
>
>> If we choose to use the exact same flags, why shouldn't we be able to
>> choose to create the shared library from the archive?

If you are involved in such a big project and still don't know that
you can't use the exact same flags for static and dynamic then lets
hope I never have to use it. I was positivly surprised how automatic
building static and dynmic libs works in cmake.

For dynamic code (in C/C++/obj-c/fortran/anythign with C linkage) you
must use -fPIC or variant thereof because otherwise your jump labels
will be too small and linking will fail sometimes on x86, nearly
always on amd64, ppc, always on ia64, hppa, ...

And if you build static code with -fPIC then you get the reverse on
some archs and loose, some claim up to 30%, speed on x86 and amd64.


Consider yourself lucky you only have to build 2 versions. You might
have to build a dynamic library (*.so), a static library for use in static
linking (*.a) and a static library for use in dynamic linking
(*_pic.a, to link into another dynamic lib or library reduction in an
installer image).

MfG
        Goswin
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070913/eb31eb3f/attachment.htm


More information about the CMake mailing list