freeseek / gtc2vcf

Tools to convert Illumina IDAT/BPM/EGT/GTC and Affymetrix CEL/CHP files to VCF
MIT License
131 stars 22 forks source link

Problem compile affy2vcf.c #22

Closed zgtman closed 3 years ago

zgtman commented 3 years ago

Hello,

I just try to compile bcftools with your new plugin with error:

gcc -fPIC -shared -g -Wall -O2 -I. -I../htslib    -o plugins/affy2vcf.so version.c plugins/affy2vcf.c 
In file included from plugins/affy2vcf.c:39:0:
plugins/gtc2vcf.h: In function ‘flank_reverse_complement’:
plugins/gtc2vcf.h:186:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; i < len / 2; i++) {
  ^
plugins/gtc2vcf.h:186:2: note: use option -std=c99 or -std=gnu99 to compile your code
plugins/gtc2vcf.h: In function ‘flank_left_shift’:
plugins/gtc2vcf.h:215:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (const char *ptr = middle + 2; ptr < right; ptr++)
  ^
plugins/gtc2vcf.h: In function ‘get_position’:
plugins/gtc2vcf.h:306:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int k = 0; k < n_cigar && qlen > 1; k++) {
    ^
plugins/affy2vcf.c: In function ‘read_bytes’:
plugins/affy2vcf.c:79:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < nbytes; i++)
   ^
plugins/affy2vcf.c: In function ‘read_string16’:
plugins/affy2vcf.c:132:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < len; i++) {
   ^
plugins/affy2vcf.c: In function ‘xda_cel_print’:
plugins/affy2vcf.c:298:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < xda_cel->num_cells; i++)
   ^
plugins/affy2vcf.c:308:12: error: redefinition of ‘i’
   for (int i = 0; i < xda_cel->num_masked_cells; i++)
            ^
plugins/affy2vcf.c:298:12: note: previous definition of ‘i’ was here
   for (int i = 0; i < xda_cel->num_cells; i++)
            ^
plugins/affy2vcf.c:308:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < xda_cel->num_masked_cells; i++)
   ^
plugins/affy2vcf.c:317:12: error: redefinition of ‘i’
   for (int i = 0; i < xda_cel->num_outlier_cells; i++)
            ^
plugins/affy2vcf.c:308:12: note: previous definition of ‘i’ was here
   for (int i = 0; i < xda_cel->num_masked_cells; i++)
            ^
plugins/affy2vcf.c:317:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < xda_cel->num_outlier_cells; i++)
   ^
plugins/affy2vcf.c: In function ‘agcc_read_data_header’:
plugins/affy2vcf.c:459:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_header->n_parameters; i++)
  ^
plugins/affy2vcf.c:465:11: error: redefinition of ‘i’
  for (int i = 0; i < data_header->n_parents; i++)
           ^
plugins/affy2vcf.c:459:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < data_header->n_parameters; i++)
           ^
plugins/affy2vcf.c:465:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_header->n_parents; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_read_data_set’:
plugins/affy2vcf.c:477:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_parameters; i++)
  ^
plugins/affy2vcf.c:482:11: error: redefinition of ‘i’
  for (int i = 0; i < data_set->n_cols; i++) {
           ^
plugins/affy2vcf.c:477:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < data_set->n_parameters; i++)
           ^
plugins/affy2vcf.c:482:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_cols; i++) {
  ^
plugins/affy2vcf.c:492:11: error: redefinition of ‘i’
  for (int i = 0; i < data_set->n_cols; i++) {
           ^
plugins/affy2vcf.c:482:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < data_set->n_cols; i++) {
           ^
plugins/affy2vcf.c:492:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_cols; i++) {
  ^
plugins/affy2vcf.c: In function ‘agcc_read_data_group’:
plugins/affy2vcf.c:514:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_group->num_data_sets; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_init’:
plugins/affy2vcf.c:548:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < agcc->num_data_groups; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_destroy_parameters’:
plugins/affy2vcf.c:576:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n_parameters; i++) {
  ^
plugins/affy2vcf.c: In function ‘agcc_destroy_data_header’:
plugins/affy2vcf.c:591:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_header->n_parents; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_destroy_data_set’:
plugins/affy2vcf.c:600:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_cols; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_destroy_data_group’:
plugins/affy2vcf.c:610:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_group->num_data_sets; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_destroy’:
plugins/affy2vcf.c:623:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < agcc->num_data_groups; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_print_parameters’:
plugins/affy2vcf.c:639:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n_parameters; i++) {
  ^
plugins/affy2vcf.c:674:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int j = 0; j < parameters[i].n_value / 2; j++)
    ^
plugins/affy2vcf.c: In function ‘agcc_print_data_header’:
plugins/affy2vcf.c:694:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_header->n_parents; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_print_data_set’:
plugins/affy2vcf.c:731:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_cols; i++)
  ^
plugins/affy2vcf.c:749:11: error: redefinition of ‘i’
  for (int i = 0; i < data_set->n_cols; i++) {
           ^
plugins/affy2vcf.c:731:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < data_set->n_cols; i++)
           ^
plugins/affy2vcf.c:749:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_cols; i++) {
  ^
plugins/affy2vcf.c:774:11: error: redefinition of ‘i’
  for (int i = 0; i < data_set->n_rows; i++) {
           ^
plugins/affy2vcf.c:749:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < data_set->n_cols; i++) {
           ^
plugins/affy2vcf.c:774:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_set->n_rows; i++) {
  ^
plugins/affy2vcf.c:776:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int j = 0; j < data_set->n_cols; j++) {
   ^
plugins/affy2vcf.c: In function ‘agcc_print_data_group’:
plugins/affy2vcf.c:788:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < data_group->num_data_sets; i++)
  ^
plugins/affy2vcf.c: In function ‘agcc_print’:
plugins/affy2vcf.c:799:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < agcc->num_data_groups; i++)
  ^
plugins/affy2vcf.c: In function ‘agccs_to_tsv’:
plugins/affy2vcf.c:826:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int j = 0; j < 20; j++)
  ^
plugins/affy2vcf.c:829:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c:833:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int j = 0, k = 0; j < 20; j++) {
   ^
plugins/affy2vcf.c: In function ‘cels_to_tsv’:
plugins/affy2vcf.c:976:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c:1004:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int k = 0; k < data_header->parameters[j].n_value / 2; k++)
    ^
plugins/affy2vcf.c: In function ‘models_init’:
plugins/affy2vcf.c:1119:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < 2; i++) {
  ^
plugins/affy2vcf.c: In function ‘models_destroy’:
plugins/affy2vcf.c:1225:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < 2; i++) {
  ^
plugins/affy2vcf.c:1227:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int j = 0; j < models->n_snps[i]; j++)
   ^
plugins/affy2vcf.c: In function ‘annot_init’:
plugins/affy2vcf.c:1316:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < ncols; i++) {
  ^
plugins/affy2vcf.c:1421:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (int i = 1; i < ncols; i++) {
     ^
plugins/affy2vcf.c: In function ‘annot_destroy’:
plugins/affy2vcf.c:1538:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < annot->n_records; i++) {
  ^
plugins/affy2vcf.c: In function ‘report_destroy’:
plugins/affy2vcf.c:1594:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < report->n_samples; i++)
  ^
plugins/affy2vcf.c: In function ‘varitr_init_cc’:
plugins/affy2vcf.c:1645:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c: In function ‘varitr_init_txt’:
plugins/affy2vcf.c:1700:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 1; i < ncols; i++) {
   ^
plugins/affy2vcf.c:1716:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < ncols; i++) {
    ^
plugins/affy2vcf.c:1733:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < ncols; i++) {
    ^
plugins/affy2vcf.c: In function ‘varitr_loop’:
plugins/affy2vcf.c:1782:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < varitr->nsmpl; i++) {
   ^
plugins/affy2vcf.c:1839:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < 1 + varitr->nsmpl; i++)
    ^
plugins/affy2vcf.c:1852:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < 1 + varitr->nsmpl; i++)
    ^
plugins/affy2vcf.c:1885:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < 1 + varitr->nsmpl; i++)
    ^
plugins/affy2vcf.c:1895:13: error: redefinition of ‘i’
    for (int i = 1; i < 1 + varitr->nsmpl; i++) {
             ^
plugins/affy2vcf.c:1885:13: note: previous definition of ‘i’ was here
    for (int i = 1; i < 1 + varitr->nsmpl; i++)
             ^
plugins/affy2vcf.c:1895:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 1; i < 1 + varitr->nsmpl; i++) {
    ^
plugins/affy2vcf.c: In function ‘hdr_init’:
plugins/affy2vcf.c:1949:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c: In function ‘adjust_clusters’:
plugins/affy2vcf.c:2139:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c: In function ‘compute_baf_lrr’:
plugins/affy2vcf.c:2228:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n; i++) {
  ^
plugins/affy2vcf.c: In function ‘process’:
plugins/affy2vcf.c:2340:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (int i = 0; i < nsmpl; i++) {
     ^
plugins/affy2vcf.c:2389:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 0; i < 2; i++) {
    ^
plugins/affy2vcf.c: In function ‘run’:
plugins/affy2vcf.c:2708:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < report->n_samples; i++) {
   ^
plugins/affy2vcf.c:2729:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < nfiles; i++) {
  ^
plugins/affy2vcf.c:2825:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < nfiles; i++)
   ^
plugins/affy2vcf.c:2829:11: error: redefinition of ‘i’
  for (int i = 0; i < nfiles; i++) {
           ^
plugins/affy2vcf.c:2729:11: note: previous definition of ‘i’ was here
  for (int i = 0; i < nfiles; i++) {
           ^
plugins/affy2vcf.c:2829:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < nfiles; i++) {

Any suggestion to solve this compiling problem? I Have CentOS 7 and all compilation with all plugins work perfectly fine.

Best,

Petr.

freeseek commented 3 years ago

I believe that's because in CentOS 7 you are using gcc 4.8.5 and it states in the gtc2vcf manual that you need gcc version 5 or newer. I think one way to fix that is to force this old version of gcc to accept the C99 standard. From the bcftools directory you can try:

sed -i 's/^CFLAGS   = -g -Wall -O2$/CFLAGS   = -g -Wall -O2 -std=c99/' Makefile

Then try to compile again with make