make: i686-elf-gcc: Command not found (error 127)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
DaviUnic
Posts: 9
Joined: Tue Aug 12, 2014 4:49 am

make: i686-elf-gcc: Command not found (error 127)

Post by DaviUnic »

So I've got meaty skeleton working before, then got rid of the VM, and now after some time, I thougt I'd play around again. Cross-compiled binutils 2.31 and gcc 8.2.0 with i686-elf target exactly as the tutorial said, no errors came up, gcc is in $HOME/opt/cross/bin and working, as I can compile bare bones just fine. But whenever I try to build meaty skeleton with the included scripts and makefile, I get the following error:
david@OSDev:~/src/meaty-skeleton$ sudo ./qemu.sh
[sudo] password for david:
mkdir -p /home/david/src/meaty-skeleton/sysroot/usr/include
cp -R --preserve=timestamps include/. /home/david/src/meaty-skeleton/sysroot/usr/include/.
mkdir -p /home/david/src/meaty-skeleton/sysroot/usr/include
cp -R --preserve=timestamps include/. /home/david/src/meaty-skeleton/sysroot/usr/include/.
mkdir -p /home/david/src/meaty-skeleton/sysroot/usr/include
cp -R --preserve=timestamps include/. /home/david/src/meaty-skeleton/sysroot/usr/include/.
i686-elf-gcc --sysroot=/home/david/src/meaty-skeleton/sysroot -isystem=/usr/include -MD -c stdio/printf.c -o stdio/printf.libk.o -std=gnu11 -O2 -g -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
make: i686-elf-gcc: Command not found
make: *** [Makefile:72: stdio/printf.libk.o] Error 127
I installed all the required packages (xorriso, qemu, grub), I followed the tutorial to the letter, I cloned the repo from gitlab, I tried moving the source around, but it's still not working. I ran "export PATH="$HOME/opt/cross/bin:$PATH"", $PATH gets properly set, I can call i686-elf-gcc directly and it works. Yet make apparently still can't find it.

Anyone got any ideas why this happens? I searched the forum for this and a few similar issues came up but nothing mentioned in those topics helped me solve this. This is on kubuntu 18.10 64-bit btw.
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: make: i686-elf-gcc: Command not found (error 127)

Post by MichaelPetch »

Probably because your root user doesn't have the environment variables set that your user account does. Does it work if you use sudo -E ./qemu.sh ? Might be easier to specify the full path of i686-elf-gcc inside your Makefile.
DaviUnic
Posts: 9
Joined: Tue Aug 12, 2014 4:49 am

Re: make: i686-elf-gcc: Command not found (error 127)

Post by DaviUnic »

MichaelPetch wrote:Probably because your root user doesn't have the environment variables set that your user account does. Does it work if you use sudo -E ./qemu.sh ? Might be easier to specify the full path of i686-elf-gcc inside your Makefile.
sudo -E didn't work, but it did lead me to find out the sysroot folder was owned by root, not me, which is why I had to run the script as root. It works now that I've changed the owner, which eliminates that requirement. Thanks for the help. :)
Post Reply