Find the answer to your Linux question:
Results 1 to 10 of 10
Hello, I am working with robotics (Koala from K-Team if it matters) and i'm trying to compile some code. The robot has arm linux on it. I am trying to ...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    7

    Makefile problem: no rule to make target

    Hello, I am working with robotics (Koala from K-Team if it matters) and i'm trying to compile some code. The robot has arm linux on it. I am trying to use some low level calls but when I try to compile make returns with no rule to make target. I'm still adapting to using linux and make. Now, my directory structure is setup like so, my code and makefile are in the folder and then there is an additional folder where all the robot specific files are. I had another makefile to use as a guide but it was just a basic makefile, so I have been modifying it trying to get it to work but still no luck. I tried changing the paths to the folder i mentioned in my directory with my src but that still did not work. My dependency files are already compiled from a previous date and they are not going to be modified in the future. My makefile is below.

    Code:
    all: ks knet_rs232.o knet.o koala.o
    
    # Got to use the right tools
    CC              = arm-linux-gcc
    LD              = arm-linux-ld
    AR              = arm-linux-ar
    AS              = arm-linux-as
    
    KOREBOT_DIR	= /share/robots/libkorebot-1.11/build-korebot/lib/
    KOREBOT_LIB	= korebot-1.11
    KOREBOT_INC	= /share/robots/libkorebot-1.11/build-korebot/include/
    
    export PATH=/share/robots/korebot-tools-2.1/bin:$PATH
    
    #
    # Start the rules 
    #
    
    ks: KoalaT.c knet_rs232.o knet.o koala.o
    	$(CC) KoalaT.c knet.o koala.o knet_rs232.o -o KoalaT -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB) -lm
    
    knet_rs232.o: knet_rs232.c knet_rs232.h
    	$(CC) -o knet_rs232.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    knet.o: knet.c knet.h
    	$(CC) -o knet.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    koala.o: koala.c koala.h
    	$(CC) -o koala.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    Here is my output:
    make: Warning: File `Makefile' has modification time 13 s in the future
    make: *** No rule to make target `knet_rs232.c', needed by `knet_rs232.o'. Stop.


    Can someone lead me in the right direction?

    Thanks,
    Chris

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    First, the warning is due to the system time between the build system and the edit system differs. Set up the systems to sync to network time (ntp) and the warning will go away.

    Second, your error about the missing target 'knet_rs232c' means that file is not in the build directory. Verify that it is there, and that you have the spelling (and case) correct in the Makefile.

    Third, make sure that the space before the $(CC) for each rule instantiation is a tab and not spaces. Make does not like spaces on those lines. This might also be the cause of the error you are getting.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    Your rules look odd to me. For example:
    Code:
    knet.o: knet.c knet.h
    	$(CC) -o knet.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    You seem to be writing to one of the dependencies rather than the target.

    -o file
    Place output in file file. This applies regardless to whatever
    sort of output is being produced, whether it be an executable file,
    an object file, an assembler file or preprocessed C code.

    -- excerpt from man gcc
    cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by drl View Post
    Hi.

    Your rules look odd to me. For example:
    Code:
    knet.o: knet.c knet.h
    	$(CC) -o knet.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    You seem to be writing to one of the dependencies rather than the target.
    Good catch. I missed that. It should be:
    Code:
    knet.o: knet.c knet.h
    	$(CC) knet.c -o knet.o -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    Ditto for the other targets. They show the same error.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Jul 2008
    Posts
    7
    Thanks for your responses. I understand the error now but every attempt I've had at correcting it has been unsuccessful. I tried to add another include directory in my makefile which points to the directory in my folder that contains all the files I'm trying to include. My makefile looks like this now

    Code:
    all: kserial knet_rs232.o knet.o koala.o
    
    # Got to use the right tools
    CC              = arm-linux-gcc
    LD              = arm-linux-ld
    AR              = arm-linux-ar
    AS              = arm-linux-as
    
    KOREBOT_DIR	= /share/robots/libkorebot-1.11/build-korebot/lib/
    KOREBOT_LIB	= korebot-1.11
    KOREBOT_INC	= /share/robots/libkorebot-1.11/build-korebot/include/
    KOREBOT_LOC	= /share/robots/code/Koala Serial/korebot/
    
    export PATH=/share/robots/korebot-tools-2.1/bin:$PATH
    
    #
    # Start the rules 
    #
    
    kserial: KoalaT.c knet_rs232.o knet.o koala.o
    	$(CC) KoalaT.c knet_rs232.o knet.o koala.o -o KoalaT -I$(KOREBOT_LOC) -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB) -lm
    
    knet_rs232.o: knet_rs232.c knet_rs232.h
    	$(CC) knet_rs232.c -o knet_rs232.o -I$(KOREBOT_LOC) -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    knet.o: knet.c knet.h
    	$(CC) knet.c -o knet.o -I$(KOREBOT_LOC) -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    koala.o: koala.c koala.h
    	$(CC) koala.c -o koala.o -I$(KOREBOT_LOC) -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    I still get the same error. All the files I'm trying to make here are in my other subdirectory and if I copy the .c files to my top directory where the makefile is it will build but then all the header files (and the files the header files include) are in the subdirectory and I'd rather have my directory structure look clean and neat.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Please post a list of the contents of the directory containing the source code, and indicate if the Makefile you are building from is in the same directory as the sources or not.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    Jul 2008
    Posts
    7
    Here is the list of my directory and the sub directory.

    Code:
    [root@alf Koala Serial]# ls -l
    total 20
    -rw-r--r-- 1 root root 2197 Jun  5 14:58 KoalaT.c
    -rw-r--r-- 1 root root 2200 Jun  5 12:13 KoalaT.c~
    drwxr-xr-x 2 root root 4096 Jun  5 10:32 korebot
    -rw-r--r-- 1 root root 1121 Jun  8 11:08 Makefile
    -rw-r--r-- 1 root root 1104 Jun  8 11:08 Makefile~
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    Now for the subdirectory
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    [root@alf Koala Serial]# cd korebot/
    [root@alf korebot]# ls -l
    total 1180
    -rw-r--r-- 1 root root  1678 Jan 29  2008 bit_conv_tab.c
    -rw-r--r-- 1 root root   556 Jan 29  2008 bit_conv_tab.o
    -rw-r--r-- 1 root root  2791 Jan 29  2008 crystalfontz634.c
    -rw-r--r-- 1 root root  1183 Jan 29  2008 crystalfontz634.h
    -rw-r--r-- 1 root root  2764 Jan 29  2008 crystalfontz634.o
    -rw-r--r-- 1 root root   466 Jan 29  2008 GoAutomation.knc
    -rw-r--r-- 1 root root  5506 Jan 29  2008 gpio_test.c
    -rw-r--r-- 1 root root  4000 Jan 29  2008 gpio_test.o
    -rw-r--r-- 1 root root 11521 Jan 29  2008 hem.c
    -rw-r--r-- 1 root root  3834 Jan 29  2008 hem.h
    -rw-r--r-- 1 root root  4180 Jan 29  2008 hem.o
    -rw-r--r-- 1 root root  8655 Jan 29  2008 i2ccom.c
    -rw-r--r-- 1 root root  1876 Jan 29  2008 i2ccom.h
    -rw-r--r-- 1 root root  1724 Jan 29  2008 i2ccom.o
    -rw-r--r-- 1 root root 10390 Jan 29  2008 i2c-dev.h
    -rw-r--r-- 1 root root  2259 Jan 29  2008 k3_monitor.c
    -rw-r--r-- 1 root root  2040 Jan 29  2008 k3_monitor.o
    -rw-r--r-- 1 root root   348 Jan 29  2008 kb_cel.h
    -rw-r--r-- 1 root root  4952 Jan 29  2008 kb_cmdparser.c
    -rw-r--r-- 1 root root  1363 Jan 29  2008 kb_cmdparser.h
    -rw-r--r-- 1 root root  2016 Jan 29  2008 kb_cmdparser.o
    -rw-r--r-- 1 root root 28080 Jan 29  2008 kb_config.c
    -rw-r--r-- 1 root root  4232 Jan 29  2008 kb_config.h
    -rw-r--r-- 1 root root  8208 Jan 29  2008 kb_config.o
    -rw-r--r-- 1 root root  1853 Jan 29  2008 kb_config_test.c
    -rw-r--r-- 1 root root  1464 Jan 29  2008 kb_config_test.o
    -rw-r--r-- 1 root root 10266 Jan 29  2008 kb_error.c
    -rw-r--r-- 1 root root  5082 Jan 29  2008 kb_error.h
    -rw-r--r-- 1 root root  5592 Jan 29  2008 kb_error.o
    -rw-r--r-- 1 root root  4604 Jan 29  2008 kb_fifo.c
    -rw-r--r-- 1 root root   678 Jan 29  2008 kb_fifo.h
    -rw-r--r-- 1 root root  2684 Jan 29  2008 kb_fifo.o
    -rw-r--r-- 1 root root  5055 Jan 29  2008 kb_gpio.c
    -rw-r--r-- 1 root root   608 Jan 29  2008 kb_gpio.h
    -rw-r--r-- 1 root root  2680 Jan 29  2008 kb_gpio.o
    -rw-r--r-- 1 root root  1853 Jan 29  2008 kb_init.c
    -rw-r--r-- 1 root root   613 Jan 29  2008 kb_init.h
    -rw-r--r-- 1 root root  1740 Jan 29  2008 kb_init.o
    -rw-r--r-- 1 root root  9750 Jan 29  2008 kb_khepera3.c
    -rw-r--r-- 1 root root  2101 Jan 29  2008 kb_khepera3.h
    -rw-r--r-- 1 root root  2904 Jan 29  2008 kb_khepera3.o
    -rw-r--r-- 1 root root 23641 Jan 29  2008 kb_lrf.c
    -rw-r--r-- 1 root root   985 Jan 29  2008 kb_lrf.h
    -rw-r--r-- 1 root root  7312 Jan 29  2008 kb_lrf.o
    -rw-r--r-- 1 root root  9609 Jan 29  2008 kb_lrftest.c
    -rw-r--r-- 1 root root  7948 Jan 29  2008 kb_lrftest.o
    -rw-r--r-- 1 root root  1425 Jan 29  2008 kb_memory.c
    -rw-r--r-- 1 root root  1084 Jan 29  2008 kb_memory.h
    -rw-r--r-- 1 root root  1084 Jan 29  2008 kb_memory.o
    -rw-r--r-- 1 root root  2791 Jan 29  2008 kbot.c
    -rw-r--r-- 1 root root  1019 Jan 29  2008 kbot.h
    -rw-r--r-- 1 root root  1284 Jan 29  2008 kbot.o
    -rw-r--r-- 1 root root 10796 Jan 29  2008 kb_pwm.c
    -rw-r--r-- 1 root root   701 Jan 29  2008 kb_pwm.h
    -rw-r--r-- 1 root root  4036 Jan 29  2008 kb_pwm.o
    -rw-r--r-- 1 root root  3503 Jan 29  2008 kb_pxa_register.h
    -rw-r--r-- 1 root root  7650 Jan 29  2008 KBR.c
    -rw-r--r-- 1 root root  5124 Jan 29  2008 KBR.o
    -rw-r--r-- 1 root root 11136 Jan 29  2008 kb_socket.c
    -rw-r--r-- 1 root root  1351 Jan 29  2008 kb_socket.h
    -rw-r--r-- 1 root root  5112 Jan 29  2008 kb_socket.o
    -rw-r--r-- 1 root root 14125 Jan 29  2008 kb_sound.c
    -rw-r--r-- 1 root root  2360 Jan 29  2008 kb_sound.h
    -rw-r--r-- 1 root root  7156 Jan 29  2008 kb_sound.o
    -rw-r--r-- 1 root root  5356 Jan 29  2008 kb_symbol.c
    -rw-r--r-- 1 root root  2389 Jan 29  2008 kb_symbol.h
    -rw-r--r-- 1 root root  2556 Jan 29  2008 kb_symbol.o
    -rw-r--r-- 1 root root   810 Jan 29  2008 kb_test.c
    -rw-r--r-- 1 root root  1660 Jan 29  2008 kb_time.c
    -rw-r--r-- 1 root root   876 Jan 29  2008 kb_time.h
    -rw-r--r-- 1 root root   860 Jan 29  2008 kb_time.o
    -rw-r--r-- 1 root root 11884 Jan 29  2008 kb_wav.c
    -rw-r--r-- 1 root root  1769 Jan 29  2008 kb_wav.h
    -rw-r--r-- 1 root root  3924 Jan 29  2008 kb_wav.o
    -rw-r--r-- 1 root root 17457 Jan 29  2008 khepera3_test.c
    -rw-r--r-- 1 root root 17591 Jan 29  2008 khepera3_test_loop.c
    -rw-r--r-- 1 root root  9920 Jan 29  2008 khepera3_test.o
    -rw-r--r-- 1 root root 22291 Jan 29  2008 kmot.c
    -rw-r--r-- 1 root root 11198 Jan 29  2008 kmot.h
    -rw-r--r-- 1 root root 10642 Jan 29  2008 kmot_ipserver.c
    -rw-r--r-- 1 root root  6832 Jan 29  2008 kmot_ipserver.o
    -rw-r--r-- 1 root root  2991 Jan 29  2008 kmotLE_monitor.c
    -rw-r--r-- 1 root root  2612 Jan 29  2008 kmotLE_monitor.o
    -rw-r--r-- 1 root root 20455 Jan 29  2008 kmotLE_test.c
    -rw-r--r-- 1 root root 12484 Jan 29  2008 kmotLE_test.o
    -rw-r--r-- 1 root root  2975 Jan 29  2008 kmot_monitor.c
    -rw-r--r-- 1 root root  2608 Jan 29  2008 kmot_monitor.o
    -rw-r--r-- 1 root root  4372 Jan 29  2008 kmot.o
    -rw-r--r-- 1 root root  5992 Jan 29  2008 kmot_pantilt.c
    -rw-r--r-- 1 root root  3568 Jan 29  2008 kmot_pantilt.o
    -rw-r--r-- 1 root root 20439 Jan 29  2008 kmot_test.c
    -rw-r--r-- 1 root root 12484 Jan 29  2008 kmot_test.o
    -rw-r--r-- 1 root root 31806 Jan 29  2008 knet.c
    -rw-r--r-- 1 root root  6824 Jan 29  2008 knet.h
    -rw-r--r-- 1 root root  7556 Jan 29  2008 knet_i2c.c
    -rw-r--r-- 1 root root   605 Jan 29  2008 knet_i2c.h
    -rw-r--r-- 1 root root  2396 Jan 29  2008 knet_i2c.o
    -rw-r--r-- 1 root root  8136 Jan 29  2008 knet.o
    -rw-r--r-- 1 root root  6068 Jan 29  2008 knet_rs232.c
    -rw-r--r-- 1 root root   754 Jan 29  2008 knet_rs232.h
    -rw-r--r-- 1 root root  1900 Jan 29  2008 knet_rs232.o
    -rw-r--r-- 1 root root   792 Jan 29  2008 knet_test.c
    -rw-r--r-- 1 root root 18270 Jan 29  2008 koala.c
    -rw-r--r-- 1 root root 14617 Jan 29  2008 koala_demo.c
    -rw-r--r-- 1 root root  8304 Jan 29  2008 koala_demo_client.c
    -rw-r--r-- 1 root root  5072 Jan 29  2008 koala_demo_client.o
    -rw-r--r-- 1 root root 11324 Jan 29  2008 koala_demo.o
    -rw-r--r-- 1 root root 14409 Jan 29  2008 koala_GoAutomation.c
    -rw-r--r-- 1 root root  7460 Jan 29  2008 koala_GoAutomation.o
    -rw-r--r-- 1 root root   824 Jan 29  2008 koala.h
    -rw-r--r-- 1 root root  4948 Jan 29  2008 koala_lrf_demo.c
    -rw-r--r-- 1 root root  4252 Jan 29  2008 koala_lrf_demo.o
    -rw-r--r-- 1 root root  5572 Jan 29  2008 koala.o
    -rw-r--r-- 1 root root  1207 Jan 29  2008 koala_test.c
    -rw-r--r-- 1 root root  1404 Jan 29  2008 koala_test.o
    -rw-r--r-- 1 root root  6244 Jan 29  2008 korebase_test.c
    -rw-r--r-- 1 root root  1380 Jan 29  2008 korebot.h
    -rw-r--r-- 1 root root  4402 Jan 29  2008 koreio_auto.c
    -rw-r--r-- 1 root root  2880 Jan 29  2008 koreio_auto.o
    -rw-r--r-- 1 root root 15936 Jan 29  2008 koreio.c
    -rw-r--r-- 1 root root  4795 Jan 29  2008 koreio_debug.c
    -rw-r--r-- 1 root root 20454 Jan 29  2008 koreio_gripper.c
    -rw-r--r-- 1 root root  2796 Jan 29  2008 koreio.h
    -rw-r--r-- 1 root root  4412 Jan 29  2008 koreioLE_auto.c
    -rw-r--r-- 1 root root  2888 Jan 29  2008 koreioLE_auto.o
    -rw-r--r-- 1 root root 13795 Jan 29  2008 koreioLE_test.c
    -rw-r--r-- 1 root root 10312 Jan 29  2008 koreioLE_test.o
    -rw-r--r-- 1 root root  3644 Jan 29  2008 koreio.o
    -rw-r--r-- 1 root root 20070 Jan 29  2008 koreio_robot.c
    -rw-r--r-- 1 root root 14376 Jan 29  2008 koreio_robot.o
    -rw-r--r-- 1 root root 13945 Jan 29  2008 koreio_test.c
    -rw-r--r-- 1 root root 10464 Jan 29  2008 koreio_test.o
    -rw-r--r-- 1 root root  1802 Jan 29  2008 kteamdoxy.css
    -rw-r--r-- 1 root root  2340 Jan 29  2008 ltc1663.c
    -rw-r--r-- 1 root root  1145 Jan 29  2008 ltc1663.h
    -rw-r--r-- 1 root root   896 Jan 29  2008 ltc1663.o
    -rw-r--r-- 1 root root  7627 Jan 29  2008 pantilt_demo.c
    -rw-r--r-- 1 root root  7091 Jan 29  2008 pantilt_demo_client.c
    -rw-r--r-- 1 root root  1907 Jan 29  2008 pcf8574.c
    -rw-r--r-- 1 root root   825 Jan 29  2008 pcf8574.h
    -rw-r--r-- 1 root root   844 Jan 29  2008 pcf8574.o
    -rw-r--r-- 1 root root 20455 Jan 29  2008 setco_test.c
    -rw-r--r-- 1 root root  1439 Jan 29  2008 soundtest.c
    -rw-r--r-- 1 root root  1976 Jan 29  2008 soundtest.o

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Ok. Is your previous posting of your Makefile complete? If so, then you are missing a VPATH variable to tell make where to find the source files. IE:
    Code:
    all: ks knet_rs232.o knet.o koala.o
    
    # Got to use the right tools
    CC              = arm-linux-gcc
    LD              = arm-linux-ld
    AR              = arm-linux-ar
    AS              = arm-linux-as
    
    KOREBOT_DIR	= /share/robots/libkorebot-1.11/build-korebot/lib/
    KOREBOT_LIB	= korebot-1.11
    KOREBOT_INC	= /share/robots/libkorebot-1.11/build-korebot/include/
    
    export PATH=/share/robots/korebot-tools-2.1/bin:$PATH
    
    # Tell make to search this directory and the korebot sub-directory for sources.
    VPATH = .:korebot
    
    #
    # Start the rules 
    #
    
    ks: KoalaT.c knet_rs232.o knet.o koala.o
    	$(CC) KoalaT.c knet.o koala.o knet_rs232.o -o KoalaT -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB) -lm
    
    knet_rs232.o: knet_rs232.c knet_rs232.h
    	$(CC) -o knet_rs232.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    knet.o: knet.c knet.h
    	$(CC) -o knet.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    
    koala.o: koala.c koala.h
    	$(CC) -o koala.c -I$(KOREBOT_INC) -L$(KOREBOT_DIR) -l$(KOREBOT_LIB)
    Anyway, try that and see what happens.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    Jul 2008
    Posts
    7
    Thanks again for the response rubberman. Make can now find the source files but still says it cannot find the .o files. I tried adding in

    -I$(korebot subdirectory path)

    to each rule but it still does not find the .o files. The .o files are in the subdirectory so I'm not sure if I need to use a different option flag or not but I do not see a suitable option in the man page.

  10. #10
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Look at the make info entry. From the command line:
    Code:
    info make
    It has a lot of information about how to configure your Makefile so it will deal with all this stuff.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...