-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes clang++9 error in cram_io.h #1190
Conversation
…char *' with an rvalue of type 'void *'
The full error was:
|
That is indeed the only error from compiling the cram/*.h headers with a C++ compiler so it's probably worth applying this, but the real problem is that freebayes shouldn't be including these private headers. Freebayes should apply walaj/SeqLib#53 to its bundled SeqLib. |
Thanks. I'll apply the patch to the bundled SeqLib files. I'll remove the implicit cram includes. |
freebayes now compiles a stock htslib - no more bundled source. Above error may act like a canary in the coal mine ;) |
Thanks, closing as it appears to be no longer be a problem. Please raise an issue if you find you still need something like this. |
I think I'm getting this issue on the following line of code when trying to compile htslib with clang++ in a Mac OS X environment: https://github.com/samtools/htslib/blob/develop/cram/cram_io.h#L217 Here's the error: EDIT: Quick follow-up, the same fix seemed to have worked: Specifically, I just did the following before running sed -i.bak 's/unsigned char \*tmp = realloc(b->data, len);/unsigned char \*tmp = (unsigned char \*)realloc(b->data, len);/g' htslib/cram/cram_io.h which just replaces this: unsigned char *tmp = realloc(b->data, len); with this: unsigned char *tmp = (unsigned char *)realloc(b->data, len); |
The public header files should be capable of being included by C++ files, but the actual htslib library (both C and non-public header files) are in C, not C++. We don't make our C code swallowable by C++. That includes the internal cram/cram_io.h file. Is there a reason you can't build htslib using its own supplied build system? |
This is bioconda/bioconda-recipes#43322, so the best answer is that @niemasd's recipe should compile against bioconda's packaged htslib instead of building htslib at all. |
I've made niemasd/ViralConsensus#9, which removes the use of CRAM internals from ViralConsensus. |
Ah, thank you so much, @daviesrob! I couldn't figure out how to use the local reference properly, and this was what I found when I dug through the source code of other tools that use htslib. I appreciate it! I wonder if it makes sense to have a "How to properly include htslib in your code" guide? I tried looking through the htslib documentation, and I couldn't find anything. Even now that I know the solution, when I Google "hts_set_opt" "cram", I don't find any results that would have suggested this solution, whereas "Load a SAM/BAM/CRAM file and iterate over it" is a very common use-case |
Even though it is sitting in an extern "C" block the clang++ compiler won't accept this void * assignment.