diff --git a/1.9/Makefile b/1.9/Makefile index 666c4740..2436e321 100644 --- a/1.9/Makefile +++ b/1.9/Makefile @@ -47,7 +47,7 @@ ifeq ($(SYS), MAC) CXXFLAGS += $(MACFLAGS) BLASFLAGS ?= -framework Accelerate LDFLAGS ?= -ldl - ZLIB ?= -L. ../zlib-1.2.13/libz.a + ZLIB ?= -L. ../zlib-1.3/libz.a endif ifeq ($(SYS), WIN) @@ -58,13 +58,13 @@ ifeq ($(SYS), WIN) # NO_LAPACK. BLASFLAGS ?= -L. lapack/liblapack.a -L. lapack/librefblas.a LDFLAGS ?= -lm -static-libgcc - ZLIB ?= -L. ../zlib-1.2.13/libz.a + ZLIB ?= -L. ../zlib-1.3/libz.a endif # These must appear after the MAC/WIN-specific ?= statements. BLASFLAGS ?= -L/usr/lib64/atlas -llapack -lblas -lcblas -latlas LDFLAGS ?= -lm -lpthread -ldl -ZLIB ?= -L. ../zlib-1.2.13/libz.so.1.2.13 +ZLIB ?= -L. ../zlib-1.3/libz.so.1.3 ifdef NO_LAPACK BLASFLAGS= diff --git a/1.9/Makefile.old b/1.9/Makefile.old deleted file mode 100644 index 979a2487..00000000 --- a/1.9/Makefile.old +++ /dev/null @@ -1,106 +0,0 @@ -# This is a bit of a mess. Work with Makefile.std instead. - -CFLAGS=-Wall -O2 -BLASFLAGS=-L/usr/lib64/atlas -llapack -lcblas -latlas -BLASFLAGS64=-L/usr/lib64/atlas -llapack -lcblas -latlas -LINKFLAGS=-lm -lpthread -ZLIB=../zlib-1.2.12/libz.so.1.2.12 - -UNAME := $(shell uname) -ifeq ($(UNAME), Darwin) - CFLAGS=-Wall -O2 -mmacosx-version-min=10.7 -stdlib=libc++ - GCC_GTEQ_43 := $(shell expr `g++ -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 40300) - ifeq "$(GCC_GTEQ_43)" "1" - CFLAGS=-Wall -O2 -flax-vector-conversions -mmacosx-version-min=10.7 - endif - BLASFLAGS=-framework Accelerate - BLASFLAGS64=-framework Accelerate - LINKFLAGS=-ldl - ZLIB=../zlib-1.2.12/libz-32.a - ZLIB64=../zlib-1.2.12/libz-64.a -else - ifeq ($(UNAME), MINGW32_NT-6.2) - BLASFLAGS=-Wl,-Bstatic -L. lapack/liblapack.a -L. lapack/librefblas.a - BLASFLAGS64=-Wl,-Bstatic -L. lapack/liblapack-64.a -L. lapack/librefblas-64.a - LINKFLAGS=-lm -static-libgcc - ZLIB=../zlib-1.2.12/libz-32.a - ZLIB64=../zlib-1.2.12/libz-64.a - endif -endif - -CSRC = plink.c plink_assoc.c plink_calc.c plink_cluster.c plink_cnv.c plink_common.c plink_data.c plink_dosage.c plink_family.c plink_filter.c plink_glm.c plink_help.c plink_homozyg.c plink_lasso.c plink_ld.c plink_matrix.c plink_misc.c plink_perm.c plink_rserve.c plink_set.c plink_stats.c SFMT.c dcdflib.c pigz.c yarn.c hfile.c bgzf.c - -CCSRC = Rconnection.cc - -SRC = $(CSRC) $(CCSRC) - -OBJ = $(CSRC:.c=.o) $(CCSRC:.cc=.o) - -%.o: %.c - g++ -x c++ -c $(CFLAGS) -o $@ $< - -%.o: %.cc - g++ -x c++ -c $(CFLAGS) -o $@ $< - -plink64: $(OBJ) - g++ $(CFLAGS) $(OBJ) -o plink $(BLASFLAGS64) $(LINKFLAGS) -L. $(ZLIB64) -# for clean build, "make clobber" first - -plink: $(SRC) - g++ -x c++ $(CFLAGS) $(SRC) -m32 -x none -o plink $(BLASFLAGS) $(LINKFLAGS) -L. $(ZLIB) - -plinkw: $(SRC) - g++ $(CFLAGS) $(SRC) -c - gfortran -O2 $(OBJ) -o plink $(BLASFLAGS) $(LINKFLAGS) -L. $(ZLIB) - -plinkc: $(SRC) - gcc $(CFLAGS) $(CSRC) -std=c99 -m32 -x none -o plink $(BLASFLAGS) $(LINKFLAGS) -L. $(ZLIB) - -plinks: $(SRC) - g++ $(CFLAGS) $(SRC) -o plink_linux_s -Wl,-Bstatic $(BLASFLAGS) -Wl,-Bdynamic $(LINKFLAGS) -L. $(ZLIB) - -plinkd: $(SRC) - g++ $(CFLAGS) $(SRC) -o plink_linux $(BLASFLAGS) -Wl,-Bdynamic $(LINKFLAGS) -L. $(ZLIB) - -plinknl: $(SRC) - g++ $(CFLAGS) $(SRC) -o plink $(LINKFLAGS) -Wl,-Bstatic -L. $(ZLIB) - -plink64w: $(SRC) - g++ $(CFLAGS) $(SRC) -c - gfortran -O2 $(OBJ) -o plink64 $(BLASFLAGS64) $(LINKFLAGS) -L. $(ZLIB64) - -plink64c: $(SRC) - gcc $(CFLAGS) $(CSRC) -std=c99 -x none -o plink $(BLASFLAGS64) $(LINKFLAGS) -L. $(ZLIB64) - -plink64nl: $(SRC) - g++ $(CFLAGS) $(SRC) -o plink $(LINKFLAGS) -L. $(ZLIB64) - -pigz_test: pigz_test.c pigz.c yarn.c - g++ -Wall -O2 pigz_test.c pigz.c yarn.c -o pigz_test -L. $(ZLIB64) - -prettify: prettify.c - gcc -Wall -O2 prettify.c -o prettify - -prettifyw: prettify.c - gcc -Wall -O2 prettify.c -o prettify - -dbl2txt: dbl2txt.c - gcc -Wall -O2 dbl2txt.c -o dbl2txt - -nsort: nsort.c - gcc -Wall -O2 nsort.c -o nsort - -interval_merge: interval_merge.c - gcc -Wall -O2 interval_merge.c -o interval_merge - -dose2plink32: dose2plink.c - g++ -Wall -O2 -lm -m32 dose2plink.c -o dose2plink -L. $(ZLIB) - -dose2plink: dose2plink.c - g++ -Wall -O2 -lm dose2plink.c -o dose2plink -L. $(ZLIB64) - -bgen_to_gen: bgen_to_gen.c plink_common.c SFMT.c pigz.c yarn.c - g++ -x c++ -Wall -O2 -DDYNAMIC_ZLIB bgen_to_gen.c plink_common.c SFMT.c pigz.c yarn.c -o bgen_to_gen $(BLASFLAGS64) $(LINKFLAGS) -lz - -clobber: - rm -f *.o diff --git a/1.9/Makefile.std b/1.9/Makefile.std deleted file mode 100644 index 398949db..00000000 --- a/1.9/Makefile.std +++ /dev/null @@ -1,104 +0,0 @@ -# General-purpose Makefile for PLINK 1.90 -# -# Compilation options: -# Do not link to LAPACK NO_LAPACK - -# Leave blank after "=" to disable; put "= 1" to enable -# (when enabled, "#define NOLAPACK" must be uncommented in plink_common.h) -NO_LAPACK = - -# Variable that allows additional linker flags (e.g., "-L/path/to/libs") to be -# passed into the linker; to use this, invoke 'make LDFLAGS_EXTRA=""'. -LDFLAGS_EXTRA = - -.PHONY: clean install - -# should autodetect system -SYS = UNIX -ifdef SystemRoot - SYS = WIN -else - UNAME := $(shell uname) - ifeq ($(UNAME), Darwin) - SYS = MAC - endif -endif - -# Allow these to be overridden by make arguments or env variables, so people -# don't have to edit the Makefile to build in a different environment. -BIN ?= plink -CC ?= gcc -CXX ?= g++ -CFLAGS ?= -Wall -O2 -CXXFLAGS ?= -Wall -O2 - -PREFIX ?= /usr/local -DESTDIR ?= . -INSTALL ?= install -STRIP ?= strip - -ifeq ($(SYS), MAC) - GCC_GTEQ_43 := $(shell expr `g++ -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 40300) - ifeq "$(GCC_GTEQ_43)" "1" - CFLAGS ?= -Wall -O2 -flax-vector-conversions - endif - BLASFLAGS ?= -framework Accelerate - LDFLAGS ?= -ldl - ZLIB ?= ../zlib-1.2.12/libz.1.2.12.dylib -endif - -ifeq ($(SYS), WIN) -# Note that, unlike the Linux and Mac build processes, this STATICALLY links -# LAPACK, since we have not gotten around to trying dynamically-linked LAPACK -# on Windows. -# If you don't already have LAPACK built, you'll probably want to turn on -# NO_LAPACK. - BLASFLAGS ?= -L. lapack/liblapack.a -L. lapack/librefblas.a - LDFLAGS ?= -lm -static-libgcc - ZLIB ?= ../zlib-1.2.12/libz.a -endif - -# These must appear after the MAC/WIN-specific ?= statements. -BLASFLAGS ?= -L/usr/lib64/atlas -llapack -lblas -lcblas -latlas -LDFLAGS ?= -lm -lpthread -ldl -ZLIB ?= ../zlib-1.2.12/libz.so.1.2.12 - -ifdef NO_LAPACK - BLASFLAGS= -endif - -OBJS = plink.o plink_assoc.o plink_calc.o plink_cluster.o plink_cnv.o plink_common.o plink_data.o plink_dosage.o plink_family.o plink_filter.o plink_glm.o plink_help.o plink_homozyg.o plink_lasso.o plink_ld.o plink_matrix.o plink_misc.o plink_perm.o plink_rserve.o plink_set.o plink_stats.o SFMT.o dcdflib.o pigz.o yarn.o Rconnection.o hfile.o bgzf.o - -# In the event that you are still concurrently using PLINK 1.07, we suggest -# renaming that binary to "plink107", and this one to "plink" or "plink1". - -all: $(BIN) - -plink: $(OBJS) - $(CXX) $(OBJS) $(LDFLAGS_EXTRA) $(BLASFLAGS) $(LDFLAGS) -L. $(ZLIB) -o $@ - -plinkw: $(OBJS) - gfortran -O2 $(OBJS) $(LDFLAGS_EXTRA) -Wl,-Bstatic $(BLASFLAGS) $(LDFLAGS) -L. $(ZLIB) -o $@ - -install: - $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin - $(INSTALL) -c $(BIN) $(DESTDIR)$(PREFIX)/bin - -install-strip: install - $(STRIP) $(DESTDIR)$(PREFIX)/bin/$(BIN) - -clean: - rm -f $(OBJS) plink plinkw - -# Pattern-based rules for compiling object (.o) files; basically identical to -# GNU make's built-in rules, except we explicitly use "g++" instead of $(CC). - -# Compiling C files with a C++ compiler is deprecated, but the code needs -# to be cleaned up before we can switch to cc. E.g. plink_rserve.c -# includes a C++ header and exposed functions will need to be declared with -# extern "C". -%.o: %.c - $(CXX) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -%.o: %.cc - $(CXX) -x c++ -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ diff --git a/1.9/build_mac/Makefile b/1.9/build_mac/Makefile index 2a3f76f7..7d7f3439 100644 --- a/1.9/build_mac/Makefile +++ b/1.9/build_mac/Makefile @@ -25,8 +25,8 @@ ifeq ($(SYS), MAC) CXXFLAGS += $(MACFLAGS) BLASFLAGS ?= -framework Accelerate LDFLAGS ?= -ldl - ZLIB_AMD ?= -L. ../../zlib-1.2.13/libz-amd64.a - ZLIB_ARM ?= -L. ../../zlib-1.2.13/libz-arm64.a + ZLIB_AMD ?= -L. ../../zlib-1.3/libz-amd64.a + ZLIB_ARM ?= -L. ../../zlib-1.3/libz-arm64.a endif CCSRC = plink.c plink_assoc.c plink_calc.c plink_cluster.c plink_cnv.c plink_common.c plink_data.c plink_dosage.c plink_family.c plink_filter.c plink_glm.c plink_help.c plink_homozyg.c plink_lasso.c plink_ld.c plink_matrix.c plink_misc.c plink_perm.c plink_rserve.c plink_set.c plink_stats.c SFMT.c dcdflib.c pigz.c yarn.c Rconnection.cc hfile.c bgzf.c diff --git a/1.9/dose2plink.c b/1.9/dose2plink.c index 8ebe407e..3ccb5a22 100644 --- a/1.9/dose2plink.c +++ b/1.9/dose2plink.c @@ -96,7 +96,7 @@ #endif #endif -#include "../zlib-1.2.13/zlib.h" +#include "../zlib-1.3/zlib.h" #ifdef __APPLE__ #include diff --git a/1.9/pigz.c b/1.9/pigz.c index e695ca8d..58913a58 100644 --- a/1.9/pigz.c +++ b/1.9/pigz.c @@ -300,7 +300,7 @@ #ifdef DYNAMIC_ZLIB #include #else - #include "../zlib-1.2.13/zlib.h" + #include "../zlib-1.3/zlib.h" #endif #include "pigz.h" @@ -526,7 +526,7 @@ int32_t flex_pzwrite_close_null(Pigz_state* ps_ptr, char* writep) { #ifdef DYNAMIC_ZLIB #include #else - #include "../zlib-1.2.13/zlib.h" /* deflateInit2(), deflateReset(), deflate(), */ + #include "../zlib-1.3/zlib.h" /* deflateInit2(), deflateReset(), deflate(), */ /* deflateEnd(), deflateSetDictionary(), crc32(), inflateBackInit(), inflateBack(), inflateBackEnd(), Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY, diff --git a/1.9/plink.c b/1.9/plink.c index cd6b28cb..ce7f2b3d 100644 --- a/1.9/plink.c +++ b/1.9/plink.c @@ -105,10 +105,10 @@ static const char ver_str[] = #else " 32-bit" #endif - " (13 Feb 2023)"; + " (6 Sep 2023)"; static const char ver_str2[] = // include leading space if day < 10, so character length stays the same - "" + " " #ifdef STABLE_BUILD " " // (don't want this when version number has two trailing digits) #else diff --git a/1.9/plink_calc.c b/1.9/plink_calc.c index e1a9c0a3..d93a5d85 100644 --- a/1.9/plink_calc.c +++ b/1.9/plink_calc.c @@ -5442,7 +5442,6 @@ int32_t rel_cutoff_batch(uint32_t load_grm_bin, char* grmname, char* outname, ch uint32_t uii; uint32_t row; uint32_t col; - uint32_t new_row; uint32_t pct; uintptr_t sample_idx; int32_t* rel_ct_arr; @@ -5862,7 +5861,6 @@ int32_t rel_cutoff_batch(uint32_t load_grm_bin, char* grmname, char* outname, ch pct = 1; row = 0; col = 0; - new_row = 1; progress = 0; hundredth = 1 + ((((uint64_t)sample_ct) * (sample_ct - 1)) / 200); memcpy(outname_end, ".grm.N.bin", 11); @@ -5923,7 +5921,6 @@ int32_t rel_cutoff_batch(uint32_t load_grm_bin, char* grmname, char* outname, ch } } } - new_row++; } row++; progress += row; @@ -6700,7 +6697,7 @@ int32_t calc_rel(pthread_t* threads, uint32_t parallel_idx, uint32_t parallel_to } strcpy(outname_end, ".rel.bin"); if (parallel_tot > 1) { - sprintf(&(outname_end[8]), ".%u", parallel_idx + 1); + snprintf(&(outname_end[8]), MAX_POST_EXT - 8, ".%u", parallel_idx + 1); } if (fopen_checked(outname, FOPEN_WB, &outfile)) { goto calc_rel_ret_OPEN_FAIL; @@ -6793,7 +6790,7 @@ int32_t calc_rel(pthread_t* threads, uint32_t parallel_idx, uint32_t parallel_to // make this .rel.bin4? strcpy(outname_end, ".rel.bin"); if (parallel_tot > 1) { - sprintf(&(outname_end[8]), ".%u", parallel_idx + 1); + snprintf(&(outname_end[8]), MAX_POST_EXT - 8, ".%u", parallel_idx + 1); } if (fopen_checked(outname, FOPEN_WB, &outfile)) { goto calc_rel_ret_OPEN_FAIL; @@ -6857,7 +6854,7 @@ int32_t calc_rel(pthread_t* threads, uint32_t parallel_idx, uint32_t parallel_to } else { strcpy(outname_end, ".grm"); if (parallel_tot > 1) { - sprintf(&(outname_end[4]), ".%u", parallel_idx + 1); + snprintf(&(outname_end[4]), MAX_POST_EXT - 4, ".%u", parallel_idx + 1); } retval = write_uncompressed(outname, overflow_buf, 0, calc_rel_grm_emitn); if (retval) { @@ -6874,7 +6871,7 @@ int32_t calc_rel(pthread_t* threads, uint32_t parallel_idx, uint32_t parallel_to } else { strcpy(outname_end, ".rel"); if (parallel_tot > 1) { - sprintf(&(outname_end[4]), ".%u", parallel_idx + 1); + snprintf(&(outname_end[4]), MAX_POST_EXT - 4, ".%u", parallel_idx + 1); } } if (rel_shape == REL_CALC_TRI) { @@ -6938,7 +6935,7 @@ int32_t calc_rel(pthread_t* threads, uint32_t parallel_idx, uint32_t parallel_to if (retval) { goto calc_rel_ret_1; } - sprintf(wptr, " , and IDs written to %s .\n", outname); + snprintf(wptr, LOGBUFLEN - (wptr - g_logbuf), " , and IDs written to %s .\n", outname); } else { snprintf(g_logbuf, LOGBUFLEN, "Relationship matrix component written to %s .\n", outname); } @@ -8066,7 +8063,7 @@ int32_t calc_distance(pthread_t* threads, uint32_t parallel_idx, uint32_t parall if (retval) { goto calc_distance_ret_1; } - sprintf(wptr, " , and IDs to %s .\n", outname); + snprintf(wptr, LOGBUFLEN - (wptr - g_logbuf), " , and IDs to %s .\n", outname); } else { snprintf(g_logbuf, LOGBUFLEN, "Distances (proportions) written to %s .\n", outname); } diff --git a/1.9/plink_common.h b/1.9/plink_common.h index 29f0e68e..6a03b822 100644 --- a/1.9/plink_common.h +++ b/1.9/plink_common.h @@ -265,7 +265,7 @@ #error "zlib version 1.2.4 or later required." #endif #else - #include "../zlib-1.2.13/zlib.h" + #include "../zlib-1.3/zlib.h" #endif #include "SFMT.h" diff --git a/1.9/plink_first_compile b/1.9/plink_first_compile index 0a4e8332..cfedf0df 100755 --- a/1.9/plink_first_compile +++ b/1.9/plink_first_compile @@ -2,24 +2,24 @@ # Download zlib into parent directory, and verify cd .. -curl -Of http://zlib.net/zlib-1.2.13.tar.gz +curl -Of http://zlib.net/zlib-1.3.tar.gz last_exit_code=$? if [ $last_exit_code -ne 0 ]; then # There's a newer zlib, and we might want to update this script. But # download the hardcoded version for now to make the static build work... - curl -O http://zlib.net/fossils/zlib-1.2.13.tar.gz + curl -O http://zlib.net/fossils/zlib-1.3.tar.gz fi -EXPECTEDCHECKSUM=55eaa84906f31ac20d725aa26cd20839196b6ba6 -CHECKSUM=$(shasum zlib-1.2.13.tar.gz | cut -b-40) +EXPECTEDCHECKSUM=04d053e4d4064a0fb8f0cbd127f0bfb5fe4eb554 +CHECKSUM=$(shasum zlib-1.3.tar.gz | cut -b-40) if [ "$EXPECTEDCHECKSUM" != "$CHECKSUM" ]; then echo "Zlib checksum verification failure" exit 1 fi; # Unpack and compile zlib -tar -xzvf zlib-1.2.13.tar.gz -cd zlib-1.2.13 +tar -xzvf zlib-1.3.tar.gz +cd zlib-1.3 ./configure make diff --git a/1.9/plink_lasso.c b/1.9/plink_lasso.c index 8104bd77..2a3ffd8a 100644 --- a/1.9/plink_lasso.c +++ b/1.9/plink_lasso.c @@ -32,7 +32,6 @@ int32_t transpose_covar(const uintptr_t* sample_exclude, const uintptr_t* pheno_ double ssq = 0.0; double* writeptr = writeptr_start; uint32_t sample_uidx = 0; - uint32_t uii = 0; for (uint32_t sample_idx = 0; sample_idx < sample_ct; ++sample_uidx, ++sample_idx) { next_unset_unsafe_ck(sample_exclude, &sample_uidx); if (IS_SET(pheno_nm, sample_uidx)) { @@ -40,7 +39,6 @@ int32_t transpose_covar(const uintptr_t* sample_exclude, const uintptr_t* pheno_ sum += dxx; ssq += dxx * dxx; *writeptr++ = dxx; - ++uii; } } if (ssq * ((double)sample_valid_ct) == sum * sum) { diff --git a/2.0/Makefile.src b/2.0/Makefile.src index 4c395959..ffd22523 100644 --- a/2.0/Makefile.src +++ b/2.0/Makefile.src @@ -91,7 +91,7 @@ CCSRC = $(PLINK2LIB_CCSRC) \ plink2_random.cc \ plink2_set.cc -ZLIB_VER = 1.2.13 +ZLIB_VER = 1.3 OBJ_NO_ZSTD = $(CSRC:.c=.o) $(CCSRC:.cc=.o) OBJ = $(CSRC:.c=.o) $(ZCSRC:.c=.o) $(ZSSRC:.S=.o) $(CCSRC:.cc=.o) diff --git a/2.0/include/plink2_text.h b/2.0/include/plink2_text.h index 594a13b1..3c88285a 100644 --- a/2.0/include/plink2_text.h +++ b/2.0/include/plink2_text.h @@ -100,7 +100,7 @@ // - A simpler single-threaded (no decompress-ahead) reader. #ifdef STATIC_ZLIB -# include "../../zlib-1.2.13/zlib.h" +# include "../../zlib-1.3/zlib.h" #else # include # if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1240)