andersen-lab / ivar

iVar is a computational package that contains functions broadly useful for viral amplicon-based sequencing.
https://andersen-lab.github.io/ivar/html/
GNU General Public License v3.0
115 stars 39 forks source link

call_consensus_pileup.h: fix build failure with Gcc 12 #136

Closed emollier closed 2 years ago

emollier commented 2 years ago

Since Gcc 12, C string header has been removed from most standard C++ includes. This causes the following build error, initially reported in Debian Bug#1012952:

call_consensus_pileup.cpp:138:3: error: ‘strcpy’ was not declared in this scope

Bringing back manually one of cstring or string.h inside the header call_consensus_pileup.h fixes the issue.

The original patch brought in Debian applies to ivar release 1.3.1 to correct the following symptom, but apparently the master branch diverged from the release, so the delete[] files fixing the issue below may not be needed, but I mention it anyway, just in case this were to be of interest:

ivar.cpp:487:14: error: ‘void operator delete(void*)’ called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete]
  487 |       delete files;
      |              ^~~~~
ivar.cpp:467:33: note: returned from ‘void* operator new [](std::size_t)’
  467 |     char **files = new char*[100];
      |                                 ^

Signed-off-by: Étienne Mollier emollier@debian.org

cmaceves commented 2 years ago

thanks for the contribution!