wrpearson / fasta36

Git repository for FASTA36 sequence comparison software
Apache License 2.0
117 stars 17 forks source link

v36.3.8g build fails on undeclared variable #22

Closed mathog closed 4 years ago

mathog commented 4 years ago

On CentOS 8, with gcc 8.3.1-4 (Edit: typo in original commands, fixed ones below did not resolve the issue.)

pversion=36.3.8g
package=fasta
TOPDIR=/usr/common/modules/el8/x86_64/software/${package}/${pversion}-CentOS-vanilla
cd /usr/common/src
wget https://github.com/wrpearson/fasta36/archive/${package}-v${pversion}.tar.gz
gunzip -c ${package}-v${pversion}.tar.gz | tar -xf -
/bin/rm ${package}-v${pversion}.tar.gz
mkdir -p $TOPDIR/bin
mkdir -p $TOPDIR/share/man/man1
cd fasta36-${package}-v${pversion}
cd src
make -j 4 -f ../make/Makefile.linux64_sse2 2>&1 | tee build_2020_04_29.log
#log file ends with:
/usr/common/src/fasta36-fasta-v36.3.8g/src/compacc2e.c:1564: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
gcc -g -O -msse2  -DSW_SSE2 -DSHOW_HELP -DSHOWSIM -DUNIX -DTIMES -DHZ=100 -DMAX_WORKERS=8 -DTHR_EXIT=pthread_exit  -DM10_CONS  -D_REENTRANT -DHAS_INTTYPES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DUSE_FSEEKO -DSAMP_STATS -DPGM_DOC -DUSE_MMAP  -D_LARGEFILE64_SOURCE  -DBIG_LIB64 -c dropnnw2.c -o droplnw_sse.o
dropnnw2.c: In function ‘do_work’:
dropnnw2.c:578:18: error: ‘OVERFLOW’ undeclared (first use in this function); did you mean ‘OVERFLOW_SCORE’?
     if (score == OVERFLOW) {
                  ^~~~~~~~
                  OVERFLOW_SCORE
dropnnw2.c:578:18: note: each undeclared identifier is reported only once for each function it appears in
make: *** [../make/Makefile.fcom:244: droplnw_sse.o] Error 1
wrpearson commented 4 years ago

Thanks for letting me know. I will update the .tar.gz file to the current version, that does not have this bug.

Bill Pearson

Begin forwarded message:

From: mathog notifications@github.com<mailto:notifications@github.com>

Subject: [wrpearson/fasta36] v36.3.8g build fails on undeclared variable (#22)

Date: April 29, 2020 at 7:14:37 PM EDT

To: wrpearson/fasta36 fasta36@noreply.github.com<mailto:fasta36@noreply.github.com>

Cc: Subscribed subscribed@noreply.github.com<mailto:subscribed@noreply.github.com>

Reply-To: wrpearson/fasta36 reply@reply.github.com<mailto:reply@reply.github.com>

pversion=36.3.8g package=fasta TOPDIR=/usr/common/modules/el8/x86_64/software/${package}/${pversion}-CentOS-vanilla cd /usr/common/src wget https://github.com/wrpearson/fasta36/archive/$package-v${pversion}.tar.gz gunzip -c $package-v${pversion}.tar.gz | tar -xf - /bin/rm $package-v${pversion}.tar.gz mkdir -p $TOPDIR/bin mkdir -p $TOPDIR/share/man/man1 cd fasta36-${package}-v${pversion} cd src make -j 4 -f ../make/Makefile.linux64_sse2 2>&1 | tee build_2020_04_29.log

log file ends with:

/usr/common/src/fasta36-fasta-v36.3.8g/src/compacc2e.c:1564: warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp' gcc -g -O -msse2 -DSW_SSE2 -DSHOW_HELP -DSHOWSIM -DUNIX -DTIMES -DHZ=100 -DMAX_WORKERS=8 -DTHR_EXIT=pthread_exit -DM10_CONS -D_REENTRANT -DHAS_INTTYPES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DUSE_FSEEKO -DSAMP_STATS -DPGM_DOC -DUSE_MMAP -D_LARGEFILE64_SOURCE -DBIG_LIB64 -c dropnnw2.c -o droplnw_sse.o dropnnw2.c: In function ‘do_work’: dropnnw2.c:578:18: error: ‘OVERFLOW’ undeclared (first use in this function); did you mean ‘OVERFLOW_SCORE’? if (score == OVERFLOW) { ^~~~ OVERFLOW_SCORE dropnnw2.c:578:18: note: each undeclared identifier is reported only once for each function it appears in make: *** [../make/Makefile.fcom:244: droplnw_sse.o] Error 1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/wrpearson/fasta36/issues/22, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQYNP62D3XAEPVINNSDOJDRPCYF3ANCNFSM4MUM2GJQ.

mathog commented 4 years ago

36.3.8.h now builds to binaries. Thanks.

Both g and h have these scary looking warnings with gcc 8 and 9:

gcc -g -O -msse2 -DSHOW_HELP -DSHOWSIM -DUNIX -DTIMES -DHZ=100 -DMAX_WORKERS=8 -DTHR_EXIT=pthread_exit -DM10_CONS -D_REENTRANT -DHAS_INTTYPES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DUSE_FSEEKO -DSAMP_STATS -DPGM_DOC -DUSE_MMAP -D_LARGEFILE64_SOURCE -DBIG_LIB64 -c -DSW_SSE2 -DGLSEARCH initfa.c -o init_lnw_sse.o initfa.c: In function ‘get_lambda’: initfa.c:2204:24: warning: argument 1 value ‘18446744071709551617’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] if ((pr = (double *) calloc(max - min + 1, sizeof(double))) == NULL) { ^~~~~~~~~ The compiler is doing that because it thinks there is a path where max or min remains at its initial (-)BIGNUM value. Testing for that contingency silences the warning.

There are also warnings on strncat() calls where the 2nd parameter is a 1 character long string and the third is 1. The warnings seem to mean "why use strncat when strcat is the same thing in this context?". Using strcat() instead silences the warnings.

Attached is the diff (from the src level) with these changes to get to a clean compile of the 36.3.8h version using gcc 8.3.1 or 9.1.1.

--- initfa.c.dist       2020-04-30 14:00:58.021510037 -0700
+++ initfa.c    2020-04-30 14:03:42.493757487 -0700
@@ -2221,7 +2221,11 @@

   /*  fprintf(stderr, "min: %d\tmax:%d\n", min, max); */

-  if ((pr = (double *) calloc(max - min + 1, sizeof(double))) == NULL) {
+  if(min == BIGNUM || max == -BIGNUM){
+    fprintf(stderr, "Max or min value out of range.  max %d min %d\n",max,min);
+    exit(1);
+  }
+  else if ((pr = (double *) calloc(max - min + 1, sizeof(double))) == NULL) {
     fprintf(stderr, "Couldn't allocate memory for score probabilities: %d\n", max - min + 1);
     exit(1);
   }
--- map_db.c.dist       2020-04-30 14:10:37.014543575 -0700
+++ map_db.c    2020-04-30 14:11:06.929043633 -0700
@@ -568,7 +568,7 @@
 newname(char *nname, char *oname, char *suff, int maxn)
 {
   strncpy(nname,oname,maxn-1);
-  strncat(nname,".",1);
+  strcat(nname,".");
   strncat(nname,suff,maxn-strlen(nname));
 }

--- nmgetlib.c.dist     2020-04-30 14:11:32.833342602 -0700
+++ nmgetlib.c  2020-04-30 14:14:05.156980854 -0700
@@ -1514,7 +1514,7 @@

     if ((bp=strchr(llp,'\r'))!=NULL) *bp=' ';
     if ((bp=strchr(llp,'\n'))!=NULL) *bp='\0';
-    strncat(str," ",(size_t)1);
+    strcat(str," ");
     strncat(str,llp,(size_t)cnt-strlen(str)-1);
   }
   else {
@@ -1576,7 +1576,7 @@
       libstr[12]='\0';
     }
     else {
-      strncat(libstr," ",1);
+      strcat(libstr," ");
       strncat(libstr,lm_fd->lline,n_libstr-1-strlen(libstr));
       if ((bp = strchr(libstr,'\n'))!=NULL) *bp='\0';
       libstr[n_libstr-1]='\0';
@@ -1660,7 +1660,7 @@
     bp1 = llp;
     if ((bp=strchr(bp1,'\r'))!=NULL) *bp='\0';
     if ((bp=strchr(bp1,'\n'))!=NULL) *bp='\0';
-    strncat(str," ",(size_t)1);
+    strcat(str," ");
     strncat(str,bp1,(size_t)cnt-strlen(str));
     if (bp1!=llp) strncat(str,llp,(size_t)cnt-strlen(str));
   }
wrpearson commented 4 years ago

Thanks for pointing out these issues. I will be posting a new version that addresses the compile time warnings in a more robust way.

wrpearson commented 4 years ago

A new version fasta36_v3.8h, on both master and v36.3.8 branches, dated May, 2020 should resolve all of these issues (but has not been tested with gcc 8 or 9). If it does not, please let me know.

mathog commented 4 years ago

On Sat, 2 May 2020, William Pearson wrote:

A new version fasta36_v3.8h, on both master and v36.3.8 branches, dated May, 2020 should resolve all of these issues (but has not been tested with gcc 8 or 9). If it does not, please let me know.

I don't see a v36.3.8h release with a May date in either of those branches. They both have v36.3.8h_11-Feb-2020. Using:

git clone https://github.com/wrpearson/fasta36.git

that builds with both 8.3.1 and 9.3.0 with just this one warning (albeit 15 times):

/tmp/fasta36/src/compacc2e.c:1582: warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp'

So much better.

The test script seems to be missing its data, not sure where that is supposed to come from, or even if the end users are supposed to be able to run the test:

cd test ./test.sh

:*** Warning [comp_lib9.c:2385] cannot open library /slib2/fa_dbs/qfo20.lseg

qfo20.lseg is not in the distribution and

grep -R qfo20 .

didn't turn up instructions for downloading it.

Regards,

David Mathog

wrpearson commented 4 years ago

David --

I do not understand why the May 2020 date is not associated with

git clone https://github.com/wrpearson/fasta36.git

Since both the master and v36.3.8 branches should be up-to-date. I will check.

I'm glad there are fewer warnings. There is not much I can do about the mktemp warning, since mkstemp is not appropriate for the one time it is used (it is used once, but by all of the different permutations of programs).

RE: test.sh -- yes, this does require several protein and DNA sequences databases. However, in the instructions on installation, there is a test which will work with the distributed files. Perhaps I should do something to replace test.sh with commands that will work with the files in the distribution.

Bill

Begin forwarded message:

From: mathog notifications@github.com<mailto:notifications@github.com>

Subject: Re: [wrpearson/fasta36] v36.3.8g build fails on undeclared variable (#22)

Date: May 7, 2020 at 1:55:37 PM EDT

To: wrpearson/fasta36 fasta36@noreply.github.com<mailto:fasta36@noreply.github.com>

Cc: William Pearson wrp@virginia.edu<mailto:wrp@virginia.edu>, Comment comment@noreply.github.com<mailto:comment@noreply.github.com>

Reply-To: wrpearson/fasta36 reply@reply.github.com<mailto:reply@reply.github.com>

On Sat, 2 May 2020, William Pearson wrote:

A new version fasta36_v3.8h, on both master and v36.3.8 branches, dated May, 2020 should resolve all of these issues (but has not been tested with gcc 8 or 9). If it does not, please let me know.

I don't see a v36.3.8h release with a May date in either of those branches. They both have v36.3.8h_11-Feb-2020. Using:

git clone https://github.com/wrpearson/fasta36.git

that builds with both 8.3.1 and 9.3.0 with just this one warning (albeit 15 times):

/tmp/fasta36/src/compacc2e.c:1582: warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp'

So much better.

The test script seems to be missing its data, not sure where that is supposed to come from, or even if the end users are supposed to be able to run the test:

cd test ./test.sh

:*** Warning [comp_lib9.c:2385] cannot open library /slib2/fa_dbs/qfo20.lseg

qfo20.lseg is not in the distribution and

grep -R qfo20 .

didn't turn up instructions for downloading it.

Regards,

David Mathog

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/wrpearson/fasta36/issues/22#issuecomment-625406618, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQYNPYPCFB7SLMZZN5VBOLRQLYZTANCNFSM4MUM2GJQ.