LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   makefile gcc command cannot be found (https://www.linuxquestions.org/questions/programming-9/makefile-gcc-command-cannot-be-found-328546/)

Mogul83 05-30-2005 10:12 AM

makefile gcc command cannot be found
 
Hey Everyone,

The last couple of days i'm have been trying to do some linux kernel module programming. I was trying to compile the first example "hello1". The makefile consist of the following :

TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc-3.0

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:
rm -rf {TARGET}.o

A week ago when i type the command "make" everything went well. I had problems inserting this module with insmod. I decided to change the makefile and compile it again. But now i'm getting error message "gcc command cannot be found ". I updated redhat before I got this error message. I check to to see if the gcc version is the same as in the makefile, which was not the case. I change the line "CC:= gcc-3.0 to gcc-3.2.2" but i'm still getting the same error message. Can someone tell me what i am doing wrong? I have redhat 9.0

niknah 05-30-2005 10:27 AM

Is there any reason why you're using a specific version of gcc?
Try leaving it on
CC:= gcc

Mogul83 05-30-2005 11:02 AM

I tried leaving the 3.0 out but now i getting the following error message " cannot specify -o with -c or -S and multiple compilations"

I'm follwing the examples that are written in the document. http://www.faqs.org/docs/kernel/x204.html

niknah 05-30-2005 11:19 AM

Are you using the same makefile?

There is no -o
in the makefile you posted.

Mogul83 05-30-2005 11:28 AM

I'm using the same makefile only the name of the target is different

According to me, the line "${TARGET}.o: ${TARGET}.c" specifies the name of the input and the output file.

At the top of the makefile has "TARGET := hello-1".

I could be wrong what i just said but reading it i would think that line specifies the -o

niknah 05-30-2005 03:01 PM

I copy and pasted your makefile, seems to work ok for me.

Mogul83 05-30-2005 03:34 PM

Strange... That it doesn't work with me.. If anyone have suggestions let me know.. i'll continue to solve this mysterious error...

Mogul83 05-31-2005 03:11 AM

It works fine now.. I remember a few weeks ago i compiled it i use gcc command, seeing that it was C-file. Now compiling the hello.c with the makefile. it cause conflict with the old output file, which was still in the directory.

Beginners mistake..


All times are GMT -5. The time now is 12:52 PM.