为Atlas制作动态库(os-x,macports)

时间:2013-03-13 15:32:24

标签: c macos dll gnu gfortran

所以我试图用macports中的gnu4.7在osx 10.8.2上编译Atlas(BLAS + LAPACK)。 对于记录,这是我使用的配置:

../path/to/configure --prefix=/opt/atlas \
--with-netlib-lapack-tarfile=/path/to/lapack-3.4.2.tgz \
--shared \
-b 64 \
-C acg gcc-mp-4.7 \
-C if gfortran-mp-4.7

直到最后甚至创建静态库,但无法构建动态库:

libtool -dynamic -o ../libsatlas.dylib \
    -install_name /opt/atlas/lib/libsatlas.dylib -version-info 3.10.0 \
    -compatibility_version 3.10.0 *.o -lpthread -lm -L/opt/local/lib/gcc47/gcc/x86_64-    apple-darwin12/4.7.2/../../.. -lgfortran 
libtool: unrecognized option `-dynamic'

显然与lib / Makefile有关:

....
dylib:
rm -rf $(tmpd) ; mkdir $(tmpd)
cd $(tmpd) ; ar x ../liblapack.a 
cd $(tmpd) ; ar x ../libf77blas.a
cd $(tmpd) ; ar x ../libcblas.a 
cd $(tmpd) ; ar x ../libatlas.a
cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libsatlas.dylib \
    -install_name $(LIBINSTdir)/libsatlas.dylib -version-info $(VER) \
    -compatibility_version $(VER) *.o $(LIBS) $(F77SYSLIB)
rm -rf $(tmpd)
....

然而,我无法使其发挥作用。我试图添加'--mode = link',但它仍然失败。

如果有人可以提议修改Atlas makefile,我将非常感激。

p / s / libtool版本是:'libtool(GNU libtool)2.4.2'

1 个答案:

答案 0 :(得分:0)

问题解决了。

使用

/usr/bin/libtool

代替gnu libtool,以及稍微修改一下make文件:

cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libsatlas.dylib \
    -install_name $(LIBINSTdir)/libsatlas.dylib -current_version $(VER) \
    -compatibility_version $(VER) *.o $(LIBS) $(F77SYSLIB)

这样就产生了动态库。