diff mbox series

[meta-oe,v2] protobuf: disable protoc binary for target

Message ID 20220827075947.3579120-1-uvv.mail@gmail.com
State New
Headers show
Series [meta-oe,v2] protobuf: disable protoc binary for target | expand

Commit Message

Vyacheslav Yurkov Aug. 27, 2022, 7:59 a.m. UTC
From: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>

When applications want to use protoc during the build, the target binary
has to be disabled in order to avoid following error:

|   The imported target "protobuf::protoc" references the file
|
|      "<application build dir>/recipe-sysroot/usr/bin/protoc-<protobuf version>"
|
|   but this file does not exist.  Possible reasons include:
|
|   * The file was deleted, renamed, or moved to another location.
|
|   * An install or uninstall procedure did not complete successfully.
|
|   * The installation package was faulty and contained
|
|      "<application build dir>/recipe-sysroot/usr/lib/cmake/protobuf/protobuf-targets.cmake"
|
|   but not all the files it references.

Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Khem Raj Aug. 27, 2022, 9:18 a.m. UTC | #1
On Sat, Aug 27, 2022 at 1:00 AM Vyacheslav Yurkov <uvv.mail@gmail.com> wrote:
>
> From: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
>
> When applications want to use protoc during the build, the target binary
> has to be disabled in order to avoid following error:
>
> |   The imported target "protobuf::protoc" references the file
> |
> |      "<application build dir>/recipe-sysroot/usr/bin/protoc-<protobuf version>"
> |
> |   but this file does not exist.  Possible reasons include:
> |
> |   * The file was deleted, renamed, or moved to another location.
> |
> |   * An install or uninstall procedure did not complete successfully.
> |
> |   * The installation package was faulty and contained
> |
> |      "<application build dir>/recipe-sysroot/usr/lib/cmake/protobuf/protobuf-targets.cmake"
> |
> |   but not all the files it references.
>
> Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
> ---
>  meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
> index 83dabc9f8..e36179363 100644
> --- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
> +++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
> @@ -34,6 +34,13 @@ EXTRA_OECMAKE += "\
>      -Dprotobuf_BUILD_EXAMPLES=OFF \
>  "
>
> +# Configuration below allows to cross-compile protobuf applications
> +# and use native protoc binary in your recipes. In order to use protoc
> +# on the target, set protobuf_BUILD_PROTOC_BINARIES to ON in your bbappend
> +EXTRA_OECMAKE:append:class-target = " \
> +     -Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
> +"
> +

can we make it a packageconfig perhaps ?

>  TEST_SRC_DIR = "examples"
>  LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
>
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#98486): https://lists.openembedded.org/g/openembedded-devel/message/98486
> Mute This Topic: https://lists.openembedded.org/mt/93286129/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Vyacheslav Yurkov Aug. 27, 2022, 9:30 a.m. UTC | #2
On 27.08.2022 11:18, Khem Raj wrote:
> On Sat, Aug 27, 2022 at 1:00 AM Vyacheslav Yurkov <uvv.mail@gmail.com> wrote:
>> From: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
>>
>> When applications want to use protoc during the build, the target binary
>> has to be disabled in order to avoid following error:
>>
>> |   The imported target "protobuf::protoc" references the file
>> |
>> |      "<application build dir>/recipe-sysroot/usr/bin/protoc-<protobuf version>"
>> |
>> |   but this file does not exist.  Possible reasons include:
>> |
>> |   * The file was deleted, renamed, or moved to another location.
>> |
>> |   * An install or uninstall procedure did not complete successfully.
>> |
>> |   * The installation package was faulty and contained
>> |
>> |      "<application build dir>/recipe-sysroot/usr/lib/cmake/protobuf/protobuf-targets.cmake"
>> |
>> |   but not all the files it references.
>>
>> Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
>> ---
>>   meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
>> index 83dabc9f8..e36179363 100644
>> --- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
>> +++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
>> @@ -34,6 +34,13 @@ EXTRA_OECMAKE += "\
>>       -Dprotobuf_BUILD_EXAMPLES=OFF \
>>   "
>>
>> +# Configuration below allows to cross-compile protobuf applications
>> +# and use native protoc binary in your recipes. In order to use protoc
>> +# on the target, set protobuf_BUILD_PROTOC_BINARIES to ON in your bbappend
>> +EXTRA_OECMAKE:append:class-target = " \
>> +     -Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
>> +"
>> +
> can we make it a packageconfig perhaps ?
>

Makes sense. Any suggestions about the name? So far only something like 
"compiler" comes to mind.

Vyacheslav
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
index 83dabc9f8..e36179363 100644
--- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
+++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
@@ -34,6 +34,13 @@  EXTRA_OECMAKE += "\
     -Dprotobuf_BUILD_EXAMPLES=OFF \
 "
 
+# Configuration below allows to cross-compile protobuf applications
+# and use native protoc binary in your recipes. In order to use protoc
+# on the target, set protobuf_BUILD_PROTOC_BINARIES to ON in your bbappend
+EXTRA_OECMAKE:append:class-target = " \
+     -Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
+"
+
 TEST_SRC_DIR = "examples"
 LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"