Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error on Cygwin: expl() is missing #281

Open
vtilroe opened this issue Jun 13, 2015 · 12 comments
Open

Compile error on Cygwin: expl() is missing #281

vtilroe opened this issue Jun 13, 2015 · 12 comments
Assignees

Comments

@vtilroe
Copy link

vtilroe commented Jun 13, 2015

prob1.c: In function ‘mc_cal_y’:
prob1.c:321:13: warning: incompatible implicit declaration of built-in function ‘expl’
x = expl(ma->t - (ma->t1 + ma->t2));

prob1.h defines bcf_p1aux_t structure with long t, t1, t2
but expl function argument expects long double.

Changing x to double and using exp2 function instead, resulted in a successful compile. Not sure if this is as designed?

@jmarshall
Copy link
Member

expl() is a C99 function that apparently is not declared in your Cygwin's <math.h>. Everywhere else in bcftools uses plain exp() and in fact the argument here in prob1.c is just a double too.

So the right fix is probably to just replace expl with exp here.

@jmarshall
Copy link
Member

(Using exp2 would be wrong, as that computes 2x rather than ex, so it is exp you want.)

This was introduced in samtools/samtools@390bbfb and is either intentionally desiring more precision in the temporaries (perhaps it's getting it… rather needs an f.p. expert) or was accidentally checked in with unrelated code.

Hard to say. Hmmm…

@jmarshall
Copy link
Member

@lh3: do you have any recollection about the need for long double and expl in mc_cal_y()?

Now that we're well into the 21st century, perhaps what we really want to do is just use expl et al and provide a fallback defined in terms of exp for platforms that still don't have it…

@jmarshall jmarshall changed the title Compile error under cygwin bcftools-1.2 Compile error on Cygwin: expl() is missing Jan 22, 2016
@tpibob
Copy link

tpibob commented Jan 29, 2016

error when using make under cygwin64
I hope the following outlines the problem

Bob
$ make
echo '#define BCFTOOLS_VERSION "1.3"' > version.h
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH="/usr/local/libexec/bcftools" -c -o main.o main.c
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH="/usr/local/libexec/bcftools" -c -o vcfindex.o vcfindex.c
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH="/usr/local/libexec/bcftools" -c -o tabix.o tabix.c
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH="/usr/local/libexec/bcftools" -c -o vcfstats.o vcfstats.c
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH="/usr/local/libexec/bcftools" -c -o vcfisec.o vcfisec.c
vcfisec.c: In function ‘main_vcfisec’ ##this is the first of these messages which are followed by one or more of entries like
vcfisec.c:556:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
else if ( isdigit(p) ) args->isec_op = OP_EQUAL;
^ ##from this point I have only given the key function messages until near the end
filter.c: In function ‘filters_next_token’:
filter.c: In function ‘filters_init1’
vcfnorm.c: In function ‘replace_iupac_codes’
vcfannotate.c: In function ‘set_samples’
vcfannotate.c: In function ‘rename_chrs’
vcfroh.c: In function ‘load_genmap’
vcfroh.c: In function ‘read_AF’
vcfcall.c: In function ‘parse_ped_samples’
vcfcall.c: In function ‘set_samples’
vcmp.c: In function ‘vcmp_set_ref’
vcmp.c: In function ‘vcmp_find_allele’
reheader.c: In function ‘read_header_file’
reheader.c: In function ‘set_sample_pairs’:
convert.c: In function ‘parse_subscript
tsv2vcf.h: In function ‘tsv_next’:
vcfconvert.c: In function ‘tsv_setter_chrom_pos_ref_alt’
vcfconvert.c: In function ‘tsv_setter_verify_ref_alt’:
vcfconvert.c: In function ‘gensample_to_vcf’:
vcfconvert.c: In function ‘haplegendsample_to_vcf’:
vcfconvert.c: In function ‘hapsample_to_vcf’
vcfconvert.c: In function ‘tsv_setter_aa1’
vcfconvert.c: In function ‘tsv_setter_aa’
tsv2vcf.h: In function ‘tsv_next’
tsv2vcf.c: In function ‘tsv_parse’
consensus.c: In function ‘init_region’
consensus.c: In function ‘apply_variant’
consensus.c: In function ‘consensus
ploidy.c: In function ‘ploidy_parse’
ploidy.c: In function ‘ploidy_init_string’
prob1.c: In function ‘mc_cal_y’ ##from here back to real time recording
/usr/local/bin/bcftools-1.3/prob1.c:320: undefined reference to expl' /usr/local/bin/bcftools-1.3/prob1.c:320:(.text+0x1842): relocation truncated to fit: R_X86_64_PC32 against undefined symbolexpl'
collect2: error: ld returned 1 exit status
Makefile:185: recipe for target 'bcftools' failed
make: *
* [bcftools] Error 1

@tpibob
Copy link

tpibob commented Jan 29, 2016

ps bcftools-1.3

@jmarshall
Copy link
Member

As noted, you can work around this by replacing expl with exp here. A quick hack to do this is to add ‑Dexpl=exp to the EXTRA_CPPFLAGS line in the Makefile. (If you've already run make, delete prob1.o to ensure that it gets remade when you rerun make.)

@tpibob
Copy link

tpibob commented Jan 29, 2016

OK done that fixed one lot of problems and made a couple of extra new ones as follows

Robert@DESKTOP-14EL82S /usr/local/bin/bcftools-1.3
$ make
echo '#define BCFTOOLS_VERSION "1.3"' > version.h

there are chages in the next line with a new warning on the following 2 lines

gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o main.o main.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o vcfindex.o vcfindex.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o tabix.o tabix.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o vcfstats.o vcfstats.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done
##there are chages in the next line with a new warning on the following
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o vcfisec.o vcfisec.c
:0:5: warning: ISO C99 requires whitespace after the macro name
vcfisec.c: In function ‘main_vcfisec’ ##this is the first of these messages which are followed by one or more of entries like
vcfisec.c:556:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
else if ( isdigit(p) ) args->isec_op = OP_EQUAL;
##and a new ending
Makefile:106: recipe for target 'vcfplugin.o' failed
make: *
* [vcfplugin.o] Error 1

All the following functions in the files all relate to the sameas outlined above with 'char'

Bob
^ ##from this point I have only given the key function messages until near the end all warnings refer to 'char'
##the following is the second warning mention in line 4
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done
##from here the two warning in line 4 are given in each case of gcc
vcfmerge.c: In function ‘merge_alleles’:
filter.c: In function ‘filters_next_token’:
filter.c: In function ‘filters_init1’:
vcfnorm.c: In function ‘replace_iupac_codes’:
vcfannotate.c: In function ‘set_samples’:
vcfannotate.c: In function ‘rename_chrs’:
vcfroh.c: In function ‘load_genmap’:
vcfroh.c: In function ‘read_AF’:
vcfcall.c: In function ‘parse_ped_samples’:
vcfcall.c: In function ‘set_samples’:
vcmp.c: In function ‘vcmp_set_ref’:
##next line new
vcmp.c: In function ‘vcmp_find_allele’:
reheader.c: In function ‘read_header_file’:
reheader.c: In function ‘set_sample_pairs’:
convert.c: In function ‘parse_subscript’:
##next line new
convert.c: In function ‘parse_tag’:
##next line new
In file included from vcfconvert.c:42:0:
tsv2vcf.h: In function ‘tsv_next’:
vcfconvert.c: In function ‘tsv_setter_chrom_pos_ref_alt’:
vcfconvert.c: In function ‘tsv_setter_verify_ref_alt’:
vcfconvert.c: In function ‘gensample_to_vcf’:
vcfconvert.c: In function ‘haplegendsample_to_vcf’:
vcfconvert.c: In function ‘hapsample_to_vcf’:
vcfconvert.c: In function ‘tsv_setter_aa1’:
vcfconvert.c: In function ‘tsv_setter_aa’:
##next line new
In file included from tsv2vcf.c:27:0:
tsv2vcf.h: In function ‘tsv_next’:
tsv2vcf.c: In function ‘tsv_parse’:
##next line new
vcfplugin.c: In function ‘add_plugin_paths’:

@vtilroe
Copy link
Author

vtilroe commented Jan 29, 2016

Hi Bob,

I haven't got around to looking at this in depth.

But just a reminder if you are not doing this already: every time a
build attempt fails, you need to execute

$ make clean

to delete the botched linker and object files.

Vince T.

On 2016-01-29 8:44 AM, tpibob wrote:

OK done that fixed one lot of problems and made a couple of extra new
ones as follows

Robert@DESKTOP-14EL82S /usr/local/bin/bcftools-1.3
$ make
echo '#define BCFTOOLS_VERSION "1.3"' > version.h

there are chages in the next line with a new warning on the
following 2 lines

gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3
-DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c
-o main.o main.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input
file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3
-DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c
-o vcfindex.o vcfindex.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input
file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3
-DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c
-o tabix.o tabix.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input
file unused because linking not done
##see line 4
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3
-DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c
-o vcfstats.o vcfstats.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input
file unused because linking not done
##there are chages in the next line with a new warning on the following
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3
-DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c
-o vcfisec.o vcfisec.c
:0:5: warning: ISO C99 requires whitespace after the macro name
vcfisec.c: In function ‘main_vcfisec’ ##this is the first of these
messages which are followed by one or more of entries like
vcfisec.c:556:21: warning: array subscript has type ‘char’
[-Wchar-subscripts]
else if ( isdigit(/p) ) args->isec_op = OP_EQUAL;
##and a new ending
Makefile:106: recipe for target 'vcfplugin.o' failed
make: / [vcfplugin.o] Error 1

All the following functions in the files all relate to the sameas
outlined above with 'char'

Bob
^ ##from this point I have only given the key function messages until
near the end all warnings refer to 'char'
##the following is the second warning mention in line 4
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input
file unused because linking not done
##from here the two warning in line 4 are given in each case of gcc
vcfmerge.c: In function ‘merge_alleles’:
filter.c: In function ‘filters_next_token’:
filter.c: In function ‘filters_init1’:
vcfnorm.c: In function ‘replace_iupac_codes’:
vcfannotate.c: In function ‘set_samples’:
vcfannotate.c: In function ‘rename_chrs’:
vcfroh.c: In function ‘load_genmap’:
vcfroh.c: In function ‘read_AF’:
vcfcall.c: In function ‘parse_ped_samples’:
vcfcall.c: In function ‘set_samples’:
vcmp.c: In function ‘vcmp_set_ref’:
##next line new
vcmp.c: In function ‘vcmp_find_allele’:
reheader.c: In function ‘read_header_file’:
reheader.c: In function ‘set_sample_pairs’:
convert.c: In function ‘parse_subscript’:
##next line new
convert.c: In function ‘parse_tag’:
##next line new
In file included from vcfconvert.c:42:0:
tsv2vcf.h: In function ‘tsv_next’:
vcfconvert.c: In function ‘tsv_setter_chrom_pos_ref_alt’:
vcfconvert.c: In function ‘tsv_setter_verify_ref_alt’:
vcfconvert.c: In function ‘gensample_to_vcf’:
vcfconvert.c: In function ‘haplegendsample_to_vcf’:
vcfconvert.c: In function ‘hapsample_to_vcf’:
vcfconvert.c: In function ‘tsv_setter_aa1’:
vcfconvert.c: In function ‘tsv_setter_aa’:
##next line new
In file included from tsv2vcf.c:27:0:
tsv2vcf.h: In function ‘tsv_next’:
tsv2vcf.c: In function ‘tsv_parse’:
##next line new
vcfplugin.c: In function ‘add_plugin_paths’:


Reply to this email directly or view it on GitHub
#281 (comment).

@tpibob
Copy link

tpibob commented Jan 30, 2016

Vince T
Thanks
I don't think I have a linker or its function is not working
gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 -DPLUGINPATH= "c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o vcfisec.o vcfisec.c
:0:5: warning: ISO C99 requires whitespace after the macro name
gcc: warning: c:/cygwin64/usr/local/bin/bcftools-1.3: linker input file unused because linking not done

something in makefile is not right is this area

Adjust $(HTSDIR) to point to your top-level htslib directory

HTSDIR = htslib-1.3
include $(HTSDIR)/htslib.mk
HTSLIB = $(HTSDIR)/libhts.a
BGZIP = $(HTSDIR)/bgzip
TABIX = $(HTSDIR)/tabix

CC = gcc
CPPFLAGS =
CFLAGS = -g -Wall -Wc++-compat -O2 -std=gnu99
##added after run 1 changed c to gnu
LDFLAGS =
LIBS =

OBJS = main.o vcfindex.o tabix.o
vcfstats.o vcfisec.o vcfmerge.o vcfquery.o vcffilter.o filter.o vcfsom.o
vcfnorm.o vcfgtcheck.o vcfview.o vcfannotate.o vcfroh.o vcfconcat.o
vcfcall.o mcall.o vcmp.o gvcf.o reheader.o convert.o vcfconvert.o tsv2vcf.o
vcfcnv.o HMM.o vcfplugin.o consensus.o ploidy.o version.o
ccall.o em.o prob1.o kmin.o \

       # the original samtools calling

EXTRA_CPPFLAGS = -I. -I$(HTSDIR) -DPLUGINPATH= "$(pluginpath)" -Dexpl-exp

*** This in above is part of the problem -DPLUGINPATH= "$(pluginpath)" it used to look like -DPLUGINPATH=/ "$(pluginpath)"with no spave after = and not space between \ and/ and see the section below starting at &&&

GSL_LIBS =

The polysomy command is not compiled by default because it brings dependency

on libgsl. The command can be compiled wth make USE_GPL=1. See the INSTALL

and LICENSE documents to understand license implications.

ifdef USE_GPL
EXTRA_CPPFLAGS += -DUSE_GPL
OBJS += polysomy.o peakfit.o
GSL_LIBS = -lgsl -lcblas
endif
&&&
prefix = c:/cygwin64/usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
libexecdir = $(exec_prefix)/bin
mandir = $(prefix)/share/man
man1dir = $(mandir)/man1

plugindir = $(libexecdir)/bcftools-1.3
pluginpath = $(plugindir)

the white space - I tried a couple of things but figured I was in the wrong area

Bob

@tpibob
Copy link

tpibob commented Jan 30, 2016

Am I guessing correctly that the bolt that appeas above are instructions or hints to fix the problem?

@jmarshall
Copy link
Member

gcc -g -Wall -Wc++-compat -O2 -std=gnu99 -I. -Ihtslib-1.3 ‑DPLUGINPATH="c:/cygwin64/usr/local/bin/bcftools-1.3" -Dexpl-exp -c -o main.o main.c
:0:5: warning: ISO C99 requires whitespace after the macro name

@tpibob: You need to read the newly-produced warnings, consider what's newly changed that might have triggered them (here, the part in bold), and copy more carefully.

When you have fixed that, you will have a working bcftools.exe but not plugins. See #377 for why plugins/fill-AN-AC.so etc cannot be built on Cygwin at the moment.

@tpibob
Copy link

tpibob commented Feb 2, 2016

bcftools now working and caught up on backlog
Thanks for assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants