OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 28, 2017 7:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Installing GRUB2 onto Mac OS X. Getting weird flex error.
PostPosted: Sat Feb 25, 2017 12:51 am 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
I am trying to install GRUB2 on Mac OS X 10.12 so I can continue following the bare bones tutorial. To install it I am following the tutorial for Mac OS X on the os dev site. When I get to configure portion I copied down the command exactly and when I run it I get this:
Code:
checking build system type... x86_64-apple-darwin16.0.0
checking host system type... x86_64-apple-darwin16.0.0
checking target system type... i386-pc-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ../../grub-2.00/build-aux/install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for cmp... cmp
checking for bison... bison
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -ll
checking whether yytext is a pointer... yes
checking for bison... (cached) bison
checking whether make sets $(MAKE)... (cached) yes
checking whether ln -s works... yes
configure: error: flex is too old. GRUB requires 2.5.35 or above

How should I update flex or am I doing something else wrong? Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 2:55 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2722
Location: Chichester, UK
https://www.macports.org/ports.php?by=name&substr=flex


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 3:34 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 631
Location: Tallinn, Estonia
iansjack wrote:
https://www.macports.org/ports.php?by=name&substr=flex



You meant
Code:
brew install flex

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 5:42 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2722
Location: Chichester, UK
I've no desire to participate in a religious war about the best package manager for OS X. But I know what I meant.

Learn to read.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 11:00 am 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
So I installed it via homebrew (It's just a personal preference). It said:
Code:
Warning: flex-2.6.3 already installed, it's just not linked.

Now how do I link it so it can be used?


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 12:33 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 17, 2016 6:58 am
Posts: 29
Location: The Internet
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

_________________
Everyone should know how to program a computer, because it teaches you how to think! -Steve Jobs
Code:
while ( ! ( succeed = try() ) );


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 12:59 pm 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

I couldn't use anything different ;P


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sat Feb 25, 2017 1:02 pm 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

Also, I am having trouble setting up my toolchain and cross-compiler. Is there a way you could send me your toolchain (e.g. gcc, binutils, grub, etc.)? I would really appreciate it.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 3:37 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 249
Location: East Riding of Yorkshire, UK
HittmanA wrote:
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

Also, I am having trouble setting up my toolchain and cross-compiler. Is there a way you could send me your toolchain (e.g. gcc, binutils, grub, etc.)? I would really appreciate it.
You should really try to get it building on your own computer, eventually you will be wanting to build a compiler that targets your new operating system.

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Wiki
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 9:35 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 631
Location: Tallinn, Estonia
HittmanA wrote:
So I installed it via homebrew (It's just a personal preference). It said:
Code:
Warning: flex-2.6.3 already installed, it's just not linked.

Now how do I link it so it can be used?


It's keg only, `brew info flex` should show you the linker and include flags to use so it can be found by configure.

Alternatively, you may want to try `brew link flex`, maybe with a force flag

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 10:52 am 
Offline

Joined: Tue Jun 16, 2015 4:12 am
Posts: 1
Location: Arvika, Sweden
HittmanA wrote:
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

Also, I am having trouble setting up my toolchain and cross-compiler. Is there a way you could send me your toolchain (e.g. gcc, binutils, grub, etc.)? I would really appreciate it.

I've built a cross compiler targeting i686-elf for macOS. You can download it from http://files.malarhojden.nu/osdev-cross-0.tar.gz

It currently contains:

  • binutils 2.27
  • gcc 6.3.0 (only C at the moment).
  • xorriso 1.4.6
  • grub 2.02rc1

Extract in /usr/local and it will be installed to /usr/local/osdev-cross/. Add /usr/local/osdev-cross/bin to PATH and you can use i686-pc-gcc etc. to build your stuff.

If I have time and there is interest I could extend this to include more useful programs, like qemu, and languages, like C++.

Let me know if you have any issues.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 11:01 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 774
Location: Athens, GA, USA
Hold on for a moment: are you trying to build GRUB2 using your cross-compiler so you can install it into a disk image which you can run in an emulator or virtualizer, or are you trying to install it on the Mac itself? The way you said it sounds like the latter, and that is not recommended for OS development, especially if you are at the stage of working with the Bare Bones tutorial.

You generally don't want your OS running on bare hardware until you are much farther along, and even then, unless you are really confident in your OS, you generally don't want to multiboot it on the same system you are developing on. You can, if you want to - in the bad old days the usual process was to install it on a floppy and boot live - but given the availability emulators such as Bochs and virtualizers such as Virtualbox and QEMU, doing that as part of the general development process is going to be more trouble than it is worth. I recommend that you make sure it runs well in one or more emulators first, then test it booting into hardware using a separate boot disk.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 11:26 am 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
Schol-R-LEA wrote:
Hold on for a moment: are you trying to build GRUB2 using your cross-compiler so you can install it into a disk image which you can run in an emulator or virtualizer, or are you trying to install it on the Mac itself? The way you said it sounds like the latter, and that is not recommended for OS development, especially if you are at the stage of working with the Bare Bones tutorial.

You generally don't want your OS running on bare hardware until you are much farther along, and even then, unless you are really confident in your OS, you generally don't want to multiboot it on the same system you are developing on. You can, if you want to - in the bad old days the usual process was to install it on a floppy and boot live - but given the availability emulators such as Bochs and virtualizers such as Virtualbox and QEMU, doing that as part of the general development process is going to be more trouble than it is worth. I recommend that you make sure it runs well in one or more emulators first, then test it booting into hardware using a separate boot disk.

I am trying to use GRUB's command line tools so I can make my os.bin into an .iso that emu can run.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 11:26 am 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
dlundqvist wrote:
HittmanA wrote:
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

Also, I am having trouble setting up my toolchain and cross-compiler. Is there a way you could send me your toolchain (e.g. gcc, binutils, grub, etc.)? I would really appreciate it.

I've built a cross compiler targeting i686-elf for macOS. You can download it from http://files.malarhojden.nu/osdev-cross-0.tar.gz

It currently contains:

  • binutils 2.27
  • gcc 6.3.0 (only C at the moment).
  • xorriso 1.4.6
  • grub 2.02rc1

Extract in /usr/local and it will be installed to /usr/local/osdev-cross/. Add /usr/local/osdev-cross/bin to PATH and you can use i686-pc-gcc etc. to build your stuff.

If I have time and there is interest I could extend this to include more useful programs, like qemu, and languages, like C++.

Let me know if you have any issues.

Thank you! I will try installing this now.


Top
 Profile  
 
 Post subject: Re: Installing GRUB2 onto Mac OS X. Getting weird flex error
PostPosted: Sun Feb 26, 2017 11:38 am 
Offline

Joined: Fri Feb 24, 2017 6:51 pm
Posts: 10
dlundqvist wrote:
HittmanA wrote:
MajickTek wrote:
Finally I found someone who is developing on my OS of preference... My main computer is an iMac and I love developing on that thing <3

Also, I am having trouble setting up my toolchain and cross-compiler. Is there a way you could send me your toolchain (e.g. gcc, binutils, grub, etc.)? I would really appreciate it.

I've built a cross compiler targeting i686-elf for macOS. You can download it from http://files.malarhojden.nu/osdev-cross-0.tar.gz
~snip~

Thanks again! I just tested it out and I can now successfully compile my kernel.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 8 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