Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when cross compiling using cross build #929

Open
Danvil opened this issue Oct 1, 2023 · 7 comments
Open

Error when cross compiling using cross build #929

Danvil opened this issue Oct 1, 2023 · 7 comments

Comments

@Danvil
Copy link

Danvil commented Oct 1, 2023

When cross-compiling a program using prost with cross I get the following error:

 Error: Custom { kind: Other, error: "protoc failed: " }

Host: Windows
Target: aarch64-unknown-linux-gnu
Cross configured to use podman

@crazystylus
Copy link

Hi @Danvil ,
Can you share your Cross.toml?

I am able to using Cross and Prost and cross compile to various architectures. Here's a link to Cross.toml from one of my repo.

@Danvil
Copy link
Author

Danvil commented Oct 2, 2023

Thank you that reference helped!

I added "apt install -y protobuf-compiler", to my Cross.toml, but now I get this error:

Error: Custom { kind: Other, error: "protoc failed: foo.proto:5:10: Unrecognized syntax identifier \"proto3\". This parser only recognizes \"proto2\".\n" }

Full Cross.toml:

[target.aarch64-unknown-linux-gnu]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install -y pkg-config libudev-dev:$CROSS_DEB_ARCH",
    "apt install -y protobuf-compiler",
]

@Danvil Danvil changed the title Support cross build Error when cross compiling using cross build Oct 2, 2023
@crazystylus
Copy link

crazystylus commented Oct 2, 2023 via email

@Danvil
Copy link
Author

Danvil commented Oct 2, 2023

"main" seems to provide a newer version of protobuf, but unfortunately it is still too old. My protos use optional and need at least v3.15 (version from early 2021). I guess this issue is not directly related to prost though. I will play around with the cross setup to maybe manually download a newer version.

@caspermeijn
Copy link
Collaborator

@Danvil Has this been resolved? Can you share the solution and close this issue?

@Danvil
Copy link
Author

Danvil commented Feb 14, 2024

@caspermeijn I resolved the issue but unfortunately I don't quite remember exactly how.

I did add this line to my Cross.toml:

image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"

Manually specifying an image might have pulled a newer version of the protobuf compiler.

@caspermeijn
Copy link
Collaborator

@Danvil Could you close the issue, now that it is resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants