kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #18363
Re: [MacOS] compiling with link-time optimization
Le 23/05/2015 19:17, Simon Richter a écrit :
> Hi,
>
> On 23.05.2015 18:48, Bernhard Stegmaier wrote:
>
>> I guess this is due to LTO not even being used on OS X, if I
>> understand your cmake change correctly: find_program(CMAKE_GCC_AR
>> NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}
>> HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_GCC_NM
>> NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm HINTS
>> ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_GCC_RANLIB NAMES
>> ${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib HINTS
>> ${_CMAKE_TOOLCHAIN_LOCATION})
>
>> if( CMAKE_GCC_AR AND CMAKE_GCC_NM AND CMAKE_GCC_RANLIB ) On my OS
>> X using clang there is nothing like *gcc-ar*… or any of the other
>> two. Why do you have to change/set CMAKE_AR and the other two
>> anyway?
>
> Indeed, it seems this fails on OS X, so it falls back to non-LTO.
>
> This is needed because regular binutils ar/nm/ranlib fail to work
> with the LTO objects generated by gcc, so gcc ships extra
> wrappers.
>
> Presumably, the correct approach would be
>
> - if MSYS, disable LTO (because it's broken) - if gcc, look for
> gcc-ar/gcc-nm/gcc-ranlib - if llvm, look for
> llvm-ar/llvm-nm/llvm-ranlib - if no toolchain specific tools were
> found, try whether the regular ones work.
>
> I still have to look into the problems jp had on Ubuntu -- that
> shouldn't happen.
>
> For me, it's quite a bit of a size difference on gcc (25%).
>
> without LTO: -rwxr-xr-x 1 geier geier 14995616 Mai 23 18:56
>
> textsize is 12950112
>
> with LTO: -rwxr-xr-x 1 geier geier 11152184 Mai 23 05:53
> _pcbnew.kiface
>
> textsize is 9422117
>
> with LLVM, the effect is a bit more pronounced IIRC, but I'd need
> to rebuild for actual numbers.
>
> Simon
Simon,
Sorry to say that, but what is the interest of this work:
- LTO is not usable on mingw
- looks not very useful on OSX
- does not work on any Linux install
- binaries are slightly smaller, but the full diff is something like
20 Mbytes or less (according to the info in your mail), and a full
Kicad install (with docs, libs, 3D shapes...) is at least 300 Mbytes
(800 Mbytes on Windows, with python, wxWidgets and some other libs).
And smaller binaries does not mean faster execution time (this is
often the opposite)
- You said in a previous mail the link time is longer with LTO than
without LT0, and this is a serious issue for developers (the compil time
is often short when editing a few sources, so a longer link time is an
issue)
Thanks.
--
Jean-Pierre CHARRAS
Follow ups
References