Giter VIP home page Giter VIP logo

Comments (10)

redstonedash avatar redstonedash commented on July 30, 2024

I think it has something to do with building limine? The only thing I can make from looking it up is the -no-pie -fno-pie and -fno-pic might help but the command the compiles limine excludes those commands

from limine-c-template.

mintsuki avatar mintsuki commented on July 30, 2024

Try replacing the -fno-pic flag with -fno-PIC; should that fail, you will either need to use a cross compiler (for x86_64-elf target) or you can use WSL if you're on Windows 10/11.

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Alright, I followed the cross compiler instructions linked on the README and I get this output

username@ARK /cygdrive/c/Users/username/OSDev
$ make CC=$TARGET-gcc
git clone https://github.com/limine-bootloader/limine.git --branch=v3.0-branch-binary --depth=1
Cloning into 'limine'...
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 17 (delta 3), reused 7 (delta 1), pack-reused 0
Receiving objects: 100% (17/17), 410.04 KiB | 8.20 MiB/s, done.
Resolving deltas: 100% (3/3), done.
make -C limine
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/limine'
i686-elf-gcc -g -O2 -pipe -Wall -Wextra  -std=c99 -D__USE_MINGW_ANSI_STDIO limine-version.c -o limine-version
limine-version.c:1:10: fatal error: stdio.h: No such file or directory
    1 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:45: limine-version] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/limine'
make: *** [GNUmakefile:29: limine] Error 2

I have a few more things I'm going to try.

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Okay the other thing i was going to try was to compile limine with just CC and then compile the kernel with the cross compiler

username@ARK /cygdrive/c/Users/username/OSDev
$ make distclean
rm -rf iso_root barebones.iso barebones.hdd
make -C kernel clean
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/kernel'
rm -rf kernel.elf ./kernel.o   ./kernel.d
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/kernel'
rm -rf limine ovmf-x64
make -C kernel distclean
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/kernel'
rm -rf kernel.elf ./kernel.o   ./kernel.d
rm -f limine.h
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/kernel'

username@ARK /cygdrive/c/Users/username/OSDev
$ make limine
git clone https://github.com/limine-bootloader/limine.git --branch=v3.0-branch-binary --depth=1
Cloning into 'limine'...
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 17 (delta 3), reused 7 (delta 1), pack-reused 0
Receiving objects: 100% (17/17), 410.04 KiB | 4.14 MiB/s, done.
Resolving deltas: 100% (3/3), done.
make -C limine
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/limine'
cc -g -O2 -pipe -Wall -Wextra  -std=c99 -D__USE_MINGW_ANSI_STDIO limine-version.c -o limine-version
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/limine'

username@ARK /cygdrive/c/Users/username/OSDev
$ make CC=$TARGET-gcc
make -C kernel
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/kernel'
curl https://raw.githubusercontent.com/limine-bootloader/limine/trunk/limine.h -o limine.h
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9993  100  9993    0     0  41629      0 --:--:-- --:--:-- --:--:-- 41811
i686-elf-gcc  -O2 -g -Wall -Wextra -Wpedantic -pipe -I. -std=c11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-pie -fno-pic -m64 -march=x86-64 -mabi=sysv -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -mcmodel=kernel -MMD -c kernel.c -o kernel.o
cc1: error: code model 'kernel' not supported in the 32 bit mode
cc1: sorry, unimplemented: 64-bit mode not compiled in
make[1]: *** [GNUmakefile:89: kernel.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/kernel'
make: *** [GNUmakefile:33: kernel] Error 2

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Maybe I followed the instructions too closely. I was compiling for i686 elf. I will try again with x86_64-elf as the target

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Okay. after redoing everything to compile for x86_64,

redstonedash@ARK /cygdrive/c/Users/redstonedash/OSDev
$ make cc=$TARGET-gcc
make -C kernel
make[1]: Entering directory '/cygdrive/c/Users/redstonedash/OSDev/kernel'
curl https://raw.githubusercontent.com/limine-bootloader/limine/trunk/limine.h -o limine.h
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9993  100  9993    0     0  44055      0 --:--:-- --:--:-- --:--:-- 44216
cc  -O2 -g -Wall -Wextra -Wpedantic -pipe -I. -std=c11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-pie -fno-pic -m64 -march=x86-64 -mabi=sysv -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -mcmodel=kernel -MMD -c kernel.c -o kernel.o
cc1: error: code model kernel does not support PIC mode
make[1]: *** [GNUmakefile:89: kernel.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/redstonedash/OSDev/kernel'
make: *** [GNUmakefile:33: kernel] Error 2

I can try again with WSL but i feel like this should work. what version of GCC do you use?

from limine-c-template.

mintsuki avatar mintsuki commented on July 30, 2024

cc= should be uppercase...

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Ah, my bad. It says it doesn't recognize the option -z

username@ARK /cygdrive/c/Users/username/OSDev
$ make CC=$TARGET-gcc
make -C kernel
make[1]: Entering directory '/cygdrive/c/Users/username/OSDev/kernel'
curl https://raw.githubusercontent.com/limine-bootloader/limine/trunk/limine.h -o limine.h
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9993  100  9993    0     0  48087      0 --:--:-- --:--:-- --:--:-- 48275
x86_64-elf-gcc  -O2 -g -Wall -Wextra -Wpedantic -pipe -I. -std=c11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-pie -fno-pic -m64 -march=x86-64 -mabi=sysv -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -mcmodel=kernel -MMD -c kernel.c -o kernel.o
ld ./kernel.o   -nostdlib -static -z max-page-size=0x1000 -T linker.ld -o kernel.elf
ld: unrecognized option '-z'
ld: use the --help option for usage information
make[1]: *** [GNUmakefile:82: kernel.elf] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/username/OSDev/kernel'
make: *** [GNUmakefile:33: kernel] Error 2

from limine-c-template.

mintsuki avatar mintsuki commented on July 30, 2024

Because you also need to pass LD=$TARGET-ld

from limine-c-template.

redstonedash avatar redstonedash commented on July 30, 2024

Thank you. Maybe it should be noted that CC with Cygwin will not work (I assume because it's trying to build a windows executable, which is why the -z command is not present). Other than that most of this thread is just me demonstrating my incompetence on unix systems

from limine-c-template.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.