flatbuffers: adapt for cross-compilation environments
PATCH 1/1 flatbuffers: adapt for cross-compilation environments
Flatbuffers contains a library and a schema compiler. The package contains cmake files to discover the libraries and the compiler tool. Currently, all of these cmake files are installed into the target sysroot. However, the compiler utility isn't installed into the sysroot (as it is not runnable on the build machine).
When an application that depends on flatbuffers gets built, it uses flatbuffers' exported cmake targets to configure the project. One of the exported targets is FlatcTarget.cmake which expects to see flatc binary in /usr/bin of the sysroot. Since binaries for target don't end up in target sysroot, cmake configuration fails.
This patch addresses this problem of flatbuffers' build infrastructure in cross-compiling environments. By removing FlatcTarget.cmake for target builds from the sysroot we essentially skip this step of flatbuffers' configuration.
--- meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +6 -1
@@ -25,12 +25,17 @@ BUILD_CXXFLAGS += "-fPIC" # BUILD_TYPE=Release is required, otherwise flatc is not installed EXTRA_OECMAKE += "\ -DCMAKE_BUILD_TYPE=Release \ - -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ " inherit cmake +rm_flatc_cmaketarget_for_target() { + rm -f "${SYSROOT_DESTDIR}/${libdir}/cmake/flatbuffers/FlatcTargets.cmake" +} +SYSROOT_PREPROCESS_FUNCS:class-target += "rm_flatc_cmaketarget_for_target" + do_install:append() { install -d ${D}${PYTHON_SITEPACKAGES_DIR} cp -rf ${S}/python/flatbuffers ${D}${PYTHON_SITEPACKAGES_DIR}
Signature · 1 line
2.25.1
Quoted 12 lines · BINDU
Flatbuffers contains a library and a schema compiler. The package contains cmake files to discover the libraries and the compiler tool. Currently, all of these cmake files are installed into the target sysroot. However, the compiler utility isn't installed into the sysroot (as it is not runnable on the build machine).
When an application that depends on flatbuffers gets built, it uses flatbuffers' exported cmake targets to configure the project. One of the exported targets is FlatcTarget.cmake which expects to see flatc binary in
/usr/binof the sysroot. Since binaries for target don't end up in target sysroot, cmake configuration fails.
Quoted 4 lines
This patch addresses this problem of flatbuffers' build infrastructure in cross-compiling environments. By removing FlatcTarget.cmake for target builds from the sysroot we essentially skip this step of flatbuffers' configuration.
Does this need to be done in Master as well?
-armin
Quoted 39 lines
Signed-off-by Ivan Stepic <[email protected]>Signed-off-by Bhabu Bindu <[email protected]>--- meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +6
-2@@ -25,12 +25,17 @@ BUILD_CXXFLAGS += "-fPIC" # BUILD_TYPE=Release is required, otherwise flatc is not installed EXTRA_OECMAKE += "\ -DCMAKE_BUILD_TYPE=Release \ - -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ " inherit cmake +rm_flatc_cmaketarget_for_target() { + rm -f "${SYSROOT_DESTDIR}/${libdir}/cmake/flatbuffers/FlatcTargets.cmake" +} +SYSROOT_PREPROCESS_FUNCS:class-target += "rm_flatc_cmaketarget_for_target" + do_install:append() { install -d ${D}${PYTHON_SITEPACKAGES_DIR} cp -rf ${S}/python/flatbuffers ${D}${PYTHON_SITEPACKAGES_DIR} -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#101976): https://lists.openembedded.org/g/openembedded-devel/message/101976
Mute This Topic: https://lists.openembedded.org/mt/98119685/3616698
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hello @[email protected] <[email protected]> ,
This is fixed in a different way in master, so this doesn't need to be be done for master.
Quoted 69 lines · On Fri, 7 Apr, 2023, 5:15 pm akuster808, <[email protected]> wrote:
Quoted 12 lines · BINDU
Flatbuffers contains a library and a schema compiler. The package contains cmake files to discover the libraries and the compiler tool. Currently, all of these cmake files are installed into the target sysroot. However, the compiler utility isn't installed into the sysroot (as it is not runnable on the build machine).
When an application that depends on flatbuffers gets built, it uses flatbuffers' exported cmake targets to configure the project. One of the exported targets is FlatcTarget.cmake which expects to see flatc binary in
/usr/binof the sysroot. Since binaries for target don't end up in target sysroot, cmake configuration fails.Quoted 4 lines
This patch addresses this problem of flatbuffers' build infrastructure in cross-compiling environments. By removing FlatcTarget.cmake for target builds from the sysroot we essentially skip this step of flatbuffers' configuration.
Does this need to be done in Master as well?
-armin
Review
Quoted 8 lines
Signed-off-by Ivan Stepic <[email protected]>Signed-off-by Bhabu Bindu <[email protected]>--- meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)(quoted diff) +0
-0b/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
Quoted 6 lines
index
bf74f1229..44478ea0b100644meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +0
-0@@ -25,12 +25,17 @@ BUILD_CXXFLAGS += "-fPIC" # BUILD_TYPE=Release is required, otherwise flatc is not installed EXTRA_OECMAKE += "\meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb BUILD_CXXFLAGS += "-fPIC" · line 35
Quoted 10 lines
meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +3
-1-DCMAKE_BUILD_TYPE=Release \ - -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ " inherit cmake +rm_flatc_cmaketarget_for_target() { + rm -f"${SYSROOT_DESTDIR}/${libdir}/cmake/flatbuffers/FlatcTargets.cmake"
meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb BUILD_CXXFLAGS += "-fPIC" · line 37
Quoted 2 lines
meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +2
-0+} +SYSROOT_PREPROCESS_FUNCS:class-target +="
rm_flatc_cmaketarget_for_target"Quoted 8 lines
meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +1
-1+ do_install:append() { install -d ${D}${PYTHON_SITEPACKAGES_DIR} cp -rf ${S}/python/flatbuffers ${D}${PYTHON_SITEPACKAGES_DIR} -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group. View/Reply Online (#101976):
https://lists.openembedded.org/g/openembedded-devel/message/101976
Quoted 3 lines
Mute This Topic: https://lists.openembedded.org/mt/98119685/3616698
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [Quoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 3 lines · BINDU
Hello @[email protected] <mailto:[email protected]> ,
This is fixed in a different way in master, so this doesn't need to be be done for master.
thanks for checking.
- armin
Quoted 87 lines · On Fri, 7 Apr, 2023, 5:15 pm akuster808, <[email protected]> wrote:
On 4/7/23 12:38 AM, BINDU wrote:
> Flatbuffers contains a library and a schema compiler. The package
> contains cmake files to discover the libraries and the compiler
tool.
> Currently, all of these cmake files are installed into the target
> sysroot. However, the compiler utility isn't installed into the
sysroot
> (as it is not runnable on the build machine).
>
> When an application that depends on flatbuffers gets built, it uses
> flatbuffers' exported cmake targets to configure the project.
One of the
> exported targets is FlatcTarget.cmake which expects to see flatc
binary
> in /usr/bin of the sysroot. Since binaries for target don't end
up in
> target sysroot, cmake configuration fails.
>
> This patch addresses this problem of flatbuffers' build
infrastructure
> in cross-compiling environments. By removing FlatcTarget.cmake for
> target builds from the sysroot we essentially skip this step of
> flatbuffers' configuration.
Does this need to be done in Master as well?
-armin
>
> Signed-off-by: Ivan Stepic <[email protected]>
> Signed-off-by: Bhabu Bindu <[email protected]>
> ---
> meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
<http://flatbuffers_2.0.0.bb> | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git
a/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
<http://flatbuffers_2.0.0.bb>
b/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
<http://flatbuffers_2.0.0.bb>
> index bf74f1229..44478ea0b 100644
> --- a/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
<http://flatbuffers_2.0.0.bb>
> +++ b/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb
<http://flatbuffers_2.0.0.bb>
> @@ -25,12 +25,17 @@ BUILD_CXXFLAGS += "-fPIC"
> # BUILD_TYPE=Release is required, otherwise flatc is not installed
> EXTRA_OECMAKE += "\
> -DCMAKE_BUILD_TYPE=Release \
> - -DFLATBUFFERS_BUILD_TESTS=OFF \
> + -DFLATBUFFERS_BUILD_TESTS=OFF \
> -DFLATBUFFERS_BUILD_SHAREDLIB=ON \
> "
>
> inherit cmake
>
> +rm_flatc_cmaketarget_for_target() {
> + rm -f
"${SYSROOT_DESTDIR}/${libdir}/cmake/flatbuffers/FlatcTargets.cmake"
> +}
> +SYSROOT_PREPROCESS_FUNCS:class-target +=
"rm_flatc_cmaketarget_for_target"
> +
> do_install:append() {
> install -d ${D}${PYTHON_SITEPACKAGES_DIR}
> cp -rf ${S}/python/flatbuffers ${D}${PYTHON_SITEPACKAGES_DIR}
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#101976):
https://lists.openembedded.org/g/openembedded-devel/message/101976
> Mute This Topic: https://lists.openembedded.org/mt/98119685/3616698
> Group Owner: [email protected]
<mailto:openembedded-devel%[email protected]>
> Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub
[[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>