尝试使用Accelerate Framework在Mac上构建LEVMAR数学库 [英] Trying to build the LEVMAR math library on a mac using the Accelerate Framework

查看:215
本文介绍了尝试使用Accelerate Framework在Mac上构建LEVMAR数学库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用附带的Makefile在mac上构建levmar-2.5数学库。它需要包含在Accelerate Framework中的LAPACK,
另一个数学库。我不知道如何修改

Makefile来指示库的位置,以便正确构建。在框架中有一个
libLAPACK.dylib。最终,我会想用这个库来建立另一个库。另外我不确定混合.so和.dylib动态库是否会出现问题。

谢谢。



该项目位于 levmar



以下是Makefile:

 
# Unix / Linux GCC Makefile for Levenberg - Marquardt最小化
#在Windows下,使用MSVC的Makefile.vc


CC = gcc
CONFIGFLAGS =# - ULINSOLVERS_RETAIN_MEMORY
#ARCHFLAGS = -march = pentium4#你可能想要为这个处理P4
CFLAGS = $(CONFIGFLAGS)$(ARCHFLAGS)-O3 -funroll-loops -Wall#-ffast-math#-pg
LAPACKLIBS_PATH = / usr / local / lib#当使用LAPACK时,将此更改为您编译的位置!
LDFLAGS = -L $(LAPACKLIBS_PATH)-L。
LIBOBJS = lm.o Axb.o misc.o lmlec.o lmbc.o lmblec.o lmbleic.o
LIBSRCS = lm.c Axb.c misc.c lmlec.c lmbc.c lmblec。 c lmbleic.c
DEMOBJS = lmdemo.o
DEMOSRCS = lmdemo.c
AR = ar
RANLIB = ranlib
LAPACKLIBS = -llapack -lblas -lf2c#comment这条线,如果你不使用LAPACK。
#在带有FORTRAN(非f2c'ed)版本LAPACK的系统上,-lf2c不需要;
#在其他人上,-lf2c相当于-lF77 -lI77

#LAPACKLIBS = -L / usr / local / atlas / lib -llapack -lcblas -lf77blas -latlas -lf2c#这可与ATLAS更新lapack和Linux_P4SSE2
#来自http://www.netlib.org/atlas/archives/linux/

#LAPACKLIBS = -llapack -lgoto2 -lpthread -lf2c#这适用于GotoBLAS
#from http://www.tacc.utexas.edu/research-development / tacc-projects /

#LAPACKLIBS = -L / opt / intel / mkl / 8.0.1 / lib / 32 / -lmkl_lapack -lmkl_ia32 -lguide -lf2c#这适用于MKL 8.0.1
#http://www.intel.com/cd/software/products/asmo-na/eng/perflib/mkl /index.htm

LIBS = $(LAPACKLIBS)

全部:liblevmar.a lmdemo

liblevmar.a:$(LIBOBJS)
$(AR)crv liblevmar.a $(LIBOBJS)
$(RANLIB)liblevmar.a

lmdemo:$(DEMOBJS)liblevmar.a
$(CC) $(LDFLAGS)$(DEMOBJS)-o lmdemo -llevmar $(LIBS)-lm

lm.o:lm.c lm_core.c levmar.h misc.h compiler.h
Axb.o:Axb.c Axb_core.c levmar.h misc.h
misc.o:misc.c misc_core.c levmar.h misc.h
lmlec.o:lmlec.c lmlec_core.c levmar.h misc.h
lmbc.o:lmbc.c lmbc_core.c levmar.h misc.h compiler.h
lmblec.o:lmblec.c lmblec_core.c levmar.h misc.h
lmbleic.o:lmbleic.c lmbleic_core.c levmar.h misc.h

lmdemo.o:levmar.h

clean:
@rm -f $(LIBOBJS)$(DEMOBJS)

cleanall: clean
@rm -f lmdemo
@rm -f liblevmar.a

