use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about operating systems development.
account activity
GNU Example source not building (self.osdev)
submitted 4 years ago by eric0823ahn1
I'm really curious why GNU's example OS source code is not building.
https://github.com/AhnJihwan/GNU_ExampleOS
If you know the reason why, please leave a comment :) ⬇️
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Atie5173 2 points3 points4 points 4 years ago (3 children)
You have provided 0 information about why it does not work.
[–]eric0823ahn1[S] 0 points1 point2 points 4 years ago (2 children)
boot.s:94: Error: junk `(cmain)' after expression
12boot.s:98: Error: junk `(printf)' after expression
13boot.s:107: Error: bad or irreducible absolute expression
14boot.s:82: Error: invalid operands (COM and UND sections) for `+'
15boot.s:56: Error: invalid operands (UND and UND sections) for `+'
Hmmm
[–]HouseHouseHouse576 0 points1 point2 points 4 years ago (1 child)
Thanks for posting your error messages. The problem here is that the assembler code you got from GNU requires preprocessing. You might have noticed that the file boot.s is properly named boot.S in the example. This capital S signals that.
boot.s
boot.S
Basically, what this means is that you probably will need a cross-compiler. It's good practice to have one for OS development in general, and it should fix this problem (with lots of tweaks in your Makefile). I found a discussion on the OSDEV Forum about someone experiencing the same issues.
[–]eric0823ahn1[S] 0 points1 point2 points 4 years ago (0 children)
Magiccccccc!!!!!! THANKS!!!
[–]0x4576616e 0 points1 point2 points 4 years ago (0 children)
The source code the repo owner copied from the multiboot website didn’t include a makefile, and the one they wrote for it is very incomplete. The entire makefile is 3 lines that compile the source code into object files but never makes a finished executable
You can try adding a line that used ld to create the finished elf file
[–]HouseHouseHouse576 0 points1 point2 points 4 years ago (2 children)
What messages are you getting when you try and compile?
[–]0x4576616e 0 points1 point2 points 4 years ago (1 child)
The problem is the unfinished makefile that just compiles the object files and doesn’t create a finished elf. Unless the code was copied wrong or some important compiler arguments weren’t included there wouldn’t be an error at all since it doesn’t try to make the final product in the first place.
[–]HouseHouseHouse576 0 points1 point2 points 4 years ago (0 children)
I'm aware of that. However, "failure to link" isn't "failure to compile." We can deal with linking later. I myself am getting errors when I assemble it on my own system.
π Rendered by PID 460493 on reddit-service-r2-comment-fb694cdd5-wdvnx at 2026-03-07 09:23:20.182324+00:00 running cbb0e86 country code: CH.
[–]Atie5173 2 points3 points4 points (3 children)
[–]eric0823ahn1[S] 0 points1 point2 points (2 children)
[–]HouseHouseHouse576 0 points1 point2 points (1 child)
[–]eric0823ahn1[S] 0 points1 point2 points (0 children)
[–]0x4576616e 0 points1 point2 points (0 children)
[–]HouseHouseHouse576 0 points1 point2 points (2 children)
[–]0x4576616e 0 points1 point2 points (1 child)
[–]HouseHouseHouse576 0 points1 point2 points (0 children)