[Help] Meaty skeleton won't compile "cannot stat crtbegin.o"
Page 1 of 1

Author:  Sophite [ Tue May 16, 2017 11:19 am ]
Post subject:  [Help] Meaty skeleton won't compile "cannot stat crtbegin.o"

After adding a bunch of stuff to libc and after fixing a bunch of crap on OSX to get stuff to work, I run into this.

cp: cannot stat 'crtbegin.o': No such file or directory
make: *** [Makefile:60: arch/i386/crtbegin.o] Error 1

Tested on unmodified git cloned meaty skeleton, same result.

Author:  no92 [ Tue May 16, 2017 12:46 pm ]
Post subject:  Re: [Help] Meaty skeleton won't compile "cannot stat crtbegi

Stating the obvious: the file is missing, i.e. not at the path Make expects it to be.

My crystal ball tells me that you either forgot the rules to find and copy the file or messed up your gcc call.

To help us out, what is printed when you run
/path/to/your/cross/gcc $(CFLAGS) -print-file-name=crtbegin.o

and what is your Makefile rule to get the crt[begin|end].o files?

EDIT: Meaty Skeleton compiles and appears to work flawlessly on my box. I'm running an i686-elf-gcc, version 7.1.0, compiled from source. IIRC gcc on macOS is actually a symlink to clang. Make sure you're actually using a gcc. If you're running gcc, what version are you on?

Author:  sortie [ Sat May 20, 2017 3:06 am ]
Post subject:  Re: [Help] Meaty skeleton won't compile "cannot stat crtbegi

Hi, I wrote that example operating system.

You've got to specify a lot of more information if you want help. For instance, what exactly you did to get it working on OS X, whether you are using a cross-compiler, how you are invoking the build script, a copy of the entire shell history for a session that reproduces this issue (and most importantly shows the make output).

The code in question should be
$(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o:
OBJ=`$(CC) $(CFLAGS) $(LDFLAGS) -print-file-name=$(@F)` && cp "$$OBJ" $@

Since $@ will expand to arch/i386/crtbegin.o, the cp command will have to be ”cp crtbegin.o arch/i386/crtbegin.o” to trigger the error you have. That means $(CC) $(CFLAGS) $(LDFLAGS) -print-file-name=crtbegin.o expanded to crtbegin.o. In other words, your compiler failed to locate a crtbegin.o.

I will guess that you are either not using a cross-compiler (and you need to do that), or you forgot to build libgcc as part of your cross-compiler build. You will need to read and follow the instructions at http://wiki.osdev.org/GCC_Cross-Compiler very carefully.

Note that Meaty Skeleton is not supported for OS X. It's just an example, so I have cut away OS X support as OS X fails at many basic Unix things that would unnecessarily complicate things. It is more BSD friendly as of late, but there's still some ways to go there I think. I need to revise it to keep up more with my current recommendations. I hope it's of use to you.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group