On Tue, Dec 18, 2018 at 4:42 PM Brad Bishop <bradl...@fuzziesquirrel.com> wrote:
>
>
>
> > On Dec 18, 2018, at 1:08 PM, James Feist <james.fe...@linux.intel.com> 
> > wrote:
> >
> > If you aren't planning on enabling flto in a repo you can ignore this email.
> >
> >
> > I've created a new class flto-automake 
> > https://github.com/openbmc/meta-phosphor/blob/master/classes/flto-automake.bbclass
> >  if you are enabling -flto in an autotools project you might be interested 
> > in. When using static libraries you may run into undefined references when 
> > building with Yocto. Yocto by default uses:


The changes are right but I think flto should also be a DISTRO_FEATURE
and this change should become effective only when flto is in
DISTRO_FEATURES

> >
> > export AR = "${HOST_PREFIX}ar"
> > export RANLIB = "${HOST_PREFIX}ranlib"
> >
> > for AR and RANLIB. This new class replaces these with the gcc equivalent 
> > wrappers that can work with the flto object files. This doesn't seem to be 
> > an issue for the CI build, it only shows up for Yocto builds. Reference: 
> > http://stackoverflow.com/questions/25878407/how-can-i-use-lto-with-static-libraries#comment67660913_25878408
> >
> > For Cmake I suggest looking at the way bmcweb handles it in CMakesLists:
> > https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L92

hardcoding is not right. We have cross versions of these tools
installed during OE build and we also have options to use non-gcc
compilers, e.g. llvm provides its own verisons of llvm-ar and
llvm-ranlib and llvm-nm which should be used when using clang
or other llvm based static compilers.
This is right fix for cross compiling with CMake
https://github.com/YoeDistro/meta-ti/blob/yoe/mut/recipes-bsp/rwmem/rwmem/0001-Use-CMake-provided-vars-for-ar-and-ranlib.patch

> >
> > Thanks,
> >
> > James
>
> Thanks James
>
> I wonder if this is something they would be interested in upstream.  I’ve 
> copied
> the oe-core mailing list for possible comment.
>
> -brad
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to