Re: using grpc fails with linker error: file in wrong format


Khem Raj
 

On 5/24/21 12:37 AM, Juergen Landwehr wrote:
Hi all,
I am developing a C++ library that is using gRPC.
To be able to use protoc for generating the stubs I added the following dependencies:
DEPENDS += "\
grpc-native \
protobuf-native \
...
"
and to link my library with cross-compiled libraries:
RDEPENDS += "\
   grpc \
   protobuf \
   ...
   "
However, linking the library fails with the following error:
ld: /data/jenkins/workspace/e0_mbient_yocto_mbient_manifests_master_downstream/build/tmp/work/cortexa72-mbient-linux/tokenmaster-client/git-r0/recipe-sysroot-native/usr/lib/libgrpc++.so.1.24.3: error adding symbols: file in wrong format
I guess the problem is, that native grpc++ library is used from the "recipe-sysroot-native" directory and thus not the cross-compiled version.
What am I doing wrong? How can I tell Yocto to use the cross-compiled versions?
this is upto your component's build system, so perhaps you should look into that and ensure that its using right options. Second place to look is recipe for your package and ensure right vars and options are passed to build. you might want to look at sysdig package build system and see how they are doing it and perhaps mimic that for your package too.

Thanks,
Jürgen

Join yocto@lists.yoctoproject.org to automatically receive all group messages.