OSDev.org
https://forum.osdev.org/

Installing GRUB2 onto Mac OS X. Getting weird flex error.
https://forum.osdev.org/viewtopic.php?f=1&t=31386
Page 1 of 1

Author:  HittmanA [ Sat Feb 25, 2017 12:51 am ]
Post subject:  Installing GRUB2 onto Mac OS X. Getting weird flex error.

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!

Author:  iansjack [ Sat Feb 25, 2017 2:55 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

https://www.macports.org/ports.php?by=name&substr=flex

Author:  dozniak [ Sat Feb 25, 2017 3:34 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

iansjack wrote:
https://www.macports.org/ports.php?by=name&substr=flex



You meant
Code:
brew install flex

Author:  iansjack [ Sat Feb 25, 2017 5:42 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  HittmanA [ Sat Feb 25, 2017 11:00 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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?

Author:  MajickTek [ Sat Feb 25, 2017 12:33 pm ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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

Author:  HittmanA [ Sat Feb 25, 2017 12:59 pm ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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

Author:  HittmanA [ Sat Feb 25, 2017 1:02 pm ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  matt11235 [ Sun Feb 26, 2017 3:37 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  dozniak [ Sun Feb 26, 2017 9:35 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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

Author:  dlundqvist [ Sun Feb 26, 2017 10:52 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  Schol-R-LEA [ Sun Feb 26, 2017 11:01 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  HittmanA [ Sun Feb 26, 2017 11:26 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  HittmanA [ Sun Feb 26, 2017 11:26 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Author:  HittmanA [ Sun Feb 26, 2017 11:38 am ]
Post subject:  Re: Installing GRUB2 onto Mac OS X. Getting weird flex error

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/