depends:
makedepend -f Makefile $(LIBSRCS)$(DEMOSRCS)

#不要删除此行 - 取决于它。


解决方案

您需要传递 - 框架将加速到gcc。您还需要 #include< Accelerate / Accelerate.h> 。详情请参阅此处

I want build levmar-2.5 math library on a mac using the included Makefile. It requires LAPACK,
another math library which is included in the Accelerate Framework. I do not know how to modify
the Makefile to indicate the location of the library so that it builds correctly. There is a
libLAPACK.dylib in the framework. Ultimately, I will want to use this library to build another library. Also I am not sure if there will be a problem mixing .so and .dylib dynamic libraries.
Thank you.

The project is located at levmar.

Here is the Makefile:

#
# Unix/Linux GCC Makefile for Levenberg - Marquardt minimization
# Under windows, use Makefile.vc for MSVC
#

CC=gcc
CONFIGFLAGS=#-ULINSOLVERS_RETAIN_MEMORY
#ARCHFLAGS=-march=pentium4 # YOU MIGHT WANT TO UNCOMMENT THIS FOR P4
CFLAGS=$(CONFIGFLAGS) $(ARCHFLAGS) -O3 -funroll-loops -Wall #-ffast-math #-pg
LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
LDFLAGS=-L$(LAPACKLIBS_PATH) -L.
LIBOBJS=lm.o Axb.o misc.o lmlec.o lmbc.o lmblec.o lmbleic.o
LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
DEMOBJS=lmdemo.o
DEMOSRCS=lmdemo.c
AR=ar
RANLIB=ranlib
LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK.
                             # On systems with a FORTRAN (not f2c'ed) version of LAPACK, -lf2c is
                             # not necessary; on others, -lf2c is equivalent to -lF77 -lI77

#LAPACKLIBS=-L/usr/local/atlas/lib -llapack -lcblas -lf77blas -latlas -lf2c # This works with   the ATLAS updated lapack and Linux_P4SSE2
                                    # from   http://www.netlib.org/atlas/archives/linux/

#LAPACKLIBS=-llapack -lgoto2 -lpthread -lf2c # This works with GotoBLAS
                                         # from http://www.tacc.utexas.edu/research-development /tacc-projects/

#LAPACKLIBS=-L/opt/intel/mkl/8.0.1/lib/32/ -lmkl_lapack -lmkl_ia32 -lguide -lf2c # This works with MKL 8.0.1 from
                   # http://www.intel.com/cd/software/products/asmo-na/eng/perflib/mkl/index.htm

LIBS=$(LAPACKLIBS)

all: liblevmar.a lmdemo

liblevmar.a: $(LIBOBJS)
    $(AR) crv liblevmar.a $(LIBOBJS)
    $(RANLIB) liblevmar.a

lmdemo: $(DEMOBJS) liblevmar.a
    $(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm

lm.o: lm.c lm_core.c levmar.h misc.h compiler.h
Axb.o: Axb.c Axb_core.c levmar.h misc.h
misc.o: misc.c misc_core.c levmar.h misc.h
lmlec.o: lmlec.c lmlec_core.c levmar.h misc.h
lmbc.o: lmbc.c lmbc_core.c levmar.h misc.h compiler.h
lmblec.o: lmblec.c lmblec_core.c levmar.h misc.h
lmbleic.o: lmbleic.c lmbleic_core.c levmar.h misc.h

lmdemo.o: levmar.h

clean:
    @rm -f $(LIBOBJS) $(DEMOBJS)

cleanall: clean
    @rm -f lmdemo
    @rm -f liblevmar.a

depend:
    makedepend -f Makefile $(LIBSRCS) $(DEMOSRCS)

# DO NOT DELETE THIS LINE -- make depend depends on it.

解决方案

You need to pass -framework Accelerate to gcc. You also need to#include <Accelerate/Accelerate.h>. Details are here.

这篇关于尝试使用Accelerate Framework在Mac上构建LEVMAR数学库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