OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Oct 17, 2017 7:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Help] Meaty skeleton won't compile "cannot stat crtbegin.o"
PostPosted: Tue May 16, 2017 11:19 am 
Offline
User avatar

Joined: Wed May 10, 2017 1:54 pm
Posts: 9
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.

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


Top
 Profile  
 
 Post subject: Re: [Help] Meaty skeleton won't compile "cannot stat crtbegi
PostPosted: Tue May 16, 2017 12:46 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 286
Location: Germany
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
Code:
/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?

_________________
OSDev Discord
vineyard, a x86 OS.


Top
 Profile  
 
 Post subject: Re: [Help] Meaty skeleton won't compile "cannot stat crtbegi
PostPosted: Sat May 20, 2017 3:06 am 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 920
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
Quote:
$(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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group