ld: unknown option: -melf_x86_64 while compiling shared ATLAS libraries on MacOS
문제
I'm trying to install the ATLAS BLAS libraries using this guide. I have the static libraries working, but it's important that I have position independent libraries as well. I get to the point in the guide where I'm supposed to issue make shared
to get the shared libraries and I get the following error:
$ make shared
rm -f libatlas.so liblapack.so
make libatlas.so liblapack.so libf77blas.so libcblas.so liblapack.so
ld -melf_x86_64 -shared -soname libatlas.so -o libatlas.so \
--whole-archive libatlas.a --no-whole-archive -lc -lpthread -lm
ld: unknown option: -melf_x86_64
make[1]: *** [libatlas.so] Error 1
make: *** [shared] Error 2
I've gone through the errata for ATLAS, but this issue doesn't seem to be addressed. I'd appreciate advice on what direction to head.
--Andrew
해결책
ld -melf_x86_64 -shared -soname libatlas.so -o libatlas.so --whole-archive libatlas.a --no-whole-archive -lc -lpthread -lm
This Makefile is
- Bogus: one should almost never link anything directly with
ld
- Written with assumption that it is using GNU-ld on ELF
x86_64
platform (incorrect in your case).
You need to adjust these instructions for your platform. Use appropriate commands to build a MacOS shared library (I don't know what they are, but I am sure you can use a search engine and/or man ld
to find out).