-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't make on Mac OS X 10.8 #2
Comments
Which version of nasm do you have? The manual states that |
@Overv my nasm version: MineAssemble|master ⇒ nasm -v
NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Aug 4 2012 |
@drakmail I'm afraid you'll have to find a way to update NASM on OSX, because it seems incredibly out-of-date:
|
With nasm from MineAssemble|master ⇒ /usr/local/Cellar/nasm/2.10.07/bin/nasm -v
NASM version 2.10.07 compiled on Jun 18 2013 MineAssemble|master⚡ ⇒ make
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/init.o src/init.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/interrupts.o src/interrupts.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/vga.o src/vga.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/main.o src/main.asm -isrc/
gcc -m32 -c -g -o bin/reference.o src/reference.c -std=c99 -ffreestanding -Ofast -nostdlib -nostdinc -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-stack-protector -static -fno-pic
cc1: error: invalid option argument ‘-Ofast’
make: *** [bin/reference.o] Error 1 Now something is wrong with gcc :) |
You can substitute |
Almost done: MineAssemble|master⚡ ⇒ make
gcc -m32 -c -g -o bin/reference.o src/reference.c -std=c99 -ffreestanding -O3 -ffast-math -nostdlib -nostdinc -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-stack-protector -static -fno-pic
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/textures.o src/textures.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/cmath.o src/cmath.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/splash.o src/splash.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/world.o src/world.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/player.o src/player.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/input.o src/input.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/graphics.o src/graphics.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -felf -o bin/globals.o src/globals.asm -isrc/
ld -m elf_i386 -T src/link.ld -o bin/mineassemble.bin bin/init.o bin/interrupts.o bin/vga.o bin/main.o bin/reference.o bin/textures.o bin/cmath.o bin/splash.o bin/world.o bin/player.o bin/input.o bin/graphics.o bin/globals.o
ld: warning: option -m is obsolete and being ignored
ld: file not found: elf_i386
make: *** [bin/mineassemble.bin] Error 1 |
From some searching around the internet, it seems like the OSX version of Try changing |
Another error... and MineAssemble|master⚡ ⇒ make
mkdir -p bin
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/init.o src/init.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/interrupts.o src/interrupts.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/vga.o src/vga.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/main.o src/main.asm -isrc/
gcc -m32 -c -g -o bin/reference.o src/reference.c -std=c99 -ffreestanding -O3 -ffast-math -nostdlib -nostdinc -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-stack-protector -static -fno-pic
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/textures.o src/textures.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/cmath.o src/cmath.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/splash.o src/splash.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/world.o src/world.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/player.o src/player.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/input.o src/input.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/graphics.o src/graphics.asm -isrc/
/usr/local/Cellar/nasm/2.10.07/bin/nasm -f macho -o bin/globals.o src/globals.asm -isrc/
ld -arch i386 -T src/link.ld -o bin/mineassemble.bin bin/init.o bin/interrupts.o bin/vga.o bin/main.o bin/reference.o bin/textures.o bin/cmath.o bin/splash.o bin/world.o bin/player.o bin/input.o bin/graphics.o bin/globals.o
ld: unknown option: -T
make: *** [bin/mineassemble.bin] Error 1 |
I'm afraid then that the OSX version of |
I'll try ld from the brew soon. |
@drakmail Any luck? |
@Overv couldn't find |
@drakmail I'm afraid then that this is a case where OSX simply doesn't offer the tools for a niche use case like this. When I worked on my MacBook on this, I used a Linux VPS to compile :V |
Well, that really sucks. OS X is the only *NIX machine I have consistent access to. I want to try this... I might just fork the problem and see if I can get it working. |
@drakmail, @SevenBits . You should be able to build this using any operating system that can run GNU GCC and GNU Binutils, including Mac OS X. You can not use Mac OS X's ld linker, because it produces wrong kind of binaries. You have to build a cross-compiler toolchain. GNU ld is a part of GNU binutils. You need to build GNU binutils and GNU gcc cross compiler from source (./configure --target=i686-pc-elf or x86_64-pc-elf something like this) to be able to build. @Overv You must use a cross compiler to build kernel images like this. Using the gcc that is shipped with your OS may cause failures in subtle ways. For example, I had some problems building @rikusalminen/danjeros, a toy kernel image with the compiler shipped in Ubuntu, even though I was building for the same cpu arch as I was running on. Unfortunately, I can't remember the problem but the solution was using a cross compiler (I spent a lot of time debugging this problem). You should change the Makefile to explicitly use i686-pc-elf-gcc and i686-pc-elf-ld instead of plain ld and gcc. More info: http://wiki.osdev.org/GCC_Cross-Compiler |
@rikusalminen That makes sense and may even explain the problems I've had running the program on other computers than my own. I'll get on it. |
@Overv I built a i686-pc-elf toolchain from source and built and tested MineAssemble with it. Works like a charm. I changed the Makefile to use i686-pc-elf-ld and i686-pc-elf-gcc explicitly. Here's how to build the toolchain. Takes about an hour or two on a decent computer.
@drakmail, @SevenBits . These instructions above should work for OSX too, but you'll have to install the prerequisites from brew instead of apt-get or compile them from source. Alternatively, you can investigate if brew provides a way to install GCC and binutils cross toolchains (for i686-pc-elf target). |
@SevenBits sure go ahead and use crosstool-ng, it probably works. |
The text was updated successfully, but these errors were encountered: