davidcallanan/os-series

Episode 1 - make command fails

rishikeshkchapekar opened this issue · 12 comments

Followed the tutorial word by word, also created a backup where I did a git pull on this repo to make sure I got everything right.

Followed all the commands prior to this one.

When inside root@825d74b91757:~/env, I ran make build-x86_64 and I'm getting this error:

make: *** No rule to make target 'build-x86_64'. Stop.

I'm not sure why so many people are getting this error.

The likely cause is that you entered the docker container in the wrong directory or you aren't creating the mount correctly.

Make sure you use the correct command for your operating system when entering the docker container:

  • Linux: docker run --rm -it -v "$pwd":/root/env myos-buildenv
  • MacOS: docker run --rm -it -v "$PWD":/root/env myos-buildenv
  • Windows (CMD): docker run --rm -it -v "%cd%":/root/env myos-buildenv
  • Windows (PowerShell): docker run --rm -it -v "${pwd}:/root/env" myos-buildenv

EDIT: This issue has been resolved with the following command for linux instead:

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

I'm using Linux (Ubuntu 16).

I checked the directory, it seems to be the correct one.
The structure for the project:

ostutorial
├── buildenv
│   └── Dockerfile
├── Makefile
├── README.md
├── src
│   └── impl
│   └── x86_64
│   └── boot
│   ├── header.asm
│   └── main.asm
└── targets
└── x86_64
├── iso
│   └── boot
│   └── grub
│   └── grub.cfg
└── linker.ld

When inside ostutorial (same directory as the Makefile), I ran docker run --rm -it -v "$pwd":/root/env myos-buildenv , which then opened the container:

root@eafa593e2677:~/env#

check line4 of makefile , should be
$(x86_64_asm_object_files): build/x86_64/%.o : src/impl/x86_64/%.asm

Well, it worked for me on Windows, but not on Linux. I think it might be the directory stuff, or rather the .PHONY: build-x86_64 command itself in the Makefile.

EDIT: change "$pwd" to "$PWD"

I have this same issue on Ubuntu 20.10

.
├── buildenv
│ └── Dockerfile
├── Makefile
├── src
│ └── impl
│ └── x86_64
│ └── boot
│ ├── header.asm
│ └── main.asm
└── targets
└── x86_64
├── iso
│ └── boot
│ └── grub
│ └── grub.cfg
└── linker.ld

I think it is $PWD in general for linux and macos.

pwd is just the shell command to get the current directory.
In that case one should use pwd in the docker command.

Thanks all, these 2 both work for Ubuntu 2004:
docker run --rm -it -v "`pwd`":/root/env myos-buildenv
and
docker run --rm -it -v "$PWD":/root/env myos-buildenv

Yes, thanks. It works now

Thank you all for finding out the problem and solution.

Im getting a error on when I run make build-x86_64. The whole response is
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:13: recipe for target 'build-x86_64' failed make: *** [build-x86_64] Error 1

Focus on the last lines, specifically the no input files part.

I'm not sure what that error is all about. Can you send me an exact copy of your Makefile along with details about your OS.

@davidcallanan
I seem to be having an issue getting the make file to run fully

root@b9f27593f01f:~/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  
x86_64-elf-ld: no input files
Makefile:10: recipe for target 'build-x86_64' failed
make: *** [build-x86_64] Error 1
root@b9f27593f01f:~/env#