Caffe installation under macOS 10.14.5 (vecLib for x86-64 problem)

์กฐํšŒ์ˆ˜ 503ํšŒ
์ฝ์ง€ ์•Š์€ ์ฒซ ๋ฉ”์‹œ์ง€๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

Lars Nilse

์ฝ์ง€ ์•Š์Œ,
2019. 7. 12. ์˜ค์ „ 7:43:3719. 7. 12.
๋ฐ›๋Š”์‚ฌ๋žŒ Caffe Users
The vecLib library cannot be linked.
```

lars$ make all

LD -o .build_release/lib/libcaffe.so.1.0.0

ld: cannot link directly with /System/Library/Frameworks//vecLib.framework/vecLib for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

```

This appears to be a common problem [1,2]. Despite providing the explicit paths to the Accelerate and non-Accelerate version of vecLib in cmake [3], I cannot get past this linker error. System re-installation as in [1] is no option.


Any advice?


[1]ย https://github.com/BVLC/caffe/issues/6781


[2]ย https://medium.com/@buffaloal/build-caffe-with-anaconda-on-macos-1070a8d0a9fe


[3]ย https://github.com/BVLC/caffe/blob/master/cmake/Modules/FindvecLib.cmake#L18

Lars Nilse

์ฝ์ง€ ์•Š์Œ,
2019. 7. 16. ์˜ค์ „ 3:52:3219. 7. 16.
๋ฐ›๋Š”์‚ฌ๋žŒ Caffe Users


Below my complete FindvecLib.cmake with the absolute path to vecLib.


--------------------------------------------------

# Find the vecLib libraries as part of Accelerate.framework or as standalon framework

#

# The following are set after configuration is done:

#ย  VECLIB_FOUND

#ย  vecLib_INCLUDE_DIR

#ย  vecLib_LINKER_LIBS



if(NOT APPLE)

ย  return()

endif()


set(__veclib_include_suffix "Frameworks/vecLib.framework/Versions/Current/Headers")


exec_program(xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)

find_path(vecLib_INCLUDE_DIR vecLib.h

ย  ย  ย  ย  ย  DOC "vecLib include directory"

PATHS


#/System/Library/Frameworks/Accelerate.framework/Versions/Current/${__veclib_include_suffix}

ย  ย  ย  ย  ย  ย  ย  ย  /System/Library/${__veclib_include_suffix}


# ${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/

ย  ย  ย  ย  ย  ย  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers

ย  ย  ย  ย  ย  NO_DEFAULT_PATH)


include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(vecLib DEFAULT_MSG vecLib_INCLUDE_DIR)


if(VECLIB_FOUND)

#ย  if(vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")

#ย  ย  set(vecLib_LINKER_LIBS -lcblas "-framework vecLib")

#ย  ย  message(STATUS "Found standalone vecLib.framework")

#ย  else()

ย  ย  set(vecLib_LINKER_LIBS -lcblas "-framework Accelerate")

ย  ย  message(STATUS "Found vecLib as part of Accelerate.framework")

#ย  endif()


ย  mark_as_advanced(vecLib_INCLUDE_DIR)

endif()


Steve Lu

์ฝ์ง€ ์•Š์Œ,
2019. 8. 11. ์˜คํ›„ 6:47:4819. 8. 11.
๋ฐ›๋Š”์‚ฌ๋žŒ Caffe Users
I had the same problem on my mid-2015 MacBook Pro running macOS Mojave (10.14.5). My Makefile.config hadย 

BLAS := atlas

and my Makefile (pulled from git in the last 10 days), had 'LDFLAGS += -framework vecLib on line 413. I changed that to:

LDFLAGS += -framework Accelerate

In examining line 400, it looks to me (fwiw, I'm a newb here) like the capture group in the sed command for the assignment of XCODE_CLT_VER is being throw off by the fact the version is 10.3.blah.blah.blah.

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep 'version' | sed 's/[^0-9]*\([0-9]\).*/\1/'

1

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep 'version' | sed 's/[^0-9]*\([^\.]*\).*/\1/'

10

$ย 


It might be corrected by changing the assignment to

ย XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep 'version' | sed 's/[^0-9]*\([^\.]*\).*/\1/')

์ „์ฒด๋‹ต์žฅ
์ž‘์„ฑ์ž์—๊ฒŒ ๋‹ต๊ธ€
์ „๋‹ฌ
์ƒˆ ๋ฉ”์‹œ์ง€ 0๊ฐœ