GregoryFaust / samblaster

samblaster: a tool to mark duplicates and extract discordant and split reads from sam files.
MIT License
225 stars 30 forks source link

Alpine-based docker build fails #49

Open felixfrenkel opened 4 years ago

felixfrenkel commented 4 years ago

Hi!

I am building v0.1.26 under Alpine based docker and get the following error: g++ -Wall -O3 -D BUILDNUM=26 -c samblaster.cpp -o samblaster.o

samblaster.cpp: In function 'UINT64 diffTVs(timeval*, timeval*)':
samblaster.cpp:107:20: error: invalid use of incomplete type 'struct timeval'
  107 |     return (((endTV->tv_sec - startTV->tv_sec) * 1000000) + (endTV->tv_usec - startTV->tv_usec));
      |                    ^~
samblaster.cpp:105:31: note: forward declaration of 'struct timeval'
  105 | inline UINT64 diffTVs (struct timeval * startTV, struct timeval * endTV)
      |                               ^~~~~~~
samblaster.cpp:107:38: error: invalid use of incomplete type 'struct timeval'
  107 |     return (((endTV->tv_sec - startTV->tv_sec) * 1000000) + (endTV->tv_usec - startTV->tv_usec));
      |                                      ^~
samblaster.cpp:105:31: note: forward declaration of 'struct timeval'
  105 | inline UINT64 diffTVs (struct timeval * startTV, struct timeval * endTV)
      |                               ^~~~~~~
samblaster.cpp:107:67: error: invalid use of incomplete type 'struct timeval'
  107 |     return (((endTV->tv_sec - startTV->tv_sec) * 1000000) + (endTV->tv_usec - startTV->tv_usec));
      |                                                                   ^~
samblaster.cpp:105:31: note: forward declaration of 'struct timeval'
  105 | inline UINT64 diffTVs (struct timeval * startTV, struct timeval * endTV)
      |                               ^~~~~~~
samblaster.cpp:107:86: error: invalid use of incomplete type 'struct timeval'
  107 |     return (((endTV->tv_sec - startTV->tv_sec) * 1000000) + (endTV->tv_usec - startTV->tv_usec));
      |                                                                                      ^~
samblaster.cpp:105:31: note: forward declaration of 'struct timeval'
  105 | inline UINT64 diffTVs (struct timeval * startTV, struct timeval * endTV)
      |                               ^~~~~~~
make: *** [Makefile:27: samblaster.o] Error 1

What goes wrong here?

Regards, Felix

GregoryFaust commented 4 years ago

I might have a problem with referencing the timeval structure before loading the include file that defines it. Try moving the three #include lines starting at line 109 of samblaster.cpp up 4 lines to before the definition of diffTVs and see if this fixes the problem. If so, I am not sure why I have never had this problem while compiling. Please let me know if this works and I will fix this in the next release.