Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
building a file similarity app source code into a binary....
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Sun Mar 02, 2003 8:43 pm    Post subject: building a file similarity app source code into a binary.... Reply with quote

I want to do some testing of audio encoders by encoding a file then decoding and comparing the two and have a "certainty index" betwen the two. The closest thing I've been able to find on the net is this:
http://lists.canonical.org/pipermail/kragen-hacks/1999-February/000157.html

How can I compile and run this to see if it'll do what I need?

thanks.
Back to top
View user's profile Send private message
fifo
Guru
Guru


Joined: 14 Jan 2003
Posts: 437

PostPosted: Sun Mar 02, 2003 9:03 pm    Post subject: Reply with quote

Why not follow his "To try it out quick" instructions?
Back to top
View user's profile Send private message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Sun Mar 02, 2003 9:59 pm    Post subject: Reply with quote

hmm I didn't see that @ the top for some reason... here's what I get when I copy the code into fingerprint.c:
Code:
fingerprint.c:1: parse error before '-' token
fingerprint.c:1: `us' undeclared here (not in a function)
fingerprint.c:2: `ascii' undeclared here (not in a function)
fingerprint.c:2: parse error before "Content"
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:43,
                 from fingerprint.c:11:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stddef.h:201: parse error before "typedef"
In file included from /usr/include/bits/types.h:143,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:45,
                 from fingerprint.c:11:
/usr/include/bits/pthreadtypes.h:48: parse error before "size_t"
/usr/include/bits/pthreadtypes.h:51: parse error before "__stacksize"
In file included from /usr/include/_G_config.h:44,
                 from /usr/include/libio.h:32,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:81,
                 from fingerprint.c:11:
/usr/include/gconv.h:72: parse error before "size_t"
/usr/include/gconv.h:85: parse error before "size_t"
/usr/include/gconv.h:94: parse error before "size_t"
/usr/include/gconv.h:170: parse error before "size_t"
/usr/include/gconv.h:173: parse error before '}' token
In file included from /usr/include/libio.h:32,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:81,
                 from fingerprint.c:11:
/usr/include/_G_config.h:47: field `__cd' has incomplete type
/usr/include/_G_config.h:50: field `__cd' has incomplete type
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:81,
                 from fingerprint.c:11:
/usr/include/libio.h:350: parse error before "size_t"
/usr/include/libio.h:359: parse error before "size_t"
/usr/include/libio.h:467: parse error before "_IO_sgetn"
/usr/include/libio.h:467: parse error before "size_t"
In file included from fingerprint.c:11:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:288: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:295: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:326: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:330: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:498: parse error before "fread"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:498: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:501: parse error before "fwrite"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:501: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:513: parse error before "fread_unlocked"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:513: parse error before "size_t"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:515: parse error before "fwrite_unlocked"
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/stdio.h:515: parse error before "size_t"
In file included from fingerprint.c:12:
/usr/include/string.h:39: parse error before "size_t"
/usr/include/string.h:42: parse error before "size_t"
/usr/include/string.h:51: parse error before "size_t"
/usr/include/string.h:58: parse error before "size_t"
/usr/include/string.h:61: parse error before "size_t"
/usr/include/string.h:65: parse error before "size_t"
/usr/include/string.h:86: parse error before "size_t"
/usr/include/string.h:93: parse error before "size_t"
/usr/include/string.h:99: parse error before "size_t"
/usr/include/string.h:106: parse error before "strxfrm"
/usr/include/string.h:107: parse error before "size_t"
/usr/include/string.h:176: parse error before "strcspn"
/usr/include/string.h:180: parse error before "strspn"
/usr/include/string.h:230: parse error before "strlen"
/usr/include/string.h:248: parse error before "size_t"
/usr/include/string.h:253: parse error before "size_t"
/usr/include/string.h:257: parse error before "size_t"
/usr/include/string.h:260: parse error before "size_t"
/usr/include/string.h:263: parse error before "size_t"
/usr/include/string.h:291: parse error before "size_t"
In file included from fingerprint.c:16:
/usr/include/stdlib.h:137: parse error before "__ctype_get_mb_cur_max"
/usr/include/stdlib.h:431: parse error before "size_t"
/usr/include/stdlib.h:460: parse error before "size_t"
/usr/include/stdlib.h:554: parse error before "__size"
/usr/include/stdlib.h:556: parse error before "__nmemb"
/usr/include/stdlib.h:565: parse error before "size_t"
In file included from /usr/include/stdlib.h:576,
                 from fingerprint.c:16:
/usr/include/alloca.h:33: parse error before "__size"
In file included from fingerprint.c:16:
/usr/include/stdlib.h:581: parse error before "__size"
/usr/include/stdlib.h:731: parse error before "size_t"
/usr/include/stdlib.h:735: parse error before "size_t"
/usr/include/stdlib.h:804: parse error before "size_t"
/usr/include/stdlib.h:807: parse error before "size_t"
/usr/include/stdlib.h:811: parse error before "size_t"
/usr/include/stdlib.h:814: parse error before "size_t"
/usr/include/stdlib.h:822: parse error before "size_t"
/usr/include/stdlib.h:826: parse error before "size_t"
/usr/include/stdlib.h:833: parse error before "mbstowcs"
/usr/include/stdlib.h:834: parse error before "size_t"
/usr/include/stdlib.h:836: parse error before "wcstombs"
/usr/include/stdlib.h:837: parse error before "size_t"
In file included from fingerprint.c:17:
/usr/include/unistd.h:310: parse error before "size_t"
/usr/include/unistd.h:313: parse error before "size_t"
/usr/include/unistd.h:423: parse error before "size_t"
In file included from fingerprint.c:17:
/usr/include/unistd.h:513: parse error before "confstr"
/usr/include/unistd.h:513: parse error before "size_t"
/usr/include/unistd.h:664: parse error before "size_t"
/usr/include/unistd.h:689: parse error before "size_t"
In file included from fingerprint.c:17:
/usr/include/unistd.h:734: parse error before "size_t"
/usr/include/unistd.h:741: parse error before "size_t"
/usr/include/unistd.h:751: parse error before "size_t"
/usr/include/unistd.h:752: parse error before "size_t"
/usr/include/unistd.h:769: parse error before "size_t"
fingerprint.c:111:41: warning: multi-line string literals are deprecated
fingerprint.c:138: parse error before '--' token
fingerprint.c:139: redefinition of `charset'
fingerprint.c:1: `charset' previously defined here
fingerprint.c:139: `us' undeclared here (not in a function)
fingerprint.c:140: `ascii' undeclared here (not in a function)
fingerprint.c:140: parse error before "Content"
fingerprint.c:140: redefinition of `filename'
fingerprint.c:2: `filename' previously defined here
fingerprint.c:140: `big' undeclared here (not in a function)
fingerprint.c:140: `vector' undeclared here (not in a function)
fingerprint.c:142:2: invalid preprocessing directive #!
fingerprint.c:143: `angle' undeclared here (not in a function)
fingerprint.c:143: parse error before "use"
fingerprint.c:144:3: invalid preprocessing directive #given
fingerprint.c:145:3: invalid preprocessing directive #compute
fingerprint.c:147: warning: data definition has no type or storage class
fingerprint.c:148: syntax error at '@' token
fingerprint.c:148: parse error before "lines"
fingerprint.c:148: warning: data definition has no type or storage class
fingerprint.c:149: parse error before '%' token
fingerprint.c:151: syntax error at '@' token
fingerprint.c:151: `$file' redeclared as different kind of symbol
fingerprint.c:147: previous declaration of `$file'
fingerprint.c: In function `$file':
fingerprint.c:152: parse error before "INFILE"
fingerprint.c:153: syntax error at '@' token
fingerprint.c:153: parse error before '<' token
fingerprint.c:154: syntax error at '@' token
fingerprint.c:154: `chomp' undeclared (first use in this function)
fingerprint.c:154: (Each undeclared identifier is reported only once
fingerprint.c:154: for each function it appears in.)
fingerprint.c:155: `$vectors' undeclared (first use in this function)
fingerprint.c:155: syntax error at '@' token
fingerprint.c:156: `my' undeclared (first use in this function)
fingerprint.c:157: `map' undeclared (first use in this function)
fingerprint.c:157: syntax error at '@' token
fingerprint.c:158: `$magnitudes' undeclared (first use in this function)
fingerprint.c: At top level:
fingerprint.c:161: syntax error at '@' token
fingerprint.c:161: parse error before "cosines"
fingerprint.c:161: warning: data definition has no type or storage class
fingerprint.c:162: parse error before '%' token
fingerprint.c:164: warning: data definition has no type or storage class
fingerprint.c:165: parse error before "$file"
fingerprint.c:165: parse error before "keys"
fingerprint.c:165: redefinition of `$file'
fingerprint.c:151: `$file' previously defined here
fingerprint.c: In function `$file':
fingerprint.c:166: `my' undeclared (first use in this function)
fingerprint.c:166: parse error before "$vec1"
fingerprint.c: At top level:
fingerprint.c:167: parse error before "$file2"
fingerprint.c:167: parse error before "keys"
fingerprint.c:167: `$file2' redeclared as different kind of symbol
fingerprint.c:164: previous declaration of `$file2'
fingerprint.c: In function `$file2':
fingerprint.c:168: `next' undeclared (first use in this function)
fingerprint.c:168: parse error before "unless"
fingerprint.c:168: syntax error at '#' token
fingerprint.c:168: `compare' undeclared (first use in this function)
fingerprint.c:171: syntax error at '@' token
fingerprint.c:171: `$vec2' undeclared (first use in this function)
fingerprint.c:171: syntax error at '@' token
fingerprint.c:171: `$vec1' undeclared (first use in this function)
fingerprint.c:172: `warn' undeclared (first use in this function)
fingerprint.c:172: parse error before string constant
fingerprint.c:173: syntax error at '@' token
fingerprint.c:173: syntax error at '@' token
fingerprint.c:176: `my' undeclared (first use in this function)
fingerprint.c:176: parse error before "$dot"
fingerprint.c:177: `map' undeclared (first use in this function)
fingerprint.c:177: too many decimal points in floating constant
fingerprint.c:177: syntax error at '#' token
fingerprint.c:180: syntax error at '@' token
fingerprint.c:180: `push' undeclared (first use in this function)
fingerprint.c:181: `$cosines' undeclared (first use in this function)
fingerprint.c: At top level:
fingerprint.c:186: syntax error at '@' token
fingerprint.c:187: syntax error at '@' token
fingerprint.c:192: parse error before "keys"
fingerprint.c:192: redefinition of `$file'
fingerprint.c:165: `$file' previously defined here
fingerprint.c: In function `$file':
fingerprint.c:193: syntax error at '@' token
fingerprint.c:193: `my' undeclared (first use in this function)
fingerprint.c:193: parse error before "keys"
fingerprint.c: At top level:
fingerprint.c:194: parse error before "unless"
fingerprint.c:194: syntax error at '@' token
fingerprint.c:194: warning: data definition has no type or storage class
fingerprint.c:195: parse error before "$most_similar_file"
fingerprint.c:195: syntax error at '@' token
fingerprint.c:195: `shift' undeclared here (not in a function)
fingerprint.c:195: parse error before "keys"
fingerprint.c:196: `$cosines' undeclared here (not in a function)
fingerprint.c:196: parse error before '{' token
fingerprint.c:197: parse error before "$file2"
fingerprint.c:197: syntax error at '@' token
fingerprint.c:197: redefinition of `$file2'
fingerprint.c:167: `$file2' previously defined here
fingerprint.c: In function `$file2':
fingerprint.c:198: `$cosines' undeclared (first use in this function)
fingerprint.c:198: parse error before '{' token
fingerprint.c: At top level:
fingerprint.c:200: redefinition of `$most_similar_cosine'
fingerprint.c:196: `$most_similar_cosine' previously defined here
fingerprint.c:200: `$cosines' undeclared here (not in a function)
fingerprint.c:200: parse error before '{' token
/usr/include/gconv.h:172: warning: array `__data' assumed to have one element
Back to top
View user's profile Send private message
fifo
Guru
Guru


Joined: 14 Jan 2003
Posts: 437

PostPosted: Sun Mar 02, 2003 11:20 pm    Post subject: Reply with quote

The mime header isn't part of the source file. You only want to save the text starting with
Code:
/*
 * Fingerprint a file.

and ending with
Code:
   return 0;
}

as fingerprint.c.
Back to top
View user's profile Send private message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Mon Mar 03, 2003 6:12 am    Post subject: Reply with quote

okay I did that and got this:
Code:
root@tau Directory # gcc fingerprint.c
fingerprint.c:108:41: warning: multi-line string literals are deprecated


then I did the same thing for big-vector-angle and got this:
Code:
root@tau Directory # gcc fingerprint.c
fingerprint.c:108:41: warning: multi-line string literals are deprecated



however I didn't set any kind of file flags or anything(didn't know what to set or what to set it to), I just copy/paste right into nano.:clued-out:

Thanks for helping me, do you know what I did wrong now?
Peace.
Back to top
View user's profile Send private message
fifo
Guru
Guru


Joined: 14 Jan 2003
Posts: 437

PostPosted: Mon Mar 03, 2003 12:04 pm    Post subject: Reply with quote

For me, it compiles without any warnings. Make sure you've got word wrap turned off in nano (i.e. start it with "nano -w" or use some other editor) as that warning sounds like it's inserted a new line in the middle of a string. You don't need to compile big-vector-angle, but you do need to set executable permissions with
Code:

$ chmod a+x big-vector-angle

before you can run it.
Back to top
View user's profile Send private message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Tue Mar 04, 2003 1:46 am    Post subject: Reply with quote

It compiled fine but here's what I'm looking @:
Code:
root@tau Directory # ./a.out --help
bash: ./a.out: Permission denied


and the vector:
Code:
root@tau Directory # ./big-vector-angle
bash: ./big-vector-angle: /usr/bin/perl: bad interpreter: Permission denied


I did do the chmod on the vector file and a.out is the only file that is new after I compile fingerprint.c.

Is this just what this software does?

Thanks for being so patient I feel totaly helpless, odd since I used to do a little C++... Guess my coding brain is lost forever....:sigh:
Back to top
View user's profile Send private message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Tue Mar 04, 2003 1:55 am    Post subject: Reply with quote

my email to the address on his site bounced back like a rubber ball:(

Hard to believe I'm the only one who want's to do this type of thing (test SQ loss after compress/decompress audio files)
Back to top
View user's profile Send private message
fifo
Guru
Guru


Joined: 14 Jan 2003
Posts: 437

PostPosted: Tue Mar 04, 2003 3:15 am    Post subject: Reply with quote

Well, I do
Code:
$ ./a.out somefile

and it produces a file called somefile.fingerprint. You could try resetting the permissions:
Code:
$ chmod 755 a.out big-vector-angle


BTW, I'm not convinced this program will do what you want. From reading the description, it sounds like it's intended for finding similarities between plain text files, and it probably won't work too well on binary audio data.
Back to top
View user's profile Send private message
zenon
Apprentice
Apprentice


Joined: 09 Oct 2002
Posts: 263

PostPosted: Tue Mar 11, 2003 4:49 pm    Post subject: Reply with quote

Thnaks, it's working now... I had to move it off my FAT32 partition to my ReiserFS partition.

I think you're right:
Code:
Most similar to:
Enigma - 01 - The voice of enigma orig.wav.fingerprint: Enigma - 01 - The voice of enigma.mp3.wav.fingerprint (0.999792824976158)
Enigma - 01 - The voice of enigma.mp3.mp3.fingerprint: Enigma - 01 - The voice of enigma orig.wav.fingerprint (0.998321185814241)
Enigma - 01 - The voice of enigma.mp3.wav.fingerprint: Enigma - 01 - The voice of enigma orig.wav.fingerprint (0.999792824976158)


If there were some app that converted a binary file to ASCII code would that help?

or am I SOL?

thanks for all your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum