problem with makefile

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
beyondsociety

problem with makefile

Post by beyondsociety »

When I run my makefile from Linux, I get this error:

Code: Select all

nasm -f elf -o /boot/stub.o /boot/stub.asm
make: *** [boot/stub.o] Segmentation Fault
make: *** Deleting file 'boot/stub.o'

What would cause a segmentation fault and what is it?
If you need to see code, then just ask! 
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:problem with makefile

Post by Pype.Clicker »

segmentation fault (a.k.A. segfault or sigsegv) is the unix word for "blue screen of death" ... your application behaved badly and has been terminated. probably you either have a too old and buggy version of NASM or you're not giving it parameters it requires (isn't it -felf rather than -f elf ?)
beyondsociety

Re:problem with makefile

Post by beyondsociety »

(isn't it -felf rather than -f elf ?)
Tried it and didn't change a thing.

Heres my makefile:

Code: Select all

# Basic Makefile for IBOX OS, Ver 0.01, Date: 04/22/03 1:14 PM

# Name of IBOX OS Kernel
KERNEL_NAME = ibox.img

# C compiler to use
CC = gcc                          # Changing this may cause problems
CFLAGS = -c -Wall -I./include/    # Arguments given to GCC

# Assembler to use
NASM = nasm                       # Assembler has to support Intel Syntax                
NASMFLAGS = -f elf                # Compile to elf

# Linker to use
LD = ld                           # We're using the GNU Linker
LDFLAGS = -T linker.d -o $(KERNEL_NAME)

# Add the rest of the C files to this list
OBJS = boot/stub.o kernel/kernel.o kernel/stdio.o /kernel/8259.o /kernel/timer.o /kernel/io.o /kernel/exceptions.o /boot/handlers.o

all: $(KERNEL_NAME)

install:

        # This will install the kernel to a Floppy Disk
        mount /floppy/
        cp $(KERNEL_NAME) /floppy/
        umount /floppy/

clean:

        rm $(OBJS)

# Compile all assembler files
%.o : %.asm
        $(NASM) $(NASMFLAGS) -o $@ $<

# Compile all C files
%.o : %.c
        $(CC) $(CFLAGS) -o  $@ $<

# Link them all together
$(KERNEL_NAME): $(OBJS)
        $(LD) $(LDFLAGS) $(OBJS)
The file thats giving me the error is attached below:


[attachment deleted by admin]
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:problem with makefile

Post by Pype.Clicker »

afaik, MAKE is not to blame here. NASM is the one that caught a segfault ... and i'm not sure, but i think you should put a argument to your

Code: Select all

%REP 
...
%ENDREP ;; pype's internal assembler running on /dev/brain says "rep how many times ?"
try to get the version of your NASM (nasm -r) and check (f.i. on freshmeat, etc) if there isn't a more recent version available.
beyondsociety

Re:problem with makefile

Post by beyondsociety »

I'll try that and get back to you later on the outcome.

I think I have an older version of nasm.
beyondsociety

Re:problem with makefile

Post by beyondsociety »

I solved my problem thanks to Pype Clicker. I had to get a newer version of linux. Once I did that, it worked.
Thanks again.
Post Reply