0

I've been trying to cross compile the source code to build GCC 12.2.0 for my RaspberryPi 4 B running Ubuntu 22.04. SO far I've tried doing this while configuring the project:

../gcc-12.2.0/configure --build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu --enable-languages=c,c++ --prefix-path=/opt/cross/gcc-12.2.0/build_aarch64 --disable-multilib 

But this does not work, as when I'm building the project using make, the bootstrapping phase gives me a bunch of errors related to zstd.

undefined reference to `ZSTD_getErrorName' undefined reference to `ZSTD_isError' undefined reference to `ZSTD_compress' undefined reference to `ZSTD_getErrorName' ... (you get it) 

How do I go about solving this? Am I doing something wrong configuring my project? I've been looking at this from just straight up searching my error: https://github.com/crosstool-ng/crosstool-ng/issues/1613, but it seems like scuffing it a bit, right?

Would appreciate your help, guys.

9
  • Is there a particular reason you’re trying to compile this yourself, rather than use the g++-12-aarch64-linux-gnu cross-compiler package? Commented Jun 1, 2024 at 8:10
  • That's based on GCC 12.3.0, right? I'm looking for something that's specifically GCC 12.2.0. Commented Jun 1, 2024 at 15:45
  • What is different in this snippet compared to e.g. Musl-LFS are the different parameters for --build and --host, which in Musl-LFS are equal, and the lack of --target. The original LFS has only --target in the first step, and --host equal to --target in the second step Commented Jun 1, 2024 at 16:41
  • Also, are you sure the aarch64-linux-gnu is the correct triplet? LFS contains a section on "system triplets", which should actually consist of four parts. Commented Jun 1, 2024 at 17:06
  • @Vilinkameni the triplet is fine, but your point about the arguments is a good one — it all depends on whether the goal is to cross-compile a native ARM64 compiler, or compile an x86-to-ARM64 cross-compiler. Commented Jun 1, 2024 at 19:24

1 Answer 1

0

Since you’re trying to cross-compile a native ARM64 compiler, you need to install the required libraries and development files for ARM64. On Ubuntu, the easiest way to do this is to enable arm64:

sudo dpkg --add-architecture arm64 sudo apt update 

Then you’ll be able to install libraries using :arm64:

sudo apt install libzstd-dev:arm64 

You’ll need to repeat that with any other library needed to build GCC.

2
  • Great idea. Let me try. Commented Jun 2, 2024 at 21:46
  • Now I'm getting some Assembler errors, no such architecture armv8, ... Which library should I install here? Commented Jun 3, 2024 at 1:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.