dpryan79 / MethylDackel

A (mostly) universal methylation extractor for BS-seq experiments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error - linker error

mpBioinf opened this issue · comments

Hi, I am currently trying to install MethylDackel on a Fedora machine. Make fails with the following error message:
collect2: error: ld returned 1 exit status

As the htslib files were not found automatically, I explicitly stated them. The full command is
make CFLAGS="-O3 -Wall -I/path/to/htslib/include" LIBS="-L/path/to/htslib/lib" prefix=/apps/methyldackel/0.5.1/ LIBBIGWIG="/path/to/libBigWig.a"

Using the LDFLAG -t, I got a slightly more informative error message:
/usr/bin/ld: link errors found, deleting executable 'MethylDackel'

Below is the complete output. I hope you can help me complete the installation.

echo '#define VERSION "0.5.1"' > version.h
ar -rcs libMethylDackel.a common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o
cc -O3 -Wall -I/apps/htslib/1.10.2/include -L/apps/htslib/1.10.2/lib -o MethylDackel common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o main.c libMethylDackel.a /apps/methyldackel/lib/libBigWig.a -lm -lz -lpthread -lhts -lcurl -t
/usr/bin/ld: mode elf_x86_64
/lib/../lib64/crt1.o
/lib/../lib64/crti.o
/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/crtbegin.o
common.o
bed.o
svg.o
pileup.o
extract.o
MBias.o
mergeContext.o
perRead.o
/tmp/ccEkzQw9.o
(/apps/methyldackel/lib/libBigWig.a)bwValues.o
(/apps/methyldackel/lib/libBigWig.a)bwRead.o
(/apps/methyldackel/lib/libBigWig.a)bwWrite.o
(/apps/methyldackel/lib/libBigWig.a)io.o
-lm (/lib/../lib64/libm.so)
-lz (/lib/../lib64/libz.so)
/lib64/libpthread.so.0
-lhts (/apps/htslib/1.10.2/lib/libhts.so)
-lcurl (/lib/../lib64/libcurl.so)
libgcc_s.so.1 (/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../lib64/libgcc_s.so.1)
/lib64/libc.so.6
(/usr/lib64/libc_nonshared.a)elf-init.oS
/lib64/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2
libgcc_s.so.1 (/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../lib64/libgcc_s.so.1)
/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/crtend.o
/lib/../lib64/crtn.o
[predl@canis MethylDackel-0.5.1]$ less report.txt
[predl@canis MethylDackel-0.5.1]$ make CFLAGS="-O3 -Wall -I/apps/htslib/1.10.2/include" LIBS="-L/apps/htslib/1.10.2/lib" prefix=/apps/methyldackel/0.5.1/ LIBBIGWIG="/apps/methyldackel/lib/libBigWig.a" &> report.txt
[predl@canis MethylDackel-0.5.1]$ less report.txt
extract.o:(.bss+0x60): multiple definition of `bwMutex'
common.o:(.bss+0x60): first defined here
MBias.o
MBias.o:(.bss+0xa0): multiple definition of `positionMutex'
common.o:(.bss+0xa0): first defined here
MBias.o:(.bss+0x14): multiple definition of `globalPos'
common.o:(.bss+0x14): first defined here
MBias.o:(.bss+0x18): multiple definition of `globalTid'
common.o:(.bss+0x18): first defined here
MBias.o:(.bss+0x10): multiple definition of `globalEnd'
common.o:(.bss+0x10): first defined here
MBias.o:(.bss+0x0): multiple definition of `globalnVariantPositions'
common.o:(.bss+0x0): first defined here
MBias.o:(.bss+0x8): multiple definition of `outputBin'
common.o:(.bss+0x8): first defined here
MBias.o:(.bss+0xc): multiple definition of `bin'
common.o:(.bss+0xc): first defined here
MBias.o:(.bss+0x20): multiple definition of `outputMutex'
common.o:(.bss+0x20): first defined here
MBias.o:(.bss+0x60): multiple definition of `bwMutex'
common.o:(.bss+0x60): first defined here
mergeContext.o
perRead.o
perRead.o:(.bss+0xa0): multiple definition of `positionMutex'
common.o:(.bss+0xa0): first defined here
perRead.o:(.bss+0xc): multiple definition of `bin'
common.o:(.bss+0xc): first defined here
perRead.o:(.bss+0x14): multiple definition of `globalPos'
common.o:(.bss+0x14): first defined here
perRead.o:(.bss+0x18): multiple definition of `globalTid'
common.o:(.bss+0x18): first defined here
perRead.o:(.bss+0x10): multiple definition of `globalEnd'
common.o:(.bss+0x10): first defined here
perRead.o:(.bss+0x20): multiple definition of `outputMutex'
common.o:(.bss+0x20): first defined here
perRead.o:(.bss+0x8): multiple definition of `outputBin'
common.o:(.bss+0x8): first defined here
perRead.o:(.bss+0x0): multiple definition of `globalnVariantPositions'
common.o:(.bss+0x0): first defined here
perRead.o:(.bss+0x60): multiple definition of `bwMutex'
common.o:(.bss+0x60): first defined here
/tmp/ccNTqiLS.o
(/apps/methyldackel/lib/libBigWig.a)bwValues.o
(/apps/methyldackel/lib/libBigWig.a)bwRead.o
(/apps/methyldackel/lib/libBigWig.a)bwWrite.o
(/apps/methyldackel/lib/libBigWig.a)io.o
-lm (/lib/../lib64/libm.so)
-lz (/lib/../lib64/libz.so)
/lib64/libpthread.so.0
-lhts (/apps/htslib/1.10.2/lib/libhts.so)
-lcurl (/lib/../lib64/libcurl.so)
libgcc_s.so.1 (/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../lib64/libgcc_s.so.1)
/lib64/libc.so.6
(/usr/lib64/libc_nonshared.a)elf-init.oS
/lib64/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2
libgcc_s.so.1 (/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../lib64/libgcc_s.so.1)
/apps/gcc/10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/crtend.o
/lib/../lib64/crtn.o
/usr/bin/ld: link errors found, deleting executable `MethylDackel'
collect2: error: ld returned 1 exit status
make: *** [MethylDackel] Error 1```

I suggest installing with conda if you can (this goes for most bioinfo software).

May or may not be related but I had to set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/htslib in order to run MethyDackel.

Yes, if you link to a library outside of the normal search path then you'll have to modify LD_LIBRARY_PATH. This is one of the advantages of using conda for installation (it sets the flags to use an import path relative to where the binary is installed, which is quite convenient).