smithlabcode / preseq

Software for predicting library complexity and genome coverage in high-throughput sequencing.
https://preseq.readthedocs.io
GNU General Public License v3.0
78 stars 16 forks source link

Build fails due to missing size_t definition #52

Closed knowah closed 3 years ago

knowah commented 3 years ago

I just downloaded the v3.1.1 release and tried to install both with and without htslib. Running make failed, giving the following errors:

In file included from ../src/moment_sequence.cpp:21:0:
../src/moment_sequence.hpp:28:1: error: ‘size_t’ does not name a type
 size_t ensure_pos_def_mom_seq(std::vector<double> &moments,
 ^~~~~~
../src/moment_sequence.hpp:54:12: error: ‘size_t’ does not name a type
      const size_t n_points,
            ^~~~~~
../src/moment_sequence.hpp:56:12: error: ‘size_t’ does not name a type
      const size_t max_iter,
            ^~~~~~
../src/moment_sequence.cpp:373:1: error: prototype for ‘bool MomentSequence::Lower_quadrature_rules(bool, size_t, double, size_t, std::vector<double>&, std::vector<double>&)’ does not match any in class ‘MomentSequence’
 MomentSequence::Lower_quadrature_rules(const bool VERBOSE,
 ^~~~~~~~~~~~~~
In file included from ../src/moment_sequence.cpp:21:0:
../src/moment_sequence.hpp:53:8: error: candidate is: bool MomentSequence::Lower_quadrature_rules(bool, int, double, int, std::vector<double>&, std::vector<double>&)
   bool Lower_quadrature_rules(const bool VERBOSE,
        ^~~~~~~~~~~~~~~~~~~~~~

I attempted to create a pull request with my fix but I couldn't figure out how to integrate the preseqR and smithlab_cpp submodules into my fork.

I was able to fix the errors and build/install successfully by just adding the following include line to src/moment_sequence.hpp:

#include <cstddef>
andrewdavidsmith commented 3 years ago

@knowah Can you please supply your compiler information?

knowah commented 3 years ago

@knowah Can you please supply your compiler information?

Hi @andrewdavidsmith, the compiler version is: g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

And the offending command from make that caused the error was:

depbase=`echo src/moment_sequence.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -std=c++11 -DHAVE_CONFIG_H -I. -I..  -I ../src/smithlab_cpp    -O2  -MT src/moment_sequence.o -MD -MP -MF $depbase.Tpo -c -o src/moment_sequence.o ../src/moment_sequence.cpp &&\
mv -f $depbase.Tpo $depbase.Po`

Let me know if there's another command I can run to get you more compiler info if needed!

andrewdavidsmith commented 3 years ago

Thanks @knowah this is very helpful. We have used a similar compiler but not seen the error. This seems to need a fix, and we'll look into yours -- I agree it's likely a header that might be included (or not) through a chain of headers in a way that isn't the same across all systems.

pgfoster commented 3 years ago

I just got the same error, also on 3.1.1. My (old!) compiler is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

Including allowed it to compile.

andrewdavidsmith commented 3 years ago

Thanks @pgfoster we will do a new release soon to address this. Not sure how it happened, but likely the <cstddef> was indirectly included (possibly through headers in std) and it seems we can't rely on these always being consistent.

terencewtli commented 3 years ago

Sorry for the delay! 3.1.2 just dropped with the header included.