Search code examples
packageyoctobitbakeopenembedded

How to avoid file conflicts between attempted installs during a BitBake build?


I have two autotools-based BitBake recipes which both provide the same named file (and both install in usr/bin) which causes an error:

error: file /usr/bin/example conflicts between attempted installs of recipe1-0.1-r0.x86 and recipe2-0.1-r0.x86

I found that I can fix this problem but this really seems like a hackaround with really bad style. If you put this in one of the recipes which provides the example file, it will avoid this specific error, but can cause other errors.

do_install_append () {
    rm -f ${D}${bindir}/example
}

Is there a better way to avoid this conflict? I thought there might be some hope for PREFERRED_PROVIDER but haven't had any success.


Solution

  • The usual way of solving this is the update-alternatives class. See meta/classes/update-alternatives.bbclass and the Yocto Project Reference Manual entry on update-alternatives.bbclass. http://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#ref-classes-update-alternatives is the link to that.