OSDev.org
https://forum.osdev.org/

make: i686-elf-gcc: Command not found (error 127)
https://forum.osdev.org/viewtopic.php?f=1&t=33465
Page 1 of 1

Author:  DaviUnic [ Sun Jan 27, 2019 11:04 am ]
Post subject:  make: i686-elf-gcc: Command not found (error 127)

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:

Quote:
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.

Author:  MichaelPetch [ Sun Jan 27, 2019 11:55 am ]
Post subject:  Re: make: i686-elf-gcc: Command not found (error 127)

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.

Author:  DaviUnic [ Sun Jan 27, 2019 12:56 pm ]
Post subject:  Re: make: i686-elf-gcc: Command not found (error 127)

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. :)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/