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

error: linker command failed with exit code 1 (use -v to see invocation) #5

Open
Coaxecva opened this issue Nov 17, 2020 · 6 comments

Comments

@Coaxecva
Copy link

make htslib
make all

I got these error while compiling the code:

ld: unknown option: -rpath=extern/htslib/lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [FEM] Error 1
@haowenz
Copy link
Owner

haowenz commented Nov 17, 2020

Can you try to compile it with GCC? I didn't test it with clang. You can just cd into the FEM directory and use "make". Let me know if you still have this issue.

@Coaxecva
Copy link
Author

make

// I use MacOS
// I think clang is for gcc and g++ in MacOS?

git submodule update --init --recursive
cd extern/htslib;\
	autoheader;\
	autoconf;\
	./configure CC=gcc --disable-bz2 --disable-lzma;\
	make;\
	make prefix=. install
/bin/sh: autoheader: command not found
/bin/sh: autoconf: command not found
/bin/sh: ./configure: No such file or directory
make[1]: Nothing to be done for `all'.
mkdir -p -m 755 ./bin ./include ./include/htslib ./lib ./share/man/man1 ./share/man/man5 ./share/man/man7 ./lib/pkgconfig
if test -n ""; then mkdir -p -m 755 ; fi
install -p libhts.dylib ./lib/libhts.1.10.2-57-gf58a6f3.dylib
ln -sf libhts.1.10.2-57-gf58a6f3.dylib ./lib/libhts.dylib
ln -sf libhts.1.10.2-57-gf58a6f3.dylib ./lib/libhts.3.dylib
sed -e 's#@-includedir@#./include#g;s#@-libdir@#./lib#g;s#@-PACKAGE_VERSION@#1.10.2-57-gf58a6f3#g' htslib.pc.tmp > ./lib/pkgconfig/htslib.pc
chmod 644 ./lib/pkgconfig/htslib.pc
install -p bgzip htsfile tabix ./bin
if test -n ""; then install -p  ; fi
install -p -m 644 htslib/*.h ./include/htslib
install -p -m 644 libhts.a ./lib/libhts.a
install -p -m 644 bgzip.1 htsfile.1 tabix.1 ./share/man/man1
install -p -m 644 faidx.5 sam.5 vcf.5 ./share/man/man5
install -p -m 644 htslib-s3-plugin.7 ./share/man/man7
mkdir -p objs
gcc -g -Wall -O3 -march=native -Iextern/htslib/include objs/sequence_batch.o objs/index.o objs/filter.o objs/align.o objs/input_queue.o objs/output_queue.o objs/map.o objs/FEM_map.o objs/FEM_index.o objs/FEM.o -o FEM -Lextern/htslib/lib -Wl,-rpath=extern/htslib/lib -lhts -lpthread -lm -lz
ld: unknown option: -rpath=extern/htslib/lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [FEM] Error 1

@haowenz
Copy link
Owner

haowenz commented Nov 18, 2020

You can install GCC with Homebrew on MacOS. Then you can modify your makefile to use gcc (not clang) as your compiler. Then it should work. I think there is some linking issue with clang, which I will investigate later when I get some time.

@haowenz
Copy link
Owner

haowenz commented Nov 27, 2020

I made some changes to the Makefile. Now you should be able to compile it with clang on your Mac. Just pull the latest code, get into the directory, run make clean and then make. Let me know if you still have problems with it.

@Coaxecva
Copy link
Author

Thanks; however, I still have a problem with htslib:

git submodule update --init --recursive
cd extern/htslib;
mkdir build;
autoheader;
autoconf;
./configure CC="gcc" --disable-bz2 --disable-lzma --prefix="/Users/qtran1/Documents/Research/UBTF_gene/FEM/extern/htslib/build";
make -j;
make install
mkdir: build: File exists
/bin/sh: autoheader: command not found
/bin/sh: autoconf: command not found
/bin/sh: ./configure: No such file or directory
make[1]: Nothing to be done for `all'.
mkdir -p -m 755 /usr/local/bin /usr/local/include /usr/local/include/htslib /usr/local/lib /usr/local/share/man/man1 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/lib/pkgconfig
if test -n ""; then mkdir -p -m 755 ; fi
install -p libhts.dylib /usr/local/lib/libhts.1.10.2-57-gf58a6f3.dylib
ln -sf libhts.1.10.2-57-gf58a6f3.dylib /usr/local/lib/libhts.dylib
ln -sf libhts.1.10.2-57-gf58a6f3.dylib /usr/local/lib/libhts.3.dylib
sed -e 's#@-includedir@#/usr/local/include#g;s#@-libdir@#/usr/local/lib#g;s#@-PACKAGE_VERSION@#1.10.2-57-gf58a6f3#g' htslib.pc.tmp > /usr/local/lib/pkgconfig/htslib.pc
chmod 644 /usr/local/lib/pkgconfig/htslib.pc
install -p bgzip htsfile tabix /usr/local/bin
if test -n ""; then install -p ; fi
install -p -m 644 htslib/*.h /usr/local/include/htslib
install -p -m 644 libhts.a /usr/local/lib/libhts.a
install -p -m 644 bgzip.1 htsfile.1 tabix.1 /usr/local/share/man/man1
install -p -m 644 faidx.5 sam.5 vcf.5 /usr/local/share/man/man5
install -p -m 644 htslib-s3-plugin.7 /usr/local/share/man/man7
htslib headers not found
make: *** [check_htslib] Error 1

@haowenz
Copy link
Owner

haowenz commented Nov 30, 2020

It works on my Mac. You can try to delete the whole directory, clone it again and then make. If there are still problems, then please use homebrew to install gcc and use it as compiler.

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

No branches or pull requests

2 participants