dyld:未加载库:@rpath/libopenblas.dylib
dyld: Library not loaded: @rpath/libopenblas.dylib
当我制作我的文件时,我有这个错误:
dyld: Library not loaded: @rpath/libopenblas.dylib Referenced
from: /Users/danyunhe2/reinf_learning2/cpp_original/./navig_test
Reason: image not found Abort trap: 6
我试过 ln -sf <original path> /usr/local/lib
但没用。
从 brew info openblas 我得到:
openblas: stable 0.3.5 (bottled), HEAD [keg-only]
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.5 (22 files, 120.7MB)
Poured from bottle on 2019-02-18 at 01:27:14
From: https://github.com/Homebrew/homebrew- core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.
For compilers to find openblas you may need to set:
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
它告诉我用 LDFLAGS 和 CPPFLAGS 设置编译器。我试过了,但没用。任何人都知道如何处理这个?
我的 config.mk 是:
# C++ compiler
cxx=g++-7 -fopenmp
# Compilation flags
cflags=-Wall -ansi -pedantic -O3
# BLAS/LAPACK flags for linear algebra
lp_lflags=-framework Accelerate
# FFTW flags (installed via Homebrew)
fftw_iflags=
fftw_lflags=-lfftw3
# libpng flags (installed via Homebrew)
png_iflags=
png_lflags=-lpng
和生成文件:
# Load the common configuration file
include config.mk
iflags=`gsl-config --cflags`
lflags=`gsl-config --libs`
objs=navigate.o reinf_learn.o common.o
src=$(patsubst %.o,%.cc,$(objs))
execs=navig_test
all:
$(MAKE) executables
executables: $(execs)
depend: $(src)
$(cxx) $(iflags) -MM $(src) >Makefile.dep
-include Makefile.dep
navig_test: navig_test.cc $(objs)
$(cxx) $(cflags) $(iflags) -o $@ $^ $(lflags)
%.o: %.cc
$(cxx) $(cflags) $(iflags) -c $<
clean:
rm -f $(execs) $(objs)
.PHONY: clean all executables depend
在 OSX 上是 DYLD_LIBRARY_PATH
,您需要在 运行 时指定,如下所示:
export DYLD_LIBRARY_PATH=/usr/local/opt/openblas/lib
但是,请理解 brew 关于 Accelerate 框架的警告。在各种级别上使用许多 BLAS 操作要快得多。您只会让程序 运行 变慢。
当我制作我的文件时,我有这个错误:
dyld: Library not loaded: @rpath/libopenblas.dylib Referenced from: /Users/danyunhe2/reinf_learning2/cpp_original/./navig_test
Reason: image not found Abort trap: 6
我试过 ln -sf <original path> /usr/local/lib
但没用。
从 brew info openblas 我得到:
openblas: stable 0.3.5 (bottled), HEAD [keg-only]
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.5 (22 files, 120.7MB)
Poured from bottle on 2019-02-18 at 01:27:14
From: https://github.com/Homebrew/homebrew- core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.
For compilers to find openblas you may need to set:
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
它告诉我用 LDFLAGS 和 CPPFLAGS 设置编译器。我试过了,但没用。任何人都知道如何处理这个?
我的 config.mk 是:
# C++ compiler
cxx=g++-7 -fopenmp
# Compilation flags
cflags=-Wall -ansi -pedantic -O3
# BLAS/LAPACK flags for linear algebra
lp_lflags=-framework Accelerate
# FFTW flags (installed via Homebrew)
fftw_iflags=
fftw_lflags=-lfftw3
# libpng flags (installed via Homebrew)
png_iflags=
png_lflags=-lpng
和生成文件:
# Load the common configuration file
include config.mk
iflags=`gsl-config --cflags`
lflags=`gsl-config --libs`
objs=navigate.o reinf_learn.o common.o
src=$(patsubst %.o,%.cc,$(objs))
execs=navig_test
all:
$(MAKE) executables
executables: $(execs)
depend: $(src)
$(cxx) $(iflags) -MM $(src) >Makefile.dep
-include Makefile.dep
navig_test: navig_test.cc $(objs)
$(cxx) $(cflags) $(iflags) -o $@ $^ $(lflags)
%.o: %.cc
$(cxx) $(cflags) $(iflags) -c $<
clean:
rm -f $(execs) $(objs)
.PHONY: clean all executables depend
在 OSX 上是 DYLD_LIBRARY_PATH
,您需要在 运行 时指定,如下所示:
export DYLD_LIBRARY_PATH=/usr/local/opt/openblas/lib
但是,请理解 brew 关于 Accelerate 框架的警告。在各种级别上使用许多 BLAS 操作要快得多。您只会让程序 运行 变慢。