是否可以在Mac(64位)上编译svdlibc?
我正在尝试在 64 位 Mac 上编译 svdlibc 。运行 make 文件会返回错误消息:
main.c:1: error: CPU you selected does not support x86-64 instruction set
main.c:1: error: CPU you selected does not support x86-64 instruction set
make: *** [main.o] Error 1
这没有多大意义。
make 文件是:
# Linux or Windows:
CC = gcc -Wall -O4 -march=i486
# CC = icc -w1 -O3 -march=i486
# Macintosh:
ifeq ($(HOSTTYPE),powerpc)
CC = cc -pipe -O3 -Wall -fno-common -arch ppc
endif
LIBS=-lm
OBJ=svdlib.o svdutil.o las2.o
svd: Makefile main.o libsvd.a
${CC} ${CFLAGS} -o svd main.o libsvd.a ${LIBS}
mv -f $@ ${HOSTTYPE}/$@
ln -s ${HOSTTYPE}/$@ $@
main.o: Makefile main.c svdlib.h
${CC} ${CFLAGS} -c main.c
libsvd.a: ${HOSTTYPE} ${OBJ}
rm -f $@ ${HOSTTYPE}/$@
ar cr $@ ${OBJ}
ranlib $@
mv -f $@ ${HOSTTYPE}/$@
ln -s ${HOSTTYPE}/$@ $@
svdlib.o: Makefile svdlib.h svdlib.c
${CC} ${CFLAGS} -c svdlib.c
svdutil.o: Makefile svdutil.c svdutil.h
${CC} ${CFLAGS} -c svdutil.c
las2.o: Makefile las2.c svdlib.h svdutil.h
${CC} ${CFLAGS} -c las2.c
clean:
rm *.o
$(HOSTTYPE):
if test ! -d $(HOSTTYPE); \
then mkdir $(HOSTTYPE); fi
编辑 make 文件以更改 -march 标志可以让编译继续进行,但显然链接失败:
ld: lto: could not merge in main.o because Invalid ALLOCA record for
architecture x86_64
有人这样做了吗?或者我应该使用不同的 svd 库? (对于大型稀疏矩阵?)
编辑:porneL 似乎已经发现了问题。将 makefile 中的第一行更改为:
CC = gcc -Wall -O3 -march=x86-64
编译工作。尚未测试结果,但看起来很有希望。
I'm trying to compile svdlibc on a 64 bit mac. Running the make file returns the error message:
main.c:1: error: CPU you selected does not support x86-64 instruction set
main.c:1: error: CPU you selected does not support x86-64 instruction set
make: *** [main.o] Error 1
Which doesn't make much sense.
The make file is:
# Linux or Windows:
CC = gcc -Wall -O4 -march=i486
# CC = icc -w1 -O3 -march=i486
# Macintosh:
ifeq ($(HOSTTYPE),powerpc)
CC = cc -pipe -O3 -Wall -fno-common -arch ppc
endif
LIBS=-lm
OBJ=svdlib.o svdutil.o las2.o
svd: Makefile main.o libsvd.a
${CC} ${CFLAGS} -o svd main.o libsvd.a ${LIBS}
mv -f $@ ${HOSTTYPE}/$@
ln -s ${HOSTTYPE}/$@ $@
main.o: Makefile main.c svdlib.h
${CC} ${CFLAGS} -c main.c
libsvd.a: ${HOSTTYPE} ${OBJ}
rm -f $@ ${HOSTTYPE}/$@
ar cr $@ ${OBJ}
ranlib $@
mv -f $@ ${HOSTTYPE}/$@
ln -s ${HOSTTYPE}/$@ $@
svdlib.o: Makefile svdlib.h svdlib.c
${CC} ${CFLAGS} -c svdlib.c
svdutil.o: Makefile svdutil.c svdutil.h
${CC} ${CFLAGS} -c svdutil.c
las2.o: Makefile las2.c svdlib.h svdutil.h
${CC} ${CFLAGS} -c las2.c
clean:
rm *.o
$(HOSTTYPE):
if test ! -d $(HOSTTYPE); \
then mkdir $(HOSTTYPE); fi
Editing the make file to alter the -march flag lets the compilation proceed but apparently the linking fails with:
ld: lto: could not merge in main.o because Invalid ALLOCA record for
architecture x86_64
Has anyone done this? Or is there a different svd library that I should use instead? (For large sparse matrices?)
EDIT: porneL seems to have found the problem. Changing the top line in the makefile to:
CC = gcc -Wall -O3 -march=x86-64
compilation work. Haven't tested the results yet, but looks very promising.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-O4
由于某种原因导致此问题。请改用-O3
。-O4
causes this for some reason. Use-O3
instead.您可以尝试使用端口( http://www.macports.org/ ),它似乎可用:
svdlibc @1.34(数学、科学)
SVDLIBC 是一个执行奇异值分解的 C 库,
基本上你会安装 macports,然后 sudo port install svdlibc。
You could try with port ( http://www.macports.org/ ) it seems it s availablee :
svdlibc @1.34 (math, science)
SVDLIBC is a C library to perform singular value decomposition
Basically you ll install macports then , sudo port install svdlibc.