Why does TUP fail with the following error, even though an executable is 
produced that runs as expected?

I have the following example : 

database.c :
-----------------

#include <stdio.h>
#include "../header/database.h"

void libMethodHello()
{
    printf("O Heeey\n");
}

database.h 
-----------------

void libMethodHello();

Thats all. I would like to use tup to produce a library that i can use 
within other c programs.

In my tupfile I have the following :

include_rules  (this only specifies the -Wall flag for the CFLAGS variable)
: foreach *.c |> gcc $(CFLAGS) -c %f -o %o |> %B.o
: foreach *.o |> ar crs %o %f |> ../lib/libchassis.a


 tup upd
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.007s] Reading in new environment variables...
[ tup ] [0.007s] Parsing Tupfiles...
 1) [0.002s] src/libchassis
 [ ] 100%
[ tup ] [0.015s] No files to 
delete.                                                                         
                                                                                
               

[ tup ] [0.015s] Generating .gitignore files...
[ tup ] [0.018s] Executing Commands...
 1) [0.031s] src/libchassis: gcc -Wall -O -c database.c -o 
database.o                                                                      
                                                   

 2) [0.002s] src/libchassis: ar crs ../lib/libchassis.a 
database.o                                                                      
                                                             

 [  ] 100%
[ tup ] [0.054s] 
Updated.                                                                        
  



Great. Seems like libchassis.a was produced successfully. I would like to 
now create a new program to use the libMethodHello() function that is part 
of the libchassis library.

Within a different directory within the TUP hierarchy :

test.c
-----------------
#include <stdio.h>
#include "../src/header/database.h"

int main(int argc, char **argv){
    printf("Hello from an external C main fucntion\n");
    libMethodHello();
    return 0;
}

My Tupfile to compile and link this program to the libchassis library is :

include_rules
: test.c |> gcc $(CFLAGS) -c %f -o %o |> test.o
: test.o |> gcc $(CFLAGS) %f ../src/lib/libchassis.a -o %o |> test

tup upd
-----------------
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.007s] Reading in new environment variables...
[ tup ] [0.007s] Parsing Tupfiles...
 1) [0.002s] tests
 [ ] 100%
[ tup ] [0.014s] No files to 
delete.                                                                         
                                                                                
               

[ tup ] [0.014s] Generating .gitignore files...
[ tup ] [0.017s] Executing Commands...
 1) [0.026s] tests: gcc -Wall -O -c test.c -o 
test.o                                                                          
                                                                              

* 2) tests: gcc -Wall -O test.o ../src/lib/libchassis.a -o 
test                                                                            
                                                                 

 *** tup errors ***
tup error: Missing input dependency - a file was read from, and was not 
specified as an input link for the command. This is an issue because the 
file was created from another command, and without the input link the 
commands may execute out of order. You should add this file as an input, 
since it is possible this could randomly break in the future.
 - [405] src/lib/libchassis.a
 *** Command ID=410 ran successfully, but tup failed to save the 
dependencies.
 [  ] 100%
 *** tup: 1 job failed.


So Tup fails with an error. But the executable is actually generated, and 
when I run it, I get the output I am expecting.

./test 
-----------------
Hello from an external C main fucntion
O Heeey from the libchassis library!


What am I missing here?

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to