From 7c23cd396914399df91df572419c8dccc186190a Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Wed, 5 Feb 2020 12:52:18 -0500 Subject: [PATCH 01/14] Added missing license files to distribution tar ball --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7cef4d9a..f6a91db9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS=--enable-swig --enable-all-binding -EXTRA_DIST = doc/jellyfish.pdf doc/jellyfish.man README LICENSE # jellyfish.spec +EXTRA_DIST = doc/jellyfish.pdf doc/jellyfish.man README LICENSE-BSD-3-Clause LICENSE-GPL-3.0 # jellyfish.spec man1_MANS = doc/jellyfish.man pkgconfigdir = $(libdir)/pkgconfig From 4df9f349965e25527432952a80ea605fa4319ebd Mon Sep 17 00:00:00 2001 From: Andreas Tille Date: Tue, 1 Dec 2020 10:14:58 +0100 Subject: [PATCH 02/14] Do not replace random '-L' strings in command line --- examples/count_in_file/Makefile | 2 +- examples/jf_count_dump/Makefile | 2 +- examples/query_per_sequence/Makefile | 2 +- swig/Tuprules.tup | 2 +- swig/perl5/Makefile.PL | 2 +- swig/python/setup.py | 2 +- swig/ruby/extconf.rb | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/count_in_file/Makefile b/examples/count_in_file/Makefile index edb8c7cb..574df860 100644 --- a/examples/count_in_file/Makefile +++ b/examples/count_in_file/Makefile @@ -1,6 +1,6 @@ CC = g++ CXXFLAGS = $(shell pkg-config --cflags jellyfish-2.0) -std=c++0x -Wall -O3 -LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/-L//g') +LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/ -L/ /g') LDLIBS = $(shell pkg-config --libs jellyfish-2.0) all: count_in_file diff --git a/examples/jf_count_dump/Makefile b/examples/jf_count_dump/Makefile index b37a2c04..25bf425b 100644 --- a/examples/jf_count_dump/Makefile +++ b/examples/jf_count_dump/Makefile @@ -1,6 +1,6 @@ CC = g++ CXXFLAGS = $(shell pkg-config --cflags jellyfish-2.0) -std=c++0x -Wall -O3 -LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/-L//g') +LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/ -L/ /g') LDLIBS = $(shell pkg-config --libs jellyfish-2.0) all: jf_count_dump diff --git a/examples/query_per_sequence/Makefile b/examples/query_per_sequence/Makefile index fd199c97..c8a4589b 100644 --- a/examples/query_per_sequence/Makefile +++ b/examples/query_per_sequence/Makefile @@ -1,6 +1,6 @@ CC = g++ CXXFLAGS = $(shell pkg-config --cflags jellyfish-2.0) -std=c++0x -Wall -O3 -LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/-L//g') +LDFLAGS = -Wl,--rpath=$(shell pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/ -L/ /g') LDLIBS = $(shell pkg-config --libs jellyfish-2.0) all: query_per_sequence diff --git a/swig/Tuprules.tup b/swig/Tuprules.tup index 6fd6c6d8..9510ec1e 100644 --- a/swig/Tuprules.tup +++ b/swig/Tuprules.tup @@ -86,7 +86,7 @@ endif ifdef JELLYFISH_RPATH JELLYFISH_RPATH = @(JELLYFISH_RPATH) else - JELLYFISH_RPATH = `pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/-L/-Wl,-rpath,/g'` + JELLYFISH_RPATH = `pkg-config --libs-only-L jellyfish-2.0 | sed -e 's/ -L/ -Wl,-rpath,/g'` endif ifdef RUBY_CFLAGS diff --git a/swig/perl5/Makefile.PL b/swig/perl5/Makefile.PL index db18249b..a60e650d 100644 --- a/swig/perl5/Makefile.PL +++ b/swig/perl5/Makefile.PL @@ -19,7 +19,7 @@ my $pkg = "jellyfish-2.0"; my $jf_cflags = pkgconfig("--cflags $pkg"); my $jf_libs = pkgconfig("--libs $pkg"); my $jf_rpath = pkgconfig("--libs-only-L $pkg"); -$jf_rpath =~ s/-L/-Wl,-rpath,/g; +$jf_rpath =~ s/ -L/ -Wl,-rpath,/g; print("$jf_cflags\n$jf_libs\n$jf_rpath\n"); diff --git a/swig/python/setup.py b/swig/python/setup.py index b152b271..a4d2d051 100644 --- a/swig/python/setup.py +++ b/swig/python/setup.py @@ -23,7 +23,7 @@ def pkgconfig(s): jf_libs = [re.sub(r'-l', '', x) for x in pkgconfig("--libs-only-l jellyfish-2.0")] jf_include = [re.sub(r'-I', '', x) for x in pkgconfig("--cflags-only-I jellyfish-2.0")] jf_cflags = pkgconfig("--cflags-only-other jellyfish-2.0") -jf_libdir = [re.sub(r'-L', '', x) for x in pkgconfig("--libs-only-L jellyfish-2.0")] +jf_libdir = [re.sub(r' -L', ' ', x) for x in pkgconfig("--libs-only-L jellyfish-2.0")] jf_rpath = [re.sub(r'^', '-Wl,-rpath,', x) for x in jf_libdir] jf_ldflags = pkgconfig("--libs-only-other jellyfish-2.0") diff --git a/swig/ruby/extconf.rb b/swig/ruby/extconf.rb index 59b876ee..35cfd62c 100644 --- a/swig/ruby/extconf.rb +++ b/swig/ruby/extconf.rb @@ -19,7 +19,7 @@ def pkgconfig(s) $defs << pkgconfig("--cflags jellyfish-2.0") << '-std=c++0x' libs = [pkgconfig("--libs jellyfish-2.0"), - pkgconfig("--libs-only-L jellyfish-2.0").gsub(/-L/, "-Wl,-rpath,")] + pkgconfig("--libs-only-L jellyfish-2.0").gsub(/ -L/, " -Wl,-rpath,")] if Array === $libs $libs += libs From e1ef9434d25085ac1fe0c11242f70d0b182f267a Mon Sep 17 00:00:00 2001 From: Andreas Tille Date: Tue, 1 Dec 2020 10:18:20 +0100 Subject: [PATCH 03/14] Fix whatis entry in manpage (also fix some spelling issues) --- doc/jellyfish.man | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/jellyfish.man b/doc/jellyfish.man index 04eb9f2d..397a3340 100644 --- a/doc/jellyfish.man +++ b/doc/jellyfish.man @@ -12,11 +12,8 @@ .. .TH "JELLYFISH" "1" "2010/10/1" "k\-mer counter " "k\-mer counter " .SH NAME +jellyfish - software to count k\-mers in DNA sequences -.PP -Jellyfish -is a software to count k\-mers in DNA sequences. -.PP .SH SYNOPSIS jellyfish count @@ -157,7 +154,7 @@ occurring many times will used multiple entries in the hash. Important: the size of the couting field does NOT change the result, it only impacts the amount of memory used. In particular, there is no maximum value in the hash. Even if the counting field uses 5 bits, a -k\-mer occuring 2 million times will have a value reported of 2 +k\-mer occurring 2 million times will have a value reported of 2 million (i.e., it is not capped at 2^5). .PP The \fB\-c\fP @@ -459,7 +456,7 @@ Options (default value in (), *required): .SS QHISTO Usage: jellyfish qhisto [options] db:string .PP -Create an histogram of k\-mer occurences +Create an histogram of k\-mer occurrences .PP Options (default value in (), *required): .TP From b6315b81b98ae2d8d915b239b469d5478418be57 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 1 Dec 2020 10:22:09 +0100 Subject: [PATCH 04/14] Enable reproducible build by avoiding the current date with time zone in json output --- include/jellyfish/generic_file_header.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/jellyfish/generic_file_header.hpp b/include/jellyfish/generic_file_header.hpp index 19b7f55d..927bb030 100644 --- a/include/jellyfish/generic_file_header.hpp +++ b/include/jellyfish/generic_file_header.hpp @@ -172,6 +172,8 @@ class generic_file_header { protected: std::string get_hostname() const { + if(std::getenv("SOURCE_DATE_EPOCH")) + return "hostname"; struct utsname buf; if(uname(&buf) == -1) return ""; @@ -179,6 +181,8 @@ class generic_file_header { } std::string get_pwd() const { + if(std::getenv("SOURCE_DATE_EPOCH")) + return "."; #ifdef PATH_MAX size_t len = PATH_MAX; #else @@ -194,6 +198,16 @@ class generic_file_header { std::string get_localtime() const { time_t t = time(0); std::string res(ctime(&t)); + char *source_date_epoch = std::getenv("SOURCE_DATE_EPOCH"); + if(source_date_epoch) { + std::istringstream iss(source_date_epoch); + iss >> t; + if(iss.fail() || !iss.eof()) { + std::cerr << "Error: Cannot parse SOURCE_DATE_EPOCH as integer\n"; + exit(27); + } + res = asctime(gmtime(&t)); + } chomp(res); return res; } From b3a7d67e4f134055d97aea58092577cc66f77095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Mollier?= Date: Sat, 28 Aug 2021 21:11:20 +0200 Subject: [PATCH 05/14] configure.ac: protect some md5 macros with [] Starting with autoconf 2.70, the resulting ./configure script seems to not be valid shell anymore, leading to Debian bug #978843 [1]. [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978843 Relevant part from the complete build log: [...] checking for samtools... /usr/bin/samtools checking for unix2dos... /usr/bin/unix2dos ./configure: line 13206: syntax error near unexpected token `newline' ./configure: line 13206: ` ''' [...] --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9fc582f5..fd8d9347 100644 --- a/configure.ac +++ b/configure.ac @@ -41,9 +41,9 @@ AS_IF([test "x$UNIX2DOS" = "x"], # Check for md5 or md5sum AC_ARG_VAR([MD5], [Path to md5 hashing program]) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5sum], [md5sum]), []) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5], [md5 -r]), []) -AS_IF([test "x$MD5" = "x"], AC_MSG_ERROR([Could not find md5 hashing program in your path]), []) +AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5sum], [md5sum])], []) +AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5], [md5 -r])], []) +AS_IF([test "x$MD5" = "x"], [AC_MSG_ERROR([Could not find md5 hashing program in your path])], []) # Check for yaggo AC_ARG_VAR([YAGGO], [Yaggo switch parser generator]) From 7010e56382feb38b6ebccda10a6be6e779032bb7 Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Fri, 10 Sep 2021 10:39:13 -0400 Subject: [PATCH 06/14] Keep up with autoconf and g++ * Ran `autoupdate` to update obsolete constructs * Fix in jsconcpp.cpp to avoid a g++ warning. --- configure.ac | 26 +++++++++++++------------- lib/jsoncpp.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 9fc582f5..97e2f12b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT([jellyfish], [2.3.0], [gmarcais@umd.edu]) +AC_INIT([jellyfish],[2.3.0],[gmarcais@umd.edu]) AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([jellyfish]) AC_CONFIG_HEADERS([config.h]) -AC_PROG_LIBTOOL +LT_INIT AC_LIB_RPATH PKG_PROG_PKG_CONFIG @@ -41,9 +41,9 @@ AS_IF([test "x$UNIX2DOS" = "x"], # Check for md5 or md5sum AC_ARG_VAR([MD5], [Path to md5 hashing program]) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5sum], [md5sum]), []) -AS_IF([test "x$MD5" = "x"], AC_CHECK_PROG([MD5], [md5], [md5 -r]), []) -AS_IF([test "x$MD5" = "x"], AC_MSG_ERROR([Could not find md5 hashing program in your path]), []) +AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5sum], [md5sum])], []) +AS_IF([test "x$MD5" = "x"], [AC_CHECK_PROG([MD5], [md5], [md5 -r])], []) +AS_IF([test "x$MD5" = "x"], [AC_MSG_ERROR([Could not find md5 hashing program in your path])], []) # Check for yaggo AC_ARG_VAR([YAGGO], [Yaggo switch parser generator]) @@ -105,7 +105,7 @@ AC_CHECK_MEMBER([siginfo_t.si_int], # --enable-all-static # Do not use libtool if building all static AC_ARG_ENABLE([all-static], - [AC_HELP_STRING([--enable-all-static], [create statically linked executable])]) + [AS_HELP_STRING([--enable-all-static],[create statically linked executable])]) STATIC_FLAGS= AS_IF([test x$enable_all_static = xyes], [AC_SUBST([STATIC_FLAGS], [-all-static])]) @@ -116,24 +116,24 @@ AS_IF([test x$enable_all_static = xyes], maybe_swig= # --enable-python-binding AC_ARG_ENABLE([python-binding], - [AC_HELP_STRING([--enable-python-binding@<:@=PATH@:>@], [create SWIG python module and install in PATH])]) + [AS_HELP_STRING([--enable-python-binding@<:@=PATH@:>@],[create SWIG python module and install in PATH])]) # --enable-ruby-binding AC_ARG_ENABLE([ruby-binding], - [AC_HELP_STRING([--enable-ruby-binding@<:@=PATH@:>@], [create SWIG ruby module and install in PATH])]) + [AS_HELP_STRING([--enable-ruby-binding@<:@=PATH@:>@],[create SWIG ruby module and install in PATH])]) # --enable-perl-binding AC_ARG_ENABLE([perl-binding], - [AC_HELP_STRING([--enable-perl-binding@<:@=PATH@:>@], [create SWIG perl module and install in PATH])]) + [AS_HELP_STRING([--enable-perl-binding@<:@=PATH@:>@],[create SWIG perl module and install in PATH])]) # --enable-all-binding AC_ARG_ENABLE([all-binding], - [AC_HELP_STRING([--enable-all-binding@<:@=PATH@:>@], [create SWIG module for all languages and install in PATH])]) + [AS_HELP_STRING([--enable-all-binding@<:@=PATH@:>@],[create SWIG module for all languages and install in PATH])]) # --enable-swig AC_ARG_ENABLE([swig], - [AC_HELP_STRING([--enable-swig], [enable development of swig binding])]) + [AS_HELP_STRING([--enable-swig],[enable development of swig binding])]) AS_IF([test x$enable_swig = xyes], [AX_PKG_SWIG([3.0.0], [], [AC_MSG_ERROR([SWIG version 3 is required])])]) AS_IF([test -n "$SWIG"], - [SWIG_ENABLE_CXX]) + [AX_SWIG_ENABLE_CXX]) AM_CONDITIONAL([HAVE_SWIG], [test -n "$SWIG"]) # Python binding setup @@ -143,7 +143,7 @@ AM_COND_IF([PYTHON_BINDING], [AS_IF([test x$enable_python_binding != xyes], [PYTHON_SITE_PKG=$enable_python_binding])] [AX_PYTHON_DEVEL([], [$prefix])]) AC_ARG_ENABLE([python-deprecated], - [AC_HELP_STRING([--enable-python-deprecated], [enable the deprecated 'jellyfish' module (in addition to 'dna_jellyfish')])]) + [AS_HELP_STRING([--enable-python-deprecated],[enable the deprecated 'jellyfish' module (in addition to 'dna_jellyfish')])]) AM_CONDITIONAL([PYTHON_DEPRECATED], [test -z "$enable_python_deprecated" -o x$enable_python_deprecated != xno]) # Ruby binding setup diff --git a/lib/jsoncpp.cpp b/lib/jsoncpp.cpp index 66650105..89c33a0c 100644 --- a/lib/jsoncpp.cpp +++ b/lib/jsoncpp.cpp @@ -1733,7 +1733,7 @@ Value::CZString::operator<( const CZString &other ) const bool Value::CZString::operator==( const CZString &other ) const { - if ( cstr_ ) + if ( cstr_ && other.cstr_ ) return strcmp( cstr_, other.cstr_ ) == 0; return index_ == other.index_; } From cf17ede7cad1f2878a04ca0c1d33d891ce4d7b1e Mon Sep 17 00:00:00 2001 From: Matthew DeMaere Date: Fri, 13 Mar 2020 14:03:52 +1100 Subject: [PATCH 07/14] Set parent-death signals for generator child processes * This resovles #162 * Only works on systems (only Linux?) that define `PR_SET_PDEATHSIG` in `sys/prctl.h` --- configure.ac | 2 +- lib/generator_manager.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 97e2f12b..144d40e8 100644 --- a/configure.ac +++ b/configure.ac @@ -97,7 +97,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [AC_DEFINE([HAVE_NSGETEXECUTABLEPATH], [1], [Used to find executable path on MacOS X])], [AC_MSG_RESULT([no])]) -AC_CHECK_HEADERS_ONCE([execinfo.h ext/stdio_filebuf.h sys/syscall.h]) +AC_CHECK_HEADERS_ONCE([execinfo.h ext/stdio_filebuf.h sys/syscall.h sys/prctl.h]) AC_CHECK_MEMBER([siginfo_t.si_int], [AC_DEFINE([HAVE_SI_INT], [1], [Define if siginfo_t.si_int exists])], [], [[#include ]]) diff --git a/lib/generator_manager.cc b/lib/generator_manager.cc index 6f7622ff..615d65e8 100644 --- a/lib/generator_manager.cc +++ b/lib/generator_manager.cc @@ -9,6 +9,9 @@ #include #include +#ifdef HAVE_SYS_PRCTL_H +#include +#endif #include #include #include @@ -119,6 +122,9 @@ void generator_manager_base::start() { // In child +#ifdef PR_SET_PDEATHSIG + prctl(PR_SET_PDEATHSIG, SIGHUP); +#endif if(setup_signal_handlers() == -1) exit(EXIT_FAILURE); start_commands(); // child start commands @@ -190,6 +196,9 @@ void generator_manager_base::start_one_command(const std::string& command, int p } // In child +#ifdef PR_SET_PDEATHSIG + prctl(PR_SET_PDEATHSIG, SIGHUP); +#endif int dev_null = open_cloexec("/dev/null", O_RDONLY); if(dev_null != -1) dup2(dev_null, 0); From 1e07e35ba8103ab7dfe8523785fe23bc78a146e0 Mon Sep 17 00:00:00 2001 From: gmarcais Date: Thu, 2 Jun 2022 13:17:28 -0400 Subject: [PATCH 08/14] Create c-cpp.yml --- .github/workflows/c-cpp.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 00000000..e983e5a9 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,27 @@ +name: C/C++ CI + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: dependencies + run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yaggo gettext swig3.0 python3-dev ruby-dev libperl-dev + - name: autotools + run: autoreconf -fi + - name: configure + run: ./configure --enable-all-binding --enable-swig + - name: make + run: make -j2 + - name: make check + run: make -j2 check + - name: make distcheck + run: make -j2 distcheck From 68cf6ed7a0c6dae9f89892c4bbad95568af983bf Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Thu, 2 Jun 2022 14:24:41 -0400 Subject: [PATCH 09/14] CI badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a5b12087..7ea90156 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![CI workflow](https://github.com/gmarcais/Jellyfish/actions/workflows/c-cpp.yml/badge.svg) + # Jellyfish ## Overview From 32d0cbaefb08121b83fbf32fd9998e60544fe6fa Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Tue, 21 Jun 2022 18:02:39 -0400 Subject: [PATCH 10/14] Compilation with gcc-12 * Don't use `bind2nd`, use `bind` instead. * Don't use `tr1`. * Fixed un-initialized variable in gtest. --- Makefile.am | 3 +++ unit_tests/gtest/src/gtest-all.cc | 4 ++-- unit_tests/test_large_hash_array.cc | 8 ++++---- unit_tests/test_misc.cc | 3 ++- unit_tests/test_offsets_key_value.cc | 10 +++++----- unit_tests/test_packed_key_value_array.cc | 2 +- unit_tests/test_rectangular_binary_matrix.cc | 6 +++--- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index f6a91db9..c6053a3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -228,3 +228,6 @@ include gtest.mk # Print the value of a variable print-%: @echo -n $($*) + +# Only compile the the check, don't run +check-programs: $(BUILT_SOURCES) $(check_PROGRAMS) $(check_LTLIBRARIES) diff --git a/unit_tests/gtest/src/gtest-all.cc b/unit_tests/gtest/src/gtest-all.cc index a9a03b2e..1a132797 100644 --- a/unit_tests/gtest/src/gtest-all.cc +++ b/unit_tests/gtest/src/gtest-all.cc @@ -7475,12 +7475,12 @@ static int ExecDeathTestChildMain(void* child_arg) { // correct answer. void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_; void StackLowerThanAddress(const void* ptr, bool* result) { - int dummy; + int dummy = 0; *result = (&dummy < ptr); } bool StackGrowsDown() { - int dummy; + int dummy = 0; bool result; StackLowerThanAddress(&dummy, &result); return result; diff --git a/unit_tests/test_large_hash_array.cc b/unit_tests/test_large_hash_array.cc index 5bc17b91..0401b68a 100644 --- a/unit_tests/test_large_hash_array.cc +++ b/unit_tests/test_large_hash_array.cc @@ -33,7 +33,7 @@ typedef large_array::lazy_iterator lazy_iterator; typedef large_array::region_iterator region_iterator; // Tuple is {key_len, val_len, reprobe_len}. -class HashArray : public ::testing::TestWithParam< ::std::tr1::tuple > +class HashArray : public ::testing::TestWithParam< ::std::tuple > { public: static const size_t ary_lsize = 10; @@ -43,9 +43,9 @@ class HashArray : public ::testing::TestWithParam< ::std::tr1::tuple(GetParam())), - val_len(::std::tr1::get<1>(GetParam())), - reprobe_len(::std::tr1::get<2>(GetParam())), + key_len(::std::get<0>(GetParam())), + val_len(::std::get<1>(GetParam())), + reprobe_len(::std::get<2>(GetParam())), reprobe_limit((1 << reprobe_len) - 2), ary(ary_size, key_len, val_len, reprobe_limit) { } diff --git a/unit_tests/test_misc.cc b/unit_tests/test_misc.cc index 4bfab890..3fe254e5 100644 --- a/unit_tests/test_misc.cc +++ b/unit_tests/test_misc.cc @@ -66,11 +66,12 @@ TEST(Random, Bits) { } TEST(BinarySearchFirst, Int) { + using namespace std::placeholders; static int size = 1024; for(int i = 0; i < size; ++i) EXPECT_EQ(i, *jellyfish::binary_search_first_false(jellyfish::pointer_integer(0), jellyfish::pointer_integer(size), - std::bind2nd(std::less(), i))); + std::bind(std::less(), _1, i))); } TEST(Slices, NonOverlapAll) { diff --git a/unit_tests/test_offsets_key_value.cc b/unit_tests/test_offsets_key_value.cc index d3076fc8..3d31c8d7 100644 --- a/unit_tests/test_offsets_key_value.cc +++ b/unit_tests/test_offsets_key_value.cc @@ -15,13 +15,13 @@ namespace { using namespace jellyfish; // Tuple is {key_len, val_len, reprobe_len}. Actual reprobe value is computed from the reprobe_len. -class ComputeOffsetsTest : public ::testing::TestWithParam< ::std::tr1::tuple > +class ComputeOffsetsTest : public ::testing::TestWithParam< ::std::tuple > { public: Offsets offsets; ComputeOffsetsTest() : - offsets(::std::tr1::get<0>(GetParam()), ::std::tr1::get<1>(GetParam()), (1 << ::std::tr1::get<2>(GetParam())) - 2) + offsets(::std::get<0>(GetParam()), ::std::get<1>(GetParam()), (1 << ::std::get<2>(GetParam())) - 2) { } ~ComputeOffsetsTest() { } @@ -108,10 +108,10 @@ void test_val_offsets(const Offsets::offset_t* it, unsigned int v_len, TEST_P(ComputeOffsetsTest, CheckCoherency) { const Offsets::offset_t *it = NULL, *pit = NULL; const Offsets::offset_t *lit = NULL, *lpit = NULL; - unsigned int k_len = ::std::tr1::get<0>(GetParam()); - unsigned int v_len = ::std::tr1::get<1>(GetParam()); + unsigned int k_len = ::std::get<0>(GetParam()); + unsigned int v_len = ::std::get<1>(GetParam()); unsigned int kv_len = k_len + v_len; - unsigned int lk_len = ::std::tr1::get<2>(GetParam()); + unsigned int lk_len = ::std::get<2>(GetParam()); unsigned int lv_len = std::min(kv_len - lk_len, (unsigned int)bsizeof(uint64_t)); unsigned int i = 0; diff --git a/unit_tests/test_packed_key_value_array.cc b/unit_tests/test_packed_key_value_array.cc index ee537f48..6205ac3f 100644 --- a/unit_tests/test_packed_key_value_array.cc +++ b/unit_tests/test_packed_key_value_array.cc @@ -209,5 +209,5 @@ packed_counting_param pc_params[] = { { 32, 16, 1024, 20, 3, 15}, { 64, 40, 2048, 22, 3, 7} }; -INSTANTIATE_TEST_SUITE_P(SingleThreadTest, PackedCountingTest, +INSTANTIATE_TEST_CASE_P(SingleThreadTest, PackedCountingTest, ::testing::ValuesIn(pc_params)); diff --git a/unit_tests/test_rectangular_binary_matrix.cc b/unit_tests/test_rectangular_binary_matrix.cc index c0697793..cd5a6364 100644 --- a/unit_tests/test_rectangular_binary_matrix.cc +++ b/unit_tests/test_rectangular_binary_matrix.cc @@ -89,13 +89,13 @@ TEST(RectangularBinaryMatrix, LowIdentity) { /****************************** * Matrix Vector product ******************************/ -class MatrixVectorProd : public ::testing::TestWithParam< ::std::tr1::tuple > { +class MatrixVectorProd : public ::testing::TestWithParam< ::std::tuple > { public: unsigned int row, col; RectangularBinaryMatrix m; MatrixVectorProd() : - row(::std::tr1::get<0>(GetParam())), - col(::std::tr1::get<1>(GetParam())), + row(::std::get<0>(GetParam())), + col(::std::get<1>(GetParam())), m(row, col) { m.randomize(random_bits); From aa89c2a7091319633926a21517c18ac4e4727ee3 Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Mon, 4 Sep 2023 17:23:33 -0500 Subject: [PATCH 11/14] Small code changes * `mer_dna.hpp` use correct type `uint32_t` instead of `uint64_t`. * `sorted_dumper.hpp` removed unused couter. --- include/jellyfish/mer_dna.hpp | 2 +- include/jellyfish/sorted_dumper.hpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/jellyfish/mer_dna.hpp b/include/jellyfish/mer_dna.hpp index 4c0ca54b..6b56b682 100644 --- a/include/jellyfish/mer_dna.hpp +++ b/include/jellyfish/mer_dna.hpp @@ -81,7 +81,7 @@ struct cmask { // Fast reverse complement of one word through bit tweedling. inline uint32_t word_reverse_complement(uint32_t w) { - typedef uint64_t U; + typedef uint32_t U; w = ((w >> 2) & cmask::v) | ((w & cmask::v) << 2); w = ((w >> 4) & cmask::v) | ((w & cmask::v) << 4); w = ((w >> 8) & cmask::v) | ((w & cmask::v) << 8); diff --git a/include/jellyfish/sorted_dumper.hpp b/include/jellyfish/sorted_dumper.hpp index 6fd0f8c5..2b26456e 100644 --- a/include/jellyfish/sorted_dumper.hpp +++ b/include/jellyfish/sorted_dumper.hpp @@ -73,7 +73,6 @@ class sorted_dumper : public dumper_t, public thread_exec { std::ostringstream buffer; heap_type heap(ary_->max_reprobe_offset()); token_type& token = ring_[i]; - size_t count = 0; typename storage_t::key_type key; for(size_t id = i; id * block_info.second < ary_->size(); id += nb_threads_) { @@ -85,7 +84,6 @@ class sorted_dumper : public dumper_t, public thread_exec { heap_item item = heap.head(); if(item->val_ >= this->min() && item->val_ <= this->max()) static_cast(this)->write_key_value_pair(buffer, item); - ++count; heap.pop(); if(it.next()) heap.push(it); From e9d59948b417896ba86c7e68556e09e8a4af8844 Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Wed, 6 Sep 2023 16:46:39 -0500 Subject: [PATCH 12/14] Configure script updates * python-devel.m4: do not use distutils package, it is deprecated. * Support to force installing to system or user site-packages with --enable-python-binding=sys|user * Updated ax_ext.m4. --- configure.ac | 2 +- m4/m4-ax_ext.m4 | 14 ++++----- m4/m4-ax_python_devel.m4 | 61 ++++++++++++++++++++++------------------ 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 144d40e8..86cf9985 100644 --- a/configure.ac +++ b/configure.ac @@ -116,7 +116,7 @@ AS_IF([test x$enable_all_static = xyes], maybe_swig= # --enable-python-binding AC_ARG_ENABLE([python-binding], - [AS_HELP_STRING([--enable-python-binding@<:@=PATH@:>@],[create SWIG python module and install in PATH])]) + [AS_HELP_STRING([--enable-python-binding@<:@=PATH@:>@],[create SWIG python module and install in PATH (user or system site-packages if PATH=user|sys)])]) # --enable-ruby-binding AC_ARG_ENABLE([ruby-binding], [AS_HELP_STRING([--enable-ruby-binding@<:@=PATH@:>@],[create SWIG ruby module and install in PATH])]) diff --git a/m4/m4-ax_ext.m4 b/m4/m4-ax_ext.m4 index 66de4c32..1fe6312b 100644 --- a/m4/m4-ax_ext.m4 +++ b/m4/m4-ax_ext.m4 @@ -44,7 +44,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 17 +#serial 19 AC_DEFUN([AX_EXT], [ @@ -160,22 +160,22 @@ AC_DEFUN([AX_EXT], ax_cv_have_sse_os_support_ext=no, if test "$((0x$edx_cpuid1>>25&0x01))" = 1; then AC_LANG_PUSH([C]) - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include /* No way at ring1 to ring3 in protected mode to check the CR0 and CR4 control registers directly. Execute an SSE instruction. If it raises SIGILL then OS doesn't support SSE based instructions */ void sig_handler(int signum){ exit(1); } - int main(){ + int main(void){ signal(SIGILL, sig_handler); /* SSE instruction xorps %xmm0,%xmm0 */ __asm__ __volatile__ (".byte 0x0f, 0x57, 0xc0"); return 0; - }], - ax_cv_have_sse_os_support_ext=yes, - ax_cv_have_sse_os_support_ext=no, - ax_cv_have_sse_os_support_ext=no) + }]])], + [ax_cv_have_sse_os_support_ext=yes], + [ax_cv_have_sse_os_support_ext=no], + [ax_cv_have_sse_os_support_ext=no]) AC_LANG_POP([C]) fi ]) diff --git a/m4/m4-ax_python_devel.m4 b/m4/m4-ax_python_devel.m4 index b3f1406b..2181043b 100644 --- a/m4/m4-ax_python_devel.m4 +++ b/m4/m4-ax_python_devel.m4 @@ -138,30 +138,31 @@ variable to configure. See ``configure --help'' for reference. prefix= fi + # Don't check for distutils, it is deprecated. Use module sysconfig and setuptools instead. # # Check if you have distutils, else fail # - AC_MSG_CHECKING([for the distutils Python package]) - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([cannot import Python module "distutils". -Please check your Python installation. The error was: -$ac_distutils_result]) - PYTHON_VERSION="" - fi + # AC_MSG_CHECKING([for the sysconfig Python package]) + # ac_distutils_result=`$PYTHON -c "import sysconfig" 2>&1` +# if test -z "$ac_distutils_result"; then +# AC_MSG_RESULT([yes]) +# else +# AC_MSG_RESULT([no]) +# AC_MSG_ERROR([cannot import Python module "distutils". +# Please check your Python installation. The error was: +# $ac_distutils_result]) +# PYTHON_VERSION="" +# fi # # Check for Python include path # AC_MSG_CHECKING([for Python include path]) if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc ());"` - plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc (plat_specific=1));"` + python_path=`$PYTHON -c "import sysconfig; \ + print (sysconfig.get_path ('include'));"` + plat_python_path=`$PYTHON -c "import sysconfig; \ + print (sysconfig.get_path ('platinclude'));"` if test -n "${python_path}"; then if test "${plat_python_path}" != "${python_path}"; then python_path="-I$python_path -I$plat_python_path" @@ -185,7 +186,7 @@ $ac_distutils_result]) # join all versioning strings, on some systems # major/minor numbers could be in different list elements -from distutils.sysconfig import * +from sysconfig import * e = get_config_var('VERSION') if e is not None: print(e) @@ -208,8 +209,8 @@ EOD` ac_python_libdir=`cat< 0 and pref != '-c' else None; \ - print(distutils.sysconfig.get_python_lib(0,0,pref));" $prefix` + path = os.path.join(pref, 'lib', 'python%d.%d' % sys.version_info@<:@:2@:>@) if pref else site.getsitepackages()@<:@0@:>@; \ + print(path)" $prefix` + elif test "$PYTHON_SITE_PKG" = "user"; then + PYTHON_SITE_PKG=`$PYTHON -c "import site; print(site.getusersitepackages())"` + elif test "$PYTHON_SITE_PKG" = "sys"; then + PYTHON_SITE_PKG=`$PYTHON -c "import site; print(site.getsitepackages()@<:@0@:>@)"` fi AC_MSG_RESULT([$PYTHON_SITE_PKG]) AC_SUBST([PYTHON_SITE_PKG]) @@ -272,8 +279,8 @@ EOD` # AC_MSG_CHECKING(python extra libraries) if test -z "$PYTHON_EXTRA_LIBS"; then - PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ + PYTHON_EXTRA_LIBS=`$PYTHON -c "import sysconfig; \ + conf = sysconfig.get_config_var; \ print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` fi AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) @@ -284,8 +291,8 @@ EOD` # AC_MSG_CHECKING(python extra linking flags) if test -z "$PYTHON_EXTRA_LDFLAGS"; then - PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sysconfig; \ + conf = sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` fi AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) From fcbf593da45feb50c1a5ad63352c1c7ac2a4ee39 Mon Sep 17 00:00:00 2001 From: Guillaume Marcais Date: Wed, 6 Dec 2023 15:21:17 -0500 Subject: [PATCH 13/14] Testing. Cosmetic. * Install `swig` rather than `swig3.0` in Github Actions * Minor update to `swig/Readme.md` --- .github/workflows/c-cpp.yml | 2 +- .gitignore | 2 ++ swig/Readme.md | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index e983e5a9..a212986b 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: dependencies - run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yaggo gettext swig3.0 python3-dev ruby-dev libperl-dev + run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yaggo gettext swig python3-dev ruby-dev libperl-dev - name: autotools run: autoreconf -fi - name: configure diff --git a/.gitignore b/.gitignore index d559ca35..c57b4101 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ ltmain.sh *_cmdline.hpp test-driver build-* +*~ +compile_commands.json diff --git a/swig/Readme.md b/swig/Readme.md index a429fffc..3f9e60e7 100644 --- a/swig/Readme.md +++ b/swig/Readme.md @@ -10,9 +10,9 @@ somewhat slower. Installation ============ -See the installation instructions on the -[main page](../../tree/master) on how to install the bindings at the -same times as Jellyfish. +See the installation instructions on the [main page](../../tree/master) on how +to install the bindings at the same times as Jellyfish. This is the suggested +way to install the binding. Additionally, it is possible to install the bindings from the distribution tarball. If Jellyfish is already installed (that is From 005774a3c6137aaecd09d0112f68892ebb1a8bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Mar=C3=A7ais?= Date: Wed, 6 Dec 2023 16:50:46 -0500 Subject: [PATCH 14/14] Bumped version to 2.3.1. Updated Email address --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 86cf9985..20a34589 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([jellyfish],[2.3.0],[gmarcais@umd.edu]) +AC_INIT([jellyfish],[2.3.1],[gmarcais@cs.cmu.edu]) AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests])