cfenollosa / os-tutorial

How to create an OS from scratch
BSD 3-Clause "New" or "Revised" License
27.24k stars 3.3k forks source link

Building in linux - Target-Libgcc #43

Open lcnvdl opened 6 years ago

lcnvdl commented 6 years ago

Hello. I'm following the steps from: 11-kernel-crosscompiler

I've installed successfully binutils following your steps. But I'm having problems installing GCC:

In the step: make all-target-libgcc

I'm getting the next error: /tmp/ccP9qmbP.s:15: Error: invalid instruction suffix for push' /tmp/ccP9qmbP.s:45: Error: invalid instruction suffix forpop'

I was reading, and I found that is because of the instructions. I don't know how to force to 32 bits mode.

Details: make[2]: se sale del directorio '/tmp/src/gcc-build/i386-elf/libgcc' /tmp/src/gcc-build/./gcc/xgcc -B/tmp/src/gcc-build/./gcc/ -B/usr/local/i386elfgcc/i386-elf/bin/ -B/usr/local/i386elfgcc/i386-elf/lib/ -isystem /usr/local/i386elfgcc/i386-elf/include -isystem /usr/local/i386elfgcc/i386-elf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fpic -I. -I. -I../.././gcc -I../../../gcc-8.1.0/libgcc -I../../../gcc-8.1.0/libgcc/. -I../../../gcc-8.1.0/libgcc/../gcc -I../../../gcc-8.1.0/libgcc/../include -DUSE_EMUTLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-8.1.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS /tmp/ccP9qmbP.s: Assembler messages: /tmp/ccP9qmbP.s:15: Error: invalid instruction suffix for push' /tmp/ccP9qmbP.s:45: Error: invalid instruction suffix forpop' Makefile:494: recipe for target '_muldi3.o' failed make[1]: [_muldi3.o] Error 1 make[1]: se sale del directorio '/tmp/src/gcc-build/i386-elf/libgcc' Makefile:11670: recipe for target 'all-target-libgcc' failed make: [all-target-libgcc] Error 2

ThatSimplex commented 6 years ago

I had to sue i686-elf libraries instead and that worked for me without problems, so I would use that if not anyone actually have a solution for it so that you can use i386

TravorLZH commented 6 years ago

I suggest you to build gcc-5.2.0 that can be built without any interruptions

Menotdan commented 6 years ago

@Futseh thats what i did

Menotdan commented 5 years ago

@Futseh I wonder if its because we use a 64bit enviroment?

Matthiasclee commented 4 years ago

I had problems with the whole thing and just installed everything via homebrew on my mac I then installed i386-elf-toolchain tap with homebrew like this: brew tap nativeos/i386-elf-toolchain brew install i386-elf-binutils i386-elf-gcc

TravorLZH commented 4 years ago

I had problems with the whole thing and just installed everything via homebrew on my mac I then installed i386-elf-toolchain tap with homebrew like this: brew tap nativeos/i386-elf-toolchain brew install i386-elf-binutils i386-elf-gcc

What you have installed from HomeBrew may not have the same configurations as that which this repo uses. I guess this tutorial could help you fix the problem.