Author Topic: h2incn usage and compile  (Read 6580 times)

Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
h2incn usage and compile
« on: September 05, 2015, 05:06:05 PM »
Hello,
Can someone please tell me how to compile h2incn ? I try with gcc but i am getting an error.

Thank you

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: h2incn usage and compile
« Reply #1 on: September 05, 2015, 08:28:49 PM »
Hi Nikipa,

I can refer you to this:

http://forum.nasm.us/index.php?topic=874.0

I can suggest that if you're having trouble, with code you wrote for Nasm, somebody else's code for Nasm, Nasm itself, or something else... tell us exactly what you did and exactly what happened. This helps clarify the view into our crystal ball. :)

Here's what I did: (all on 32-bit Linux)

downloaded:

http://sourceforge.net/code-snapshots/svn/h/h2/h2incn/code/h2incn-code-10-trunk.zip

unzipped it,got into that directory, didn't see a makefile or configure so tried:

gcc -o h2incn h2incn.c hashmap.c bintree.asm fnv1hash.asm

got some warnings, and an error about "conflicting types for 'hash_map_insert'" (and where it was found)

I strongly suspect I need to assemble the two .asm files with Nasm and feed gcc the .o files, but haven't gotten that far yet.

I have a working(?) version of "/usr/local/bin/h2incn", but "h2incn -v" doesn't tell me where it came from. Might be an older Johannes Kroll version, but I think I got something from Rob that worked better...

That's as far as I've gotten so far. Hoping Rob will check in...

What's it sayin' to you?

Best,
Frank


Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
Re: h2incn usage and compile
« Reply #2 on: September 05, 2015, 10:10:41 PM »
Hello,
Sorry for not posting the results of my command. I executed the same command like you and here are my results

Quote
In file included from h2incn.c:38:0:
h2incn.h:28:1: warning: useless storage class specifier in empty declaration [e
abled by default]
 };
 ^
h2incn.h:42:1: warning: useless storage class specifier in empty declaration [e
abled by default]
 };
 ^
In file included from h2incn.c:39:0:
hashmap.h:27:1: warning: useless storage class specifier in empty declaration [
nabled by default]
 };
 ^
In file included from hashmap.c:11:0:
hashmap.h:27:1: warning: useless storage class specifier in empty declaration [
nabled by default]
 };
 ^
hashmap.c: In function 'hash_map_alloc':
hashmap.c:90:27: warning: multi-character character constant [-Wmultichar]
       pHashMap->magic   = 'pdhm';
                           ^
hashmap.c: At top level:
hashmap.c:154:5: error: conflicting types for 'hash_map_insert'
 int hash_map_insert(struct hash_map_t* pHashMap, void *key, unsigned int klen,
char *value, unsigned int vlen)
     ^
In file included from hashmap.c:11:0:
hashmap.h:42:5: note: previous declaration of 'hash_map_insert' was here
 int hash_map_insert(struct hash_map_t *map, void *key, unsigned int klen, void
*value, unsigned int vlen);
     ^
hashmap.c: In function 'hash_map_free':
hashmap.c:267:28: warning: multi-character character constant [-Wmultichar]
    if ( pHashMap->magic != 'pdhm' )
                            ^


I am using Windows 8.1. :)

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: h2incn usage and compile
« Reply #3 on: September 05, 2015, 11:24:57 PM »
Yeah, those look familiar. Flailing around, I changed "void *value" to "char *value". Got me a bunch more errors (which I won't copy here, right now) - looks like it maybe compiled and these are from the linker? I'm afraid I don't know how to fix this right now... may flail around more later...

Best,
Frank


Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
Re: h2incn usage and compile
« Reply #4 on: September 05, 2015, 11:47:42 PM »
Oh ok , at least i am not the only one who has this problem :P

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: h2incn usage and compile
« Reply #5 on: September 06, 2015, 09:12:44 AM »
No. Rather unexpected! I suspect Rob got interrupted in the middle of a revision. So flailing around some more...

As noted above... "void *value" wants to be "char *value" - this is in "hashmap.h" about line 41. As noted above, this causes a bunch of errors - but from the linker! Progress, though it doesn't seem like it. Stuff like "_memcpy" - that shouldn't have an underscore on it for Linux. This is in bintree.asm. This shouldn't bother you for Windows(?). I did a bunch of %define's and it seemed to compile - tons of warnings (ignoring warnings is a BAD idea!) but no errors.

This is NOT the way to do version control!

Best,
Frank


Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: h2incn usage and compile
« Reply #6 on: September 06, 2015, 03:05:13 PM »
Oh wow, I completely forgot about this.  :o
Note that this was just a toy project that has been idle for 5 years now.
I'll try to give it a look over the weekend, refresh my memory, and see if I can make any small changes that will help.