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

560 views
Skip to first unread message

Lars Nilse

unread,
Jul 12, 2019, 11:43:37 AM7/12/19
to 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

unread,
Jul 16, 2019, 7:52:32 AM7/16/19
to 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

unread,
Aug 11, 2019, 10:47:48 PM8/11/19
to 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/')

Reply all
Reply to author
Forward
0 new messages