noporpoise / seq-align

Fast, portable C implementations of Needleman-Wunsch and Smith-Waterman sequence alignment
94 stars 39 forks source link

Cross platform build #6

Closed DanielTillett closed 7 years ago

DanielTillett commented 7 years ago

I am trying to get this to build cross platform and I have hit a block under Windows. This issue is the __typeof declaration you are using in bit_macros.h. This is a GCC extension that does not exist in MSVC. Any suggestions?

noporpoise commented 7 years ago

Sorry I don't have any experience developing on Windows. Could you replace typeof(x) with decltype(x)?

The alternative is replacing the bit_array library with simpler portable code that does what we need in seq-align.

DanielTillett commented 7 years ago

The trouble is decltype is C++11 only, and is not in C.

Pulling the bit-array library out of your code is not easy given the way it is used. If you can’t fix it it might be worth pulling out all the WIN32 defs you have in the code so people like me don’t think the code is portable.

noporpoise commented 7 years ago

I've pulled the bit_array library out. Let me know if you're any closer to a clean compilation on Windows. Thanks.

DanielTillett commented 7 years ago

Thanks for this. I can now get it to build on Windows once I have fixed the ROUNDUP2POW macro.

I do have a question - is there are reason that you have typedef score_t to an int rather than size_t? If I leave this typedef as an int is gives crazy scores while size_t works fine.

noporpoise commented 7 years ago

Glad to hear it's compiling now. I'm guessing you're using a 32 bit machine / version of Windows?

I identified an issue on machines where long is actually just an int (some 32 bit machine apparently!) and just pushed a commit to fix this along with a portable version of ROUNDUP2POW(). Let me know if this fixes your issues.

The reason score_t is an int is that scores can be negative in the case of Needleman-Wunsch global alignments. size_t is an unsigned integer.

Thanks for getting seq-align working on Windows. I really appreciate the testing.