OligoArrayAux v3.8 compilation fail

Ask questions, report problems or request new features for the UNAFold software.
Sizzle0756
Posts: 4
Joined: Thu Nov 17, 2022 9:23 am

OligoArrayAux v3.8 compilation fail

Post by Sizzle0756 »

see my question [here](https://support.bioconductor.org/p/9147748/)

I work on a MacBook Pro (13 inch, M1, 2020) running macOS version 11.3.1. I downloaded the tar.bz2 file and followed the instructions to build the program

Code: Select all

cd oligoarrayaux-3.8/

./configure #seems to run without error

make #fails
`make` fails with the following error

Code: Select all

make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_min-energy.o -MD -MP -MF .deps/hybrid_min-energy.Tpo -c -o hybrid_min-energy.o `test -f 'energy.c' || echo './'`energy.c
energy.c:118:8: error: implicit declaration of function 'readOrDie' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              readOrDie(1, "stack", gFile, "%lf", &stackEnergies[i][j][ii][jj]);
              ^
energy.c:227:8: error: implicit declaration of function 'readOrDie' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              readOrDie(1, "stack", file, "%lf", &d);
              ^
energy.c:285:6: error: implicit declaration of function 'readOrDie' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            readOrDie(1, "dangle", gFile, "%lf", &dangleEnergies3[i][j][k]);
[truncated]

can the program be built on my operating system?

Thanks!

Fabian
nmarkham
Site Admin
Posts: 25
Joined: Wed Jun 29, 2022 5:23 pm

Re: OligoArrayAux v3.8 compilation fail

Post by nmarkham »

Hi Fabian,

First, a few generalities. I don't have access to a Mac to test this myself. I know that UNAFold 4 compiles on a Mac, but I'm not sure if we ever tried UNAFold or OAA 3.8 on a Mac. (If we did, it was probably ten years ago so the results wouldn't necessarily match a modern OS/compiler anyway!) However, I can compile OAA 3.8 on my Linux machine with gcc 11.3, so I think there's some hope.

Those specific errors are clearly because I was sloppy with my use of header and implementation tiles. There is a function "readOrDie" defined in util.h (mistake #1) that is called from energy.c without being declared there (mistake #2). These things worked in C89 but have always been bad practice. I fixed them in UNAFold 4, but that doesn't help here.

When I build OAA 3.8, I get those same "errors" but as warnings, which allows the build to proceed. I notice in my config.log that autoconf determined that the compiler would accept C89 by default, but your output suggests that gcc is enforcing C99. Maybe you can get around this by modifying the configure step to "./configure CFLAGS=-std=c89".

I'm hopeful that will get you unstuck. If there are still problems, I'll see if there's a simple code change you can make to get around this.

Nick
bhumm
Posts: 4
Joined: Tue Nov 22, 2022 1:04 am

Re: OligoArrayAux v3.8 compilation fail

Post by bhumm »

I am currently having the same issue on MacOS X as well. I tried using the ./configure flags you recommended, but am still having no luck. Regarding your comment on the build being able to proceed despite the errors - presumably at the end of the OPs truncated message is something to the tune of "fatal error: too many errors emitted, stopping now [-ferror-limit=]" which prevents installation. Any guidance or advice would be greatly appreciated!

-blake
nmarkham
Site Admin
Posts: 25
Joined: Wed Jun 29, 2022 5:23 pm

Re: OligoArrayAux v3.8 compilation fail

Post by nmarkham »

OK, time for plan B. If you're up for adding a line to the source code, open src/energy.c and add this line right above the lines starting with const:

Code: Select all

void readOrDie(unsigned int num, const char* name, FILE* file, const char* format, ...);
That eliminated the warnings for me, so hopefully it will eliminate the errors for the two of you!
bhumm
Posts: 4
Joined: Tue Nov 22, 2022 1:04 am

Re: OligoArrayAux v3.8 compilation fail

Post by bhumm »

Hi,

Thanks for the reply. I added in the line to the script you mentioned above the "const" lines. After executing "./configure" and following "make"

Code: Select all

oligoarrayaux-3.8 % make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_min-energy.o -MD -MP -MF .deps/hybrid_min-energy.Tpo -c -o hybrid_min-energy.o `test -f 'energy.c' || echo './'`energy.c
mv -f .deps/hybrid_min-energy.Tpo .deps/hybrid_min-energy.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_min-hybrid-min.o -MD -MP -MF .deps/hybrid_min-hybrid-min.Tpo -c -o hybrid_min-hybrid-min.o `test -f 'hybrid-min.c' || echo './'`hybrid-min.c
hybrid-min.c:2201:8: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration]
  if (!finite(a) || !finite(b))
       ^
hybrid-min.c:2201:8: note: include the header <math.h> or explicitly provide a declaration for 'finite'
hybrid-min.c:2206:10: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
  return fabs(a - b) < 1e-5;
         ^
hybrid-min.c:2206:10: note: use function 'abs' instead
  return fabs(a - b) < 1e-5;
         ^~~~
         abs
hybrid-min.c:2211:10: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
  return fabs((a - b) / (a + b)) < 0.00001;
         ^
hybrid-min.c:2211:10: note: use function 'abs' instead
  return fabs((a - b) / (a + b)) < 0.00001;
         ^~~~
         abs
2 warnings and 1 error generated.
make[2]: *** [hybrid_min-hybrid-min.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Then proceeding to "make install":

Code: Select all

oligoarrayaux-3.8 % make install
Making install in src
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_min-hybrid-min.o -MD -MP -MF .deps/hybrid_min-hybrid-min.Tpo -c -o hybrid_min-hybrid-min.o `test -f 'hybrid-min.c' || echo './'`hybrid-min.c
hybrid-min.c:2201:8: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration]
  if (!finite(a) || !finite(b))
       ^
hybrid-min.c:2201:8: note: include the header <math.h> or explicitly provide a declaration for 'finite'
hybrid-min.c:2206:10: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
  return fabs(a - b) < 1e-5;
         ^
hybrid-min.c:2206:10: note: use function 'abs' instead
  return fabs(a - b) < 1e-5;
         ^~~~
         abs
hybrid-min.c:2211:10: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
  return fabs((a - b) / (a + b)) < 0.00001;
         ^
hybrid-min.c:2211:10: note: use function 'abs' instead
  return fabs((a - b) / (a + b)) < 0.00001;
         ^~~~
         abs
2 warnings and 1 error generated.
make[1]: *** [hybrid_min-hybrid-min.o] Error 1
make: *** [install-recursive] Error 1
So it seems to have worked? I dont see the program in my path variable but will add it and see if it works with the R package "openPrimeR" I am installing it for.

Thanks again.

-Blake
nmarkham
Site Admin
Posts: 25
Joined: Wed Jun 29, 2022 5:23 pm

Re: OligoArrayAux v3.8 compilation fail

Post by nmarkham »

Based on the "1 error generated" and the fact that "make install" tries to do the build again, I'm guessing your build didn't succeed. :(

This seems to be another error caused by the compiler treating the code as C99 instead of C89. I don't see any setting for language standard in your output, which makes me wonder if the configure script understood CFLAGS. I don't know why "./configure CFLAGS=-std=gnu89" wouldn't solve all of this.

You can probably solve this problem by editing hybrid-min.c and removing everything after the #endif at line 3100 and before the } at line 3113. You'll have to make a similar edit to hybrid-ss-min.c. At this point I doubt that will be the last change you'll have to make, but I'll keep pursuing this as long as you want to!
bhumm
Posts: 4
Joined: Tue Nov 22, 2022 1:04 am

Re: OligoArrayAux v3.8 compilation fail

Post by bhumm »

So I removed that chunk of code (lines 3100-3112) from hybrid-ss-min.c but the hybrid-min.c script is only 2261 lines long and there is ~18 #endifs in there and I dont want to break anything too badly :mrgreen: . Ill happily keep working at this!

Dp you think these problems could be avoided or superseded if I create a conda environment and download from there?

-blake
nmarkham
Site Admin
Posts: 25
Joined: Wed Jun 29, 2022 5:23 pm

Re: OligoArrayAux v3.8 compilation fail

Post by nmarkham »

Sorry, I should have been clear that it isn't the same line numbers in hybrid-min.c. The equal() function appears at line 2195, so it's lines 2200–2211 to delete.

I didn't know what conda was until I Googled it just now. I don't really understand it; I don't think it has any relevance here, but I could be wrong. :)
Sizzle0756
Posts: 4
Joined: Thu Nov 17, 2022 9:23 am

Re: OligoArrayAux v3.8 compilation fail

Post by Sizzle0756 »

Dear Nick,

thanks a lot for taking this on! I just saw you had written a reply. I have implemented the changes you suggest (added the line in energy.c which reproduced the error message from Blake) and commenting out the lines 2200 - 2211 and 3100 - 3112 in hybrid-min.c and hybrid-ss-min.c, respectively.

Unfortunately, `make`still throws an error:

Code: Select all


(base) um108-165:oligoarrayaux-3.8 fabian$ make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_min-hybrid-min.o -MD -MP -MF .deps/hybrid_min-hybrid-min.Tpo -c -o hybrid_min-hybrid-min.o `test -f 'hybrid-min.c' || echo './'`hybrid-min.c
mv -f .deps/hybrid_min-hybrid-min.Tpo .deps/hybrid_min-hybrid-min.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT getopt.o -MD -MP -MF .deps/getopt.Tpo -c -o getopt.o getopt.c
mv -f .deps/getopt.Tpo .deps/getopt.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT getopt1.o -MD -MP -MF .deps/getopt1.Tpo -c -o getopt1.o getopt1.c
mv -f .deps/getopt1.Tpo .deps/getopt1.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT xmalloc.o -MD -MP -MF .deps/xmalloc.Tpo -c -o xmalloc.o xmalloc.c
mv -f .deps/xmalloc.Tpo .deps/xmalloc.Po
gcc  -g -O2   -o hybrid-min hybrid_min-energy.o hybrid_min-hybrid-min.o getopt.o getopt1.o xmalloc.o -lm 
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_ss_min-energy.o -MD -MP -MF .deps/hybrid_ss_min-energy.Tpo -c -o hybrid_ss_min-energy.o `test -f 'energy.c' || echo './'`energy.c
mv -f .deps/hybrid_ss_min-energy.Tpo .deps/hybrid_ss_min-energy.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DENERGY=int -DINTEGER -DPRECISION=1000 -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT hybrid_ss_min-hybrid-ss-min.o -MD -MP -MF .deps/hybrid_ss_min-hybrid-ss-min.Tpo -c -o hybrid_ss_min-hybrid-ss-min.o `test -f 'hybrid-ss-min.c' || echo './'`hybrid-ss-min.c
hybrid-ss-min.c:711:12: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
              if (fabs(Q5(g_len) - Q3(1)) > 1e-12)
                  ^
hybrid-ss-min.c:711:12: note: use function 'abs' instead
              if (fabs(Q5(g_len) - Q3(1)) > 1e-12)
                  ^~~~
                  abs
1 warning generated.
mv -f .deps/hybrid_ss_min-hybrid-ss-min.Tpo .deps/hybrid_ss_min-hybrid-ss-min.Po
gcc  -g -O2   -o hybrid-ss-min hybrid_ss_min-energy.o hybrid_ss_min-hybrid-ss-min.o getopt.o getopt1.o xmalloc.o -lm 
gcc -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -MT energy.o -MD -MP -MF .deps/energy.Tpo -c -o energy.o energy.c
energy.c:139:14: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration]
          else if (!isFinite(stackEnergies[i][j][ii][jj]) || !isFinite(stackEnthalpies[i][j][ii][jj]))
                    ^
./energy.h:19:22: note: expanded from macro 'isFinite'
# define isFinite(x) finite(x)
                     ^
energy.c:139:14: note: include the header <math.h> or explicitly provide a declaration for 'finite'
./energy.h:19:22: note: expanded from macro 'isFinite'
# define isFinite(x) finite(x)
                     ^
1 error generated.
make[2]: *** [energy.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Sizzle0756
Posts: 4
Joined: Thu Nov 17, 2022 9:23 am

Re: OligoArrayAux v3.8 compilation fail

Post by Sizzle0756 »

FYI, I tried to look into how to make it compile with c89 and found that we can provide a flag to the configure command:

Code: Select all

./configure CC=c89
when I do this, and the run make, the error changes to

Code: Select all


Making install in src
source='energy.c' object='energy.o' libtool=no \
	DEPDIR=.deps depmode=gcc /bin/sh ../config/depcomp \
	c89 -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR=\"/usr/local/share/oligoarrayaux/\"   -g -O2 -c energy.c
clang: error: no such file or directory: 'HAVE_CONFIG_H'
clang: error: no such file or directory: 'PKGDATADIR="/usr/local/share/oligoarrayaux/"'

not sure if that helps at all... ¯\_(ツ)_/¯
Post Reply