rwdavies / STITCH

STITCH - Sequencing To Imputation Through Constructing Haplotypes
http://www.nature.com/ng/journal/v48/n8/abs/ng.3594.html
GNU General Public License v3.0
76 stars 17 forks source link

Problem compiling STITCH #45

Closed rmott closed 3 years ago

rmott commented 3 years ago

Hi Robbie

I get the following error when I tried to compile and install the latest version:

These are the commands I used:

git clone --recursive https://github.com/rwdavies/STITCH.git cd STITCH ./scripts/install-dependencies.sh cd releases wget https://github.com/rwdavies/stitch/releases/download/1.6.5/STITCH_1.6.5.tar.gz

which all worked fine (I think), but for this I get:

R CMD INSTALL STITCH_1.6.5.tar.gz ...... make[1]: Leaving directory /tmp/Rtmpk4rgvu/R.INSTALL7ac33fe861c2/STITCH/src/SeqLib/src' fatal: Not a git repository: ../../../../.git/modules/STITCH/src/SeqLib/modules/htslib make[1]: Entering directory/tmp/Rtmpk4rgvu/R.INSTALL7ac33fe861c2/STITCH/src/SeqLib/htslib' gcc -std=c99 -g -Wall -O2 -I. -I/usr/local/include -fPIC -c -o kfunc.o kfunc.c kfunc.c: In function ‘kf_erfc’: kfunc.c:74:16: error: ‘M_SQRT2’ undeclared (first use in this function) z = fabs(x) * M_SQRT2; ^ kfunc.c:74:16: note: each undeclared identifier is reported only once for each function it appears in make[1]: [kfunc.o] Error 1 make[1]: Leaving directory `/tmp/Rtmpk4rgvu/R.INSTALL7ac33fe861c2/STITCH/src/SeqLib/htslib' make: [SeqLib] Error 2 ERROR: compilation failed for package ‘STITCH’

rwdavies commented 3 years ago

Hey Richard!

I just tried a clean install on a linux box and it worked for me. This is what ran on my machine

gcc -m64 -g -Wall -O2 -I. -I/usr/local/include -fPIC  -c -o kfunc.o kfunc.c

I then tried to turn on -std=c99 and I ran into trouble

gcc -m64 -std=c99 -g -Wall -O2 -I. -I/usr/local/include -fPIC -std=c99  -c -o kfunc.o kfunc.c 

E> kfunc.c: In function ‘kf_erfc’:
E> kfunc.c:74:16: error: ‘M_SQRT2’ undeclared (first use in this function)
E> 74 | z = fabs(x) * M_SQRT2;
E> | ^~~
E> kfunc.c:74:16: note: each undeclared identifier is reported only once for each function it appears in
E> make[1]: [Makefile:134: kfunc.o] Error 1
E> make[1]:
Waiting for unfinished jobs....


So maybe check what your `~/.R/Makevars` file has in it? How old is your R and the gcc that was used to install it, could be time for a change? Or use R with newer gcc?
rmott commented 3 years ago

Thanks, Robbie

removing -std=c99 from .R/Makevars works!


Richard Mott UCL Genetics Institute Gower Street, London WC1E 6BT 020 3108 4005

On 9 Feb 2021, at 20:56, rwdavies notifications@github.com<mailto:notifications@github.com> wrote:

Hey Richard!

I just tried a clean install on a linux box and it worked for me. This is what ran on my machine

gcc -m64 -g -Wall -O2 -I. -I/usr/local/include -fPIC -c -o kfunc.o kfunc.c

I then tried to turn on -std=c99 and I ran into trouble

gcc -m64 -std=c99 -g -Wall -O2 -I. -I/usr/local/include -fPIC -std=c99 -c -o kfunc.o kfunc.c

E> kfunc.c: In function ‘kf_erfc’: E> kfunc.c:74:16: error: ‘M_SQRT2’ undeclared (first use in this function) E> 74 | z = fabs(x) * M_SQRT2; E> | ^~~ E> kfunc.c:74:16: note: each undeclared identifier is reported only once for each function it appears in E> make[1]: [Makefile:134: kfunc.o] Error 1 E> make[1]: Waiting for unfinished jobs....

So maybe check what your ~/.R/Makevars file has in it? How old is your R and the gcc that was used to install it, could be time for a change? Or use R with newer gcc?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rwdavies/STITCH/issues/45#issuecomment-776238684, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADK6MQJIEXXDJGMBVB4BYTS6GOOXANCNFSM4XLN4PVQ.

rmott commented 3 years ago

FYI, there was a warning:

g++ -std=gnu++11 -shared -L/usr/local/lib64 -o STITCH.so RcppExports.o bam_access.o bam_linker.o diploid.o functions.o haploid.o heuristics.o hwe.o obsolete.o reference-binary.o reference.o speed_test.o writers.o -L/share/apps/mottlab/R-3.6.1/lib64/R/lib -lRlapack -L/share/apps/mottlab/R-3.6.1/lib64/R/lib -lRblas -lgfortran -lm -lquadmath ./SeqLib//src/libseqlib.a ./SeqLib//htslib/libhts.a -fPIC -lz installing to /share/apps/mottlab/R-3.6.1/lib64/R/library/00LOCK-STITCH/00new/STITCH/libs R byte-compile and prepare package for lazy loading Note: possible error in 'rcpp_make_smoothed_rate(sigmaSum = NA, ': unused arguments (sigmaSum = NA, grid_distances = grid_distances, nGrids = nGrids) Note: possible error in 'attempt_to_better_grid(smoothed_rate_cM = smoothed_rate_cM, ': unused argument (desired_gridWindowSize = desired_gridWindowSize) Note: possible error in 'forwardBackwardDiploid(sampleReads = sampleReads, ': unused arguments (nReads = as.integer(length(sampleReads)), pi = priorCurrent, eHaps_t = eHapsCurrent_t[, TR[1]:TR[2]], alphaMat_t = alphaMatCurrent_t[, TR[1]:(TR[2] - 1)], transMatRate_t_D = transMatRate_t_D, gammaUpdate_t = array(0, c(1, 1, 1)), jUpdate_t = array(0, c(1, 1)))

Probably not important?

Richard Mott UCL Genetics Institute Gower Street, London WC1E 6BT 020 3108 4005

On 9 Feb 2021, at 20:56, rwdavies notifications@github.com<mailto:notifications@github.com> wrote:

Hey Richard!

I just tried a clean install on a linux box and it worked for me. This is what ran on my machine

gcc -m64 -g -Wall -O2 -I. -I/usr/local/include -fPIC -c -o kfunc.o kfunc.c

I then tried to turn on -std=c99 and I ran into trouble

gcc -m64 -std=c99 -g -Wall -O2 -I. -I/usr/local/include -fPIC -std=c99 -c -o kfunc.o kfunc.c

E> kfunc.c: In function ‘kf_erfc’: E> kfunc.c:74:16: error: ‘M_SQRT2’ undeclared (first use in this function) E> 74 | z = fabs(x) * M_SQRT2; E> | ^~~ E> kfunc.c:74:16: note: each undeclared identifier is reported only once for each function it appears in E> make[1]: [Makefile:134: kfunc.o] Error 1 E> make[1]: Waiting for unfinished jobs....

So maybe check what your ~/.R/Makevars file has in it? How old is your R and the gcc that was used to install it, could be time for a change? Or use R with newer gcc?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rwdavies/STITCH/issues/45#issuecomment-776238684, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADK6MQJIEXXDJGMBVB4BYTS6GOOXANCNFSM4XLN4PVQ.

rwdavies commented 3 years ago

Yeah, those warnings are fine, just need to clean up the code.