Is it possible to compile svdlibc on a mac (64 bit)?
Asked Answered
E

2

7

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.

Efthim answered 7/10, 2011 at 3:5 Comment(0)
D
6

-O4 causes this for some reason. Use -O3 instead.

Dori answered 7/12, 2011 at 20:30 Comment(0)
M
0

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.

Misdoing answered 29/11, 2011 at 16:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.