The errors begin with:

1658341606.638177021: src/main/tools/linux-sandbox-pid1.cc:481: child 
started with PID 2 
bazel-out/host/bin/external/com_github_protocolbuffers_protobuf/_objs/protoc/main.o:
 
In function `google::protobuf::compiler::ProtobufMain(int, char**)': 
main.cc:(.text+0x24): undefined reference to 
`std::allocator<char>::allocator()' 
main.cc:(.text+0x38): undefined reference to 
`std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::basic_string(char const*, std::allocator<char> 
const&)' 
main.cc:(.text+0x4c): undefined reference to 
`std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::~basic_string()' 
main.cc:(.text+0x54): undefined reference to 
`std::allocator<char>::~allocator()' 
main.cc:(.text+0x64): undefined reference to 
`std::allocator<char>::allocator()'

I've tried setting --proto_toolchain_for_cc=//toolchains:cross, but it 
seems to make no difference - it doesn't even seem to try to rebuild the 
library when I change the proto_toolchain_for_cc variable, and using 
invalid values "works" fine.
On Tuesday, July 19, 2022 at 3:28:41 PM UTC-7 Jasper Swallen wrote:

> I have cross compilation set up in my bazel project to allow building with 
> multiple separate toolchains (currently x86-64 and cross compilation for 
> aarch64). As I understand it, protobuf officially supports aarch64. 
> However, compilation of @com_google_protobuf//:protobuf_python fails when 
> my cross-compiled toolchain is selected. Is there a proper way to handle 
> this? I would like to build either the correct protoc for this cross 
> compilation, or if that's not possible, disable the toolchain for just this 
> target (so that the protoc for this platform can be used).
>
> I currently select the toolchain with something like this in my .bazelrc:
> build:cross --crosstool_top=//toolchains:cross
> build:cross --cpu=arm
> build:cross --force_pic=true
>
> The errors I get come from the linker thinking that all the symbols are 
> undefined (even std library symbols).
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/9bc22ff6-7c8e-4d83-8171-74fc8788a35fn%40googlegroups.com.

Reply via email to