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

Fix compilation on newer gcc versions #141

Closed JacobHayes closed 1 year ago

JacobHayes commented 1 year ago

Follow up to https://github.com/andersen-lab/ivar/pull/135#issuecomment-1278491469 - that PR was closed in favor of #136, but they handled different GCC compilation issues. This fixes the last compilation issue, but with a slight tweak to #135 to use delete[].


I was able to reproduce the issue and fix by running docker run --rm -it ubuntu:22.04 bash and then running the following:

apt-get update
apt-get install -yq --no-install-recommends automake build-essential ca-certificates libbz2-dev libcurl4-openssl-dev liblzma-dev wget zlib1g-dev

# Install htslib
mkdir -p /tmp/htslib
cd /tmp/htslib
wget https://github.com/samtools/htslib/releases/download/1.16/htslib-1.16.tar.bz2
tar -xjf htslib-1.16.tar.bz2
cd htslib-1.16
make
make install
cd /tmp
rm -rf /tmp/htslib
ldconfig

# Install ivar
mkdir -p /tmp/ivar
cd /tmp/ivar
wget -O ivar.tar.gz https://github.com/andersen-lab/ivar/archive/bafc7b93b195b83caf0a8e8054f49565cb6dee79.tar.gz
tar --strip-components=1 -xf ivar.tar.gz
./autogen.sh
./configure
#####################################################
make # fails
sed -i 's/free(files);/delete[] files;/' src/ivar.cpp
make # succeeds now
#####################################################
cmaceves commented 1 year ago

@JacobHayes okay, thank you for bringing this up, approving github action tests, and I will take a look at the code!

JacobHayes commented 1 year ago

Thanks!