Page 1 of 1

Cross-Compiler Build Error: No rule to make target 'install'

Posted: Thu Jul 23, 2020 3:52 pm
by GameDungeon
I am a new OS dev (I have been programming for a while now though), and I've come across some errors. I've checked the form for this error, but have not found any good info on it.

OS: 20.04 LTS

I started with: https://wiki.osdev.org/GCC_Cross-Compiler

GCC: gcc-10.2.0
binutils: binutils-2.34

I built Binutils fine, but on running make install-target-libgcc I got this error:

Code: Select all

test@test-VirtualBox:~/scr/build-gcc$ make install-target-libgcc
/bin/bash ../gcc-10.2.0/mkinstalldirs /home/test/opt/cross /home/test/opt/cross
make[1]: Entering directory '/home/test/scr/build-gcc/i686-elf/libgcc'
make[1]: *** No rule to make target 'install'.  Stop.
make[1]: Leaving directory '/home/test/scr/build-gcc/i686-elf/libgcc'
make: *** [Makefile:12782: install-target-libgcc] Error 2

Re: Cross-Compiler Build Error: No rule to make target 'inst

Posted: Wed Jul 29, 2020 9:03 pm
by Octocontrabass
What other commands did you run up to this point? It sounds like you might have missed one, or typed something wrong.

Re: Cross-Compiler Build Error: No rule to make target 'inst

Posted: Thu Jul 30, 2020 7:42 am
by Schol-R-LEA
One thing I will recommend is to write a shell script for building the cross-compiler, as it is something you may need to do more than once. While the process isn't excessively complicated, it is sufficiently involved that doing it manually is prone to errors.

I have two scripts, one for binutils and another for gcc, which I use to update and build not just a single instance but several, to allow me to target several different architectures. However, not only am I building more than most people would need, I am also drawing directly from the development repos, which can be a dicey proposition. You may want to write a script or scripts which suit your own needs better than mine would. I'll attach mine so you can go over them, but I would advise against using them as-is.

update-binutils.sh

Code: Select all

#!/bin/bash

HOME_DIR="/home/schol-r-lea"
BINUTILS_SRC="$HOME_DIR/Deployments/cross-dev-utils/binutils-gdb"
BINUTILS_BUILD="$BINUTILS_SRC/build"
DEST="$HOME_DIR/opt/cross"

cd $BINUTILS_SRC
git pull origin master

cd $BINUTILS_BUILD
for TARGET in "i686-elf" "x86_64-elf" \
"arm-none-eabi" "aarch64-none-elf" \
"riscv32-unknown-elf" "riscv64-unknown-elf" \
"mipsel" "mips64el" 
do
  TARGET_DIR="$BINUTILS_BUILD/$TARGET"
  if [ ! -d $TARGET_DIR ]; then
     mkdir -p $TARGET_DIR
  fi
  make distclean
  
  cd $TARGET_DIR
  $BINUTILS_SRC/configure --target=$TARGET --prefix=$DEST --with-sysroot --disable-nls --disable-werror
  make
  make install
done
update-gcc.sh

Code: Select all

#!/bin/bash

GCC_SRC="/home/schol-r-lea/Deployments/cross-dev-utils/gcc"
GCC_BUILD="$GCC_SRC/build"
DEST="/home/schol-r-lea/opt/cross"

cd $GCC_SRC
git pull origin master

cd $GCC_BUILD
for TARGET in "i686-elf" "x86_64-elf" \
"arm-none-eabi" "aarch64-none-elf" \
"riscv32-unknown-elf" "riscv64-unknown-elf" \
 "mipsel" "mips64el"
do
  TARGET_DIR="$GCC_BUILD/$TARGET"
  if [ ! -d $TARGET_DIR ]; then
     mkdir -p $TARGET_DIR
  fi

  cd $TARGET_DIR
  $GCC_SRC/configure --target=$TARGET --prefix=$DEST --disable-nls \
                     --enable-languages=objc,c,d,c++,go \
                     --without-headers
  make all-gcc
  make all-target-libgcc
  make install-gcc
  make install-target-libgcc
done

Re: Cross-Compiler Build Error: No rule to make target 'inst

Posted: Sat Aug 01, 2020 7:43 pm
by GameDungeon
I submitted this about a week ago, I have since fixed it. It was one of those things were randomly a compile does not work and if you compile it again it does.

Re: Cross-Compiler Build Error: No rule to make target 'inst

Posted: Sun Aug 02, 2020 4:32 am
by iansjack
GameDungeon wrote:It was one of those things were randomly a compile does not work and if you compile it again it does.
No, that just doesn't happen.

You did something different to make it work. In this case it doesn't probably matter what it was, but I wouldn't rely on that philosophy when developing your own applications. It's important to understand why problems are fixed rather than just relying on serendipity.