makefile help

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
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

makefile help

Post by xDDunce »

so i have finally discovered the usefulness of a makefile, but everytime i try to link my objects in the file, it throws an error.

my makefile looks like this:

Code: Select all

PROGNAME = ker.nel
objects = start.o main.o
CC = gcc
CC += -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./Includes -c
ASM = nasm
ASM += -f elf -o start.o
LD = ld-elf
LD += -T link.ld
MKISO = mkisofs
MKISO +=  -R -b grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o 

all: $(PROGNAME) MAKEISO
  
clean:
	del  *.o
	del  $(PROGNAME)

%.o: %.s
	$(ASM) $<

%.o: %.c
	$(CC) $<

$(PROGNAME): $(objects)
	$(LD) -o $(PROGNAME) $(objects)

MAKEISO: $(PROGNAME)
	copy ker.nel C:\osdevc\sources\iso
	$(MKISO) grub.iso iso
and i get this error:

Code: Select all

exiting due to signal SIGSEGV
General Portection Fault at eip=00067ac7
eax=fff50008 ebx=000001ff ecx=000002b7 edx=fff50000 esi=00000008 edi=00000000
ebp=000ba018 esp=000ba008 program=C:\DJGPP\bin\ld-elf.exe
cs: sel=026f base=02b70000 limit=7d47ffff
ds: sel=0277 base=02b70000 limit=7d47ffff
es: sel=0277 base=02b70000 limit=7d47ffff
fs: sel=0247 base=0001a570 limit=0000ffff
gs: sel=0287 base=00000000 limit=7ffeffff
ss: sel=0277 base=02b70000 limit=7d47ffff

Call frame traceback EIPs:
   0x00067ac7
   0x00067a4d
   0x0006bbbb
   0x0006c365
   0x000671ff

if i use the same commands directly on the command line, then it works but otherwise it doesn't. any suggestions on what is going wrong?

James.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: makefile help

Post by JamesM »

Try using ":=" instead of "=" for a static initialisation.
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

thanks for the suggestion! but no luck. i have discovered a new feature of this problem. i discovered it works, but only if i restart my laptop. any more ideas to fix this problem?

James.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: makefile help

Post by Combuster »

/me sticks on the sign "Make sure you have the latest (drivers) installed"

Using DOS applications on the latest windows versions is asking for trouble. Time to start using cygwin, rather than ancient DJGPP...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
salil_bhagurkar
Member
Member
Posts: 261
Joined: Mon Feb 19, 2007 10:40 am
Location: India

Re: makefile help

Post by salil_bhagurkar »

I guess you should just put that ld-elf (ld) in a batch file as a script... That should save you from trouble temporarily.. But yes i think you should go for cygwin...
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

ok fair enough, although has DJGPP not been updated recently? i noticed the download system was different since about 2 months ago. although i may be wrong as i always like to be :oops:

ill switch to cygwin now then. Thanks for the help!

James.
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

ok, so i've switched now. but i have a new error.

it all works fine until i have to boot my kernel. it doesn't want to load my kernel above 1MB.

my linker script looks like this:

Code: Select all

OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
   .text phys : AT(phys)
   {
      code = .;
      *(.text)
      *(.rodata)
      . = ALIGN(4096);
   }
   .data : AT(phys + (data - code))
   {
      data = .;
      start_ctors = .;
         *(.ctor*)
      end_ctors = .;
      start_dtors = .;
         *(.dtor*)
      end_dtors = .;
      *(.data)
      . = ALIGN(4096);
   }
   .bss : AT(phys + (bss - code))
   {
      bss = .;
      *(.bss)
      . = ALIGN(4096);
   }
   end = .;
}
hopefully this will be my last problem [-o< but i do highly doubt it.

James.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: makefile help

Post by Combuster »

error messages please.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

grub error 7: loading below 1Mb is not supported.

i did say it was a grub error in the above post but i guess i should have said this instead, sorry.

James.
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

ok i found the problem. i accidently removed my linker script from the LD in my makefile. but now its on, theres a new problem. one i have never seen before.

Code: Select all

4 [main] make 3456! _pinfo::dup_proc_pipe: DuplicateHandle failed, pid 3456, hProcess 0c6F1, wr_proc_pipe 0x754, Win32 error 6
i have googled to find this error but i can find a fix.

James.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: makefile help

Post by Combuster »

well you should obviously not include those numbers, they are pretty much random :wink:

http://lists-archives.org/cygwin/35202- ... ailed.html
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: makefile help

Post by quok »

johnsy2008 wrote:4 [main] make 3456! _pinfo::dup_proc_pipe: DuplicateHandle failed, pid 3456, hProcess 0c6F1, wr_proc_pipe 0x754, Win32 error 6
Oh, nice, one of those generic fork() -like errors. You wouldn't happen to have any Logitech webcam drivers installed would you? I had similar problems back when I used Cygwin all the time, and found this post: http://www.cygwin.com/ml/cygwin/2006-03/msg00173.html

Evidently, there's a conflict between Cygwin and the way the logitech drivers work. When this conflict rears its ugly head, you'll see programs dieing after not being able to allocate heap space, fork() not working at all and all kinds of things. The simple way to fix this is to disable automatic loading of your logitech drivers (set them to manual or disabled instead), and cygwin should start to behave correctly. Of course you won't be able to use your logitech webcam then without reversing the steps. Alternatively, you could rebase your Cygwin .dlls, but that's not guaranteed to fix things either.
User avatar
xDDunce
Member
Member
Posts: 173
Joined: Tue Aug 12, 2008 4:04 pm
Contact:

Re: makefile help

Post by xDDunce »

well i don't have any logitech peripherals but could the apple built-in isight do the same thing? i suppose it would...

and as for those numbers, they the 3456 stays the same but the 4 has changed as i have just retryed it.

ill take a look at the links now.

thanks,

James.
Post Reply