Скомпилируйте XV6 на MAC

macos makefile operating-system xv6

1744 просмотра

2 ответа

Перед компиляцией XV6 я прочитал эту страницу, чтобы создать свой собственный инструментарий компилятора. И результат похож.

➜  xv6-public git:(master) ✗ i386-jos-elf-objdump -i
BFD header file version (GNU Binutils) 2.27
elf32-i386
 (header little endian, data little endian)
  i386

➜  xv6-public git:(master) ✗ i386-jos-elf-gcc -v
Using built-in specs.
COLLECT_GCC=i386-jos-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-jos-elf/6.1.0/lto-wrapper
Target: i386-jos-elf
Configured with: ../configure --prefix=/usr/local --target=i386-jos-elf --disable-werror --disable-libssp --disable-libmudflap --with-newlib 

--without-headers --enable-languages=c CC=/usr/bin/gcc
    Thread model: single
    gcc version 6.1.0 (GCC)

Однако, когда я начинаю компилировать XV6, возникает ошибка:

  ➜  xv6-public git:(master) ✗ make
    i386-jos-elf-gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -fvar-tracking -fvar-tracking-assignments -O0 -g -Wall -MD -gdwarf-2 -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pic -O -nostdinc -I. -c bootmain.c
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:5:2: error: unknown directive
            .type   waitdisk, @function
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:11:2: error: instruction requires: Not 64-bit mode
            pushl   %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:26:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:27:1: error: unexpected token at start of statement
    /  8 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:29:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:31:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:39:2: error: instruction requires: Not 64-bit mode
            popl    %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:46:2: error: unknown directive
            .size   waitdisk, .-waitdisk
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:48:2: error: unknown directive
            .type   readsect, @function
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:54:2: error: instruction requires: Not 64-bit mode
            pushl   %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:61:2: error: instruction requires: Not 64-bit mode
            pushl   %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:62:2: error: instruction requires: Not 64-bit mode
            pushl   %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:74:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:75:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:77:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:79:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:86:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:87:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:89:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:91:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:101:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:102:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:104:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:106:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:116:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:117:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:119:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:121:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:132:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:133:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:135:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:137:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:144:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:145:1: error: unexpected token at start of statement
    /  24 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:147:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:149:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:161:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:162:1: error: unexpected token at start of statement
    /  15 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:164:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:166:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:170:2: error: instruction requires: Not 64-bit mode
            popl    %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:172:2: error: instruction requires: Not 64-bit mode
            popl    %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:174:2: error: instruction requires: Not 64-bit mode
            popl    %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:181:2: error: unknown directive
            .size   readsect, .-readsect
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:183:2: error: unknown directive
            .type   readseg, @function
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:189:2: error: instruction requires: Not 64-bit mode
            pushl   %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:196:2: error: instruction requires: Not 64-bit mode
            pushl   %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:197:2: error: instruction requires: Not 64-bit mode
            pushl   %esi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:198:2: error: instruction requires: Not 64-bit mode
            pushl   %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:222:2: error: instruction requires: Not 64-bit mode
            pushl   %esi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:223:2: error: instruction requires: Not 64-bit mode
            pushl   %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:237:2: error: instruction requires: Not 64-bit mode
            popl    %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:240:2: error: instruction requires: Not 64-bit mode
            popl    %esi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:243:2: error: instruction requires: Not 64-bit mode
            popl    %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:246:2: error: instruction requires: Not 64-bit mode
            popl    %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:253:2: error: unknown directive
            .size   readseg, .-readseg
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:255:2: error: unknown directive
            .type   bootmain, @function
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:260:2: error: instruction requires: Not 64-bit mode
            pushl   %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:267:2: error: instruction requires: Not 64-bit mode
            pushl   %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:268:2: error: instruction requires: Not 64-bit mode
            pushl   %esi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:269:2: error: instruction requires: Not 64-bit mode
            pushl   %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:276:2: error: instruction requires: Not 64-bit mode
            pushl   $0
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:277:2: error: instruction requires: Not 64-bit mode
            pushl   $4096
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:278:2: error: instruction requires: Not 64-bit mode
            pushl   $65536
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:288:2: error: instruction requires: Not 64-bit mode
            popl    %ebx
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:291:2: error: instruction requires: Not 64-bit mode
            popl    %esi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:293:2: error: instruction requires: Not 64-bit mode
            popl    %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:295:2: error: instruction requires: Not 64-bit mode
            popl    %ebp
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:333:2: error: instruction requires: Not 64-bit mode
            pushl   4(%ebx)
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:334:2: error: instruction requires: Not 64-bit mode
            pushl   16(%ebx)
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:335:2: error: instruction requires: Not 64-bit mode
            pushl   %edi
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:354:1: error: unexpected token at start of statement
    /APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:355:1: error: unexpected token at start of statement
    /  45 "x86.h" 1
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:357:1: error: unexpected token at start of statement
    /  0 "" 2
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:359:1: error: unexpected token at start of statement
    /NO_APP
    ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:365:2: error: unknown directive
            .size   bootmain, .-bootmain
            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:369:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_info,"",@progbits
                            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:993:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_abbrev,"",@progbits
                            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:1454:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_loc,"",@progbits
                            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:1785:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_aranges,"",@progbits
                            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:1797:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_line,"",@progbits
                            ^
    /var/folders/nc/w_y2cp4j4jx2vz4w_1rjy_kh0000gn/T//cc8pMjCq.s:1799:11: error: mach-o section specifier uses an unknown section type
            .section        .debug_str,"MS",@progbits,1
                            ^
    make: *** [bootblock] Error 1

У меня поиск по многим блогам, ни у кого нет этой проблемы. Я использую MAC OS X El Capitan (10.11.3)

Автор: icecity96 Источник Размещён: 08.11.2019 11:05

Ответы (2)


4 плюса

Решение

Вам не нужно компилировать свой собственный кросс-компилятор (и инструменты). Это работает самостоятельно с портами OSX.

sudo port install i386-elf-gcc gdb

Я использую Sierra и xv6 отлично работает с:

make TOOLCHAIN=i386-elf- qemu-nox

Отладка тоже работает.

Как примечание, вам нужно удалить, texinfoчтобы установить i386-elf-binutils(который находится в цепочке зависимости i386-elf-gcc). В документации этого пакета есть несовместимый код.

Автор: vpuente Размещён: 10.10.2016 08:10

-1 плюса

Я должен был установить MacPorts отсюда, затем использовал две команды:

sudo port install i386-elf-gcc gdb

make TOOLPREFIX=i386-elf- qemu-nox
Автор: Sherif Размещён: 26.03.2018 08:33
Вопросы из категории :
32x32