genotrance / nimfuzzy

Nimfuzz is a Nim wrapper for the fts_fuzzy_match library by Forrest Smith
MIT License
8 stars 2 forks source link

Errors on Win10 #2

Open tajmone opened 5 years ago

tajmone commented 5 years ago

Hi @genotrance ,

I'm experiencing problems using nimfuzzy under Windows 10 x64, Nim v0.20.0, GCC 6.3.0.

I've installed nimfuzzy via Nimble, and when I run the included test it compiles fine.

Yet, when I try to use nimfuzzy from my own code, I get the following compiler error:

Error: execution of an external compiler program 'gcc.exe -c  -w -mno-ms-bitfields -I"C:/Users/XXXXX/.nimble/pkgs/nimfuzzy-0.1.5/nimfuzzy" -O3 -fno-strict-aliasing  -IC:\Nim\lib -ID:\GitHub\Fuzzy-Search\fuzzy-search_Wk\TESTS\NimFuzzy -o C:\Users\XXXXX\nimcache\test_r\test.nim.c.o C:\Users\XXXXX\nimcache\test_r\test.nim.c' failed with exit code: 1

In file included from C:\Users\XXXXX\nimcache\test_r\test.nim.c:12:0:
C:/Users/XXXXX/.nimble/pkgs/nimfuzzy-0.1.5/nimfuzzy/fts_fuzzy_match.h:34:30: fatal error: cstdint: No such file or directory
 #include <cstdint> // uint8_t

The error seems to be related to GCC and #include <cstdint>, for I get the same error when trying to compile the C++ (11) example that ships with fts_fuzzy_match — I haven't managed to compile that example at all.

The strange thing is that nimfuzzy/tests/fuzztest.nim compile fine. So the problem seems to be a conflict with the default Nim compile configuration.

Any ideas if there are compile switches to fix that?

tajmone commented 5 years ago

I've finally managed to compile my Nim application that uses nimfuzzy via the following batch:

nim cpp ^
  --passC:"-std=c++11" ^
  --passC:"-DFTS_FUZZY_MATCH_IMPLEMENTATION" ^
    test.nim

It looks like compilation failure was due to the missing -DFTS_FUZZY_MATCH_IMPLEMENTATION option. Could you clarify better this problem? I though that having installed nimfuzzy via Nimble was sufficient to ensure that all compiler settings would be in place for project using this package.

Maybe it's worth adding a few notes on this in the nimfuzzy documentation.

genotrance commented 5 years ago

I had this defined in the nimble file:

https://github.com/genotrance/nimfuzzy/blob/master/nimfuzzy.nimble#L31

I presumed folks would read it but guess it would be better to explain in the readme as well.

We could also just do {.passC: "--std=c++11 -DFTS_FUZZY_MATCH_IMPLEMENTATION".} and make things simpler.

tajmone commented 5 years ago

I had this defined in the nimble file:

https://github.com/genotrance/nimfuzzy/blob/master/nimfuzzy.nimble#L31

I presumed folks would read it but guess it would be better to explain in the readme as well.

Yes, this is how I ultimately managed to compile it. Since I'm new to Nim, I thought that this was only required by the numfuzzy package setup and that by including nimfuzzy it would all be taken care of.

Adding a few notes to the package documentation would be a good idea, especially since the ntf_fuzzy_match documentation doesn't provide compilation guidelines (except a comment in the source file).

We could also just do {.passC: "--std=c++11 -DFTS_FUZZY_MATCH_IMPLEMENTATION".} and make things simpler.

That would be great!