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