davidcallanan / os-series

818 stars 119 forks source link

make fails #2

Closed MoistCoder closed 3 years ago

MoistCoder commented 3 years ago

I didn't changed anything and runned the Dockerfile. (Im using Ubuntu Mate) I get this everytime:

mkdir -p build/kernel/ && \
x86_64-elf-gcc -c -I src/intf -ffreestanding  src/impl/kernel/main.c -o build/kernel/main.o
/bin/sh: 2: x86_64-elf-gcc: not found
make: *** [Makefile:13: build/kernel/main.o] Error 127
ajh123 commented 3 years ago

just do a quick check of Dockerfile, should be

FROM randomdude/gcc-cross-x86_64-elf

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nasm
RUN apt-get install -y xorriso
RUN apt-get install -y grub-pc-bin
RUN apt-get install -y grub-common

VOLUME /root/env
WORKDIR /root/env

Also try running x86_64-elf-gcc in the container's terminal if you get

x86_64-elf-gcc: fatal error: no input files
compilation terminated.

then it's a problem somewhere else

davidcallanan commented 3 years ago

Someone on YouTube told me that the docker image I am basing on has updated, I will look at this soon and try to patch this!

dh00mk3tu commented 3 years ago

I get this error

No rule to make target 'build-x86_64'

Screenshot_20210225_163952

ajh123 commented 3 years ago

Try ls ing on the terminal and check if all the files are there

dh00mk3tu commented 3 years ago

When I am in the Docker env and do bash ls, it shows nothing

ajh123 commented 3 years ago

You pwd variable is not set to the reop's root then Before you run docker check if it is by echo $pwd" if it is not set then set it toexport pwd=/path/to/repo/root```

Gadgeto commented 3 years ago

The best way is to use the correct command in the root dir of the project under Linux or Mac OS.

docker run --rm -it -v "$PWD":/root/env myos-buildenv

Gruß Frank

Am 25.02.2021 um 18:14 schrieb ajh123 notifications@github.com:

You pwd variable is not set to the reop's root then Before you run docker check if it is by echo $pwd" if it is not set then set it to export pwd=/path/to/repo/root```

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidcallanan/os-series/issues/2#issuecomment-786062101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM4U56ULQXZ3FMBV6YQTNDTA2AQJANCNFSM4XGYKRRQ.

dh00mk3tu commented 3 years ago

You pwd variable is not set to the reop's root then Before you run docker check if it is by echo $pwd" if it is not set then set it toexport pwd=/path/to/repo/root```

Am I supposed to set the path to my repository?

dh00mk3tu commented 3 years ago

Okay so I got it working but now I have a syntax error in my Makefile.

  1. The problem was that pwd variable wasn't set to the repo's root. I did it and restarted the terminal. Also, make sure "PWD" is capital. To check that your pwd is connected, use ls and if it displays the contents of your root dir. than it's working fine.

  2. I have an error in my Makefile so I'll copy the makefile from this repo and use it

jdodonoghue commented 3 years ago

this works for make error $ docker run --rm -it -v "C:\Users\Desktop 1":/root/env myos-buildenv

i had to move my project to the users folder, in my case "Desktop 1"

then

root@b95519893ab6:~/env# cd os-series-ep1

root@b95519893ab6:~/env/os-series-ep1# make build-x86_64

$ "C:\Program Files\qemu\qemu-system-x86_64.exe" -cdrom dist/x86_64/kernel.iso -L "C:\Program Files\qemu"

it seems that Docker can only see folders and files at this location. There probably is a way to configure Docker to see your C: \ drive, but I haven't found it yet.

AbhayPrajapati195 commented 3 years ago

i had to write it like $(pwd) to get it working. you have to figure out the way "echo " outputs the present working directory and then use it in the above command

TheShed412 commented 3 years ago

i had to write it like $(pwd) to get it working. you have to figure out the way "echo " outputs the present working directory and then use it in the above command

This is how you should bind the current directory as a volume for the container. https://docs.docker.com/storage/bind-mounts/

The command I used on linux was this: sudo docker run --rm -it -v "$(pwd)":/root/env myos-buildenv

Not sure if this would work on mac, but I'd imagine it would be the same.

ghost commented 3 years ago

hi i have this problem

root@e140e25685bb:~/env# make build-x86_64 mkdir -p dist/x86_64 && \ x86_64-elf-ld -n -o dist/x86_64/kernel.bin -T targets/x86_64/linker.ld && \ cp dist/x86_64/kernel.bin targets/x86_64/iso/boot/kernel.bin && \ grub-mkrescue /usr/lib/grub/i386-pc -o dist/x86_64/kernel.iso targets/x86_64/iso x86_64-elf-ld: no input files Makefile:10: recipe for target 'build-x86_64' failed make: *** [build-x86_64] Error 1

dh00mk3tu commented 3 years ago

hi i have this problem

root@e140e25685bb:~/env# make build-x86_64 mkdir -p dist/x86_64 && x86_64-elf-ld -n -o dist/x86_64/kernel.bin -T targets/x86_64/linker.ld && cp dist/x86_64/kernel.bin targets/x86_64/iso/boot/kernel.bin && grub-mkrescue /usr/lib/grub/i386-pc -o dist/x86_64/kernel.iso targets/x86_64/iso x86_64-elf-ld: no input files Makefile:10: recipe for target 'build-x86_64' failed make: *** [build-x86_64] Error 1

Do ls before making your OS using the makefile. You should see your directory. If you don't you need to set the directory for your $pwd.

Before you run your docker, try running echo pwd, it should show nothing. If it shows nothing then run this command export pwd=/path/of/repo/root

After running the command, try echoing pwd again and it should show the part to your root. Also, when you enter your docker now, check if the directory is connected by running ls in the docker.

MrEnder0 commented 3 years ago

On the last part when i type make build-x86_64 it says make: *** No rule to make target 'build-x86_64'. Stop. I dont know what to do to fix this and its the last step other then the qemu part.

raj-krishnan-r commented 3 years ago

On the last part when i type make build-x86_64 it says make: *** No rule to make target 'build-x86_64'. Stop. I dont know what to do to fix this and its the last step other then the qemu part.

This is because ''make' cannot find the 'makefile'. It happened in my case also since my location was wrong, which was set by the command sudo docker run --rm -it -v "$(pwd)":/root/env myos-buildenv. In my case when I changed the 'pwd' to 'PWD' it worked. So try this command : sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

LucasVChaves commented 3 years ago

This is because ''make' cannot find the 'makefile'. It happened in my case also since my location was wrong, which was set by the command sudo docker run --rm -it -v "$(pwd)":/root/env myos-buildenv. In my case when I changed the 'pwd' to 'PWD' it worked. So try this command : sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

I'm getting the same error as the other guy, I tried using your solution and it doesn't seam to work. Do you suggest any other way to fix it?

dh00mk3tu commented 3 years ago

This is because ''make' cannot find the 'makefile'. It happened in my case also since my location was wrong, which was set by the command sudo docker run --rm -it -v "$(pwd)":/root/env myos-buildenv. In my case when I changed the 'pwd' to 'PWD' it worked. So try this command : sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

I'm getting the same error as the other guy, I tried using your solution and it doesn't seam to work. Do you suggest any other way to fix it?

Hey can you please run ls when you're in the docker and share the output

LucasVChaves commented 3 years ago

Hey can you please run ls when you're in the docker and share the output

It shows nothing.

dh00mk3tu commented 3 years ago

Hey can you please run ls when you're in the docker and share the output

It shows nothing.

Okay so you're facing a very normal problem. You need to run this command: export pwd=/path/of/repo/root

Now, run sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

Notice the capital PWD.

Now again, run your Docker image and you should see your project directory

LucasVChaves commented 3 years ago

Okay so you're facing a very normal problem. You need to run this command: export pwd=/path/of/repo/root

Now, run sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

Notice the capital PWD.

Now again, run your Docker image and you should see your project directory

Okay, so I tried this and it didn't work, then I tried it again but using cmd instead of powershell and worked, so thx for the help <3

dh00mk3tu commented 3 years ago

Okay so you're facing a very normal problem. You need to run this command: export pwd=/path/of/repo/root Now, run sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv Notice the capital PWD. Now again, run your Docker image and you should see your project directory

Okay, so I tried this and it didn't work, then I tried it again but using cmd instead of powershell and worked, so thx for the help <3

Okay! Glad I could help. I assumed you're on Linux as well so I ignored the possibility that you could be on Windows as well. Anyway, Powershell isn't recommended for this. Try using or setting up WSL for better experience.

Kinar-Usha commented 3 years ago

Okay so I got it working but now I have a syntax error in my Makefile.

  1. The problem was that pwd variable wasn't set to the repo's root. I did it and restarted the terminal. Also, make sure "PWD" is capital. To check that your pwd is connected, use ls and if it displays the contents of your root dir. than it's working fine.
  2. I have an error in my Makefile so I'll copy the makefile from this repo and use it

sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

it didnt work for PWD but did work for pwd. Anyway this really helped.

dh00mk3tu commented 3 years ago

Okay so I got it working but now I have a syntax error in my Makefile.

  1. The problem was that pwd variable wasn't set to the repo's root. I did it and restarted the terminal. Also, make sure "PWD" is capital. To check that your pwd is connected, use ls and if it displays the contents of your root dir. than it's working fine.
  2. I have an error in my Makefile so I'll copy the makefile from this repo and use it

sudo docker run --rm -it -v "$(PWD)":/root/env myos-buildenv

it didnt work for PWD but did work for pwd. Anyway this really helped.

I really cannot figure why the problem with lowercase/uppercase PWD is happening to so many people. If I do manage to figure it out, I'll explain it here in this thread or raise another issue and answer it myself. Nonetheless, I'm glad I could help

davidcallanan commented 3 years ago

The solution for this issue is now being tracked in #39.