Closed Jehops closed 1 year ago
Hello Dr. Yang,
Since these definitions of anonymous enums are unused, if you prefer them to be removed, please just let me know and I will update the pull request.
Here is a log of the errors in case they are useful: https://ftfl.ca/misc/paml-4.9j.log
Joseph
hi joe,
does this problem occur with the code at the dev/ branch?
thanks, ziheng
The linking error also occurs in the dev
branch because there are still multiple tentative definitions with the same name.
Starting with gcc version 10, -fno-common
is the default as well, so I believe this is also a problem with newer versions of gcc.
I can confirm the problem exists with gcc
version 10.2 and that the patch fixes the problem.
Without patch:
jrm@storage2 ~/scm/nm/paml/src [dev|✚1] % make
gcc10 -O3 -o baseml baseml.c tools.c -lm
In file included from baseml.c:137:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from baseml.c:11:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/bin/ld: /tmp//ccSL5Igk.o:(.bss+0x4540): multiple definition of `OutTreeOptions'; /tmp//ccz9P7Vg.o:(.bss+0x2a0dfe8): first defined here
/usr/local/bin/ld: /tmp//ccSL5Igk.o:(.bss+0x4544): multiple definition of `SeqTypes'; /tmp//ccz9P7Vg.o:(.bss+0x2a0dfec): first defined here
collect2: error: ld returned 1 exit status
*** Error code 1
Stop.
make: stopped in /tank2/home/jrm/scm/nm/paml/src
With patch:
jrm@storage2 ~/scm/nm/paml/src [dev|✚2] % make
gcc10 -O3 -o baseml baseml.c tools.c -lm
In file included from baseml.c:137:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from baseml.c:11:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o codeml codeml.c tools.c -lm
In file included from codeml.c:243:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from codeml.c:17:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o basemlg basemlg.c tools.c -lm
In file included from basemlg.c:80:
treesub.c: In function 'ReadSeq':
treesub.c:858:31: warning: passing argument 2 of 'printsma' from incompatible pointer type [-Wincompatible-pointer-types]
858 | printsma(fout, com.spname, com.z, com.ns, com.ls, com.ls, gap, com.seqtype, 0, 0, NULL);
| ~~~^~~~~~~
| |
| unsigned char **
In file included from basemlg.c:11:
paml.h:153:31: note: expected 'char **' but argument is of type 'unsigned char **'
153 | int printsma (FILE*fout, char*spname[], unsigned char*z[], int ns, int l, int lline, int gap, int seqtype,
| ~~~~~^~~~~~~~
In file included from basemlg.c:80:
treesub.c:866:28: warning: passing argument 2 of 'printsma' from incompatible pointer type [-Wincompatible-pointer-types]
866 | printsma(fout, com.spname, com.z, com.ns, com.ls, com.ls, gap, com.seqtype, 0, 0, NULL);
| ~~~^~~~~~~
| |
| unsigned char **
In file included from basemlg.c:11:
paml.h:153:31: note: expected 'char **' but argument is of type 'unsigned char **'
153 | int printsma (FILE*fout, char*spname[], unsigned char*z[], int ns, int l, int lline, int gap, int seqtype,
| ~~~~~^~~~~~~~
In file included from basemlg.c:80:
treesub.c: In function 'printPatterns':
treesub.c:1093:25: warning: passing argument 2 of 'printsma' from incompatible pointer type [-Wincompatible-pointer-types]
1093 | printsma(fout, com.spname, com.z, com.ns, com.npatt, com.npatt, gap, com.seqtype, 1, 0, NULL);
| ~~~^~~~~~~
| |
| unsigned char **
In file included from basemlg.c:11:
paml.h:153:31: note: expected 'char **' but argument is of type 'unsigned char **'
153 | int printsma (FILE*fout, char*spname[], unsigned char*z[], int ns, int l, int lline, int gap, int seqtype,
| ~~~~~^~~~~~~~
In file included from basemlg.c:80:
treesub.c: In function 'AllPatterns':
treesub.c:1361:25: warning: passing argument 2 of 'printsma' from incompatible pointer type [-Wincompatible-pointer-types]
1361 | printsma(fout, com.spname, com.z, com.ns, com.ls, com.ls, gap, com.seqtype, 1, 0, NULL);
| ~~~^~~~~~~
| |
| unsigned char **
In file included from basemlg.c:11:
paml.h:153:31: note: expected 'char **' but argument is of type 'unsigned char **'
153 | int printsma (FILE*fout, char*spname[], unsigned char*z[], int ns, int l, int lline, int gap, int seqtype,
| ~~~~~^~~~~~~~
gcc10 -O3 -o mcmctree mcmctree.c tools.c -lm
In file included from mcmctree.c:215:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from mcmctree.c:22:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o infinitesites -D INFINITESITES mcmctree.c tools.c -lm
In file included from mcmctree.c:215:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from mcmctree.c:22:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o pamp pamp.c tools.c -lm
In file included from pamp.c:66:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from pamp.c:8:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o evolver evolver.c tools.c -lm
gcc10 -O3 -o yn00 yn00.c tools.c -lm
In file included from yn00.c:70:
treesub.c: In function 'IdenticalSeqs':
treesub.c:1310:33: warning: passing argument 3 of 'printSeqs' from incompatible pointer type [-Wincompatible-pointer-types]
1310 | printSeqs(ftmp, com.z, com.spname, com.ns, com.ls, com.npatt, com.fpatt, NULL, keep, 1);
| ~~~^~~~~~~
| |
| char **
In file included from yn00.c:13:
paml.h:150:63: note: expected 'unsigned char **' but argument is of type 'char **'
150 | void printSeqs(FILE *fout, unsigned char *z[], unsigned char *spnames[], int ns, int ls, int npatt, double fpatt[], int *pose, char keep[], int format);
| ~~~~~~~~~~~~~~~^~~~~~~~~
gcc10 -O3 -o chi2 chi2.c -lm
make 73.88s user 1.38s system 99% cpu 1:15.28 total
jrm@storage2 ~/scm/nm/paml/src [dev|✚2…9] %
hi joe,
i posted an update to remove some of the compiler warnings. i hope this fixes the clang errors as well. could you check.
thanks and best wishes, ziheng
Hi Dr. Yang,
This build finishes without errors and the output is cleaner with many of the warnings fixed. There is a link below to the build output using clang 8.0.2, which looks very similar to the output using gcc 10.2.0 now.
J.
http://pkg.awarnach.mathstat.dal.ca/data/12amd64-default/2020-09-08_15h53m05s/logs/paml-4.9j.log
Merging of tentative definitions by the linker gives multiple-definition errors with Clang/LLVM version 11, which uses -fno-common by default.
These tentative definitions of anonymous enums are included multiple times in the translation unit, resulting in the error above. Since they are unused, switch them to non-anonymous enums without any declaration or definition.
Submitted by: Kyle Evans (to the FreeBSD port)