clMathLibraries / clBLAS

a software library containing BLAS functions written in OpenCL
Apache License 2.0
843 stars 237 forks source link

build fails on Mac OSX 10.10.3, clang 6.1.0.6020049 #92

Closed lzamparo closed 9 years ago

lzamparo commented 9 years ago

Can't get a freshly cloned instance to build. The cmake, makefile outputs are here

The problem is unresolved symbols:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [staging/test-correctness] Error 1
make[1]: *** [tests/CMakeFiles/test-correctness.dir/all] Error 2
make: *** [all] Error 2

Am I not invoking cmake properly for OSX? This same error occurs whether I try cmake with -G "Unix makefiles" or not.

TimmyLiu commented 9 years ago

Hi,

I do not have an apple system. But it looks like it was complaining "Undefined symbols for architecture x86_64: "caxpy", " and other blas routines that should be supplied by reference CPU blas library such as ACML. I think the easiest way is to uncheck "BUILD_TEST" from cmake and try again.

thanks, Timmy

kknox commented 9 years ago

On MacOSX systems, you have to have a pre-built version of Accelerate installed to use as reference code. https://github.com/clMathLibraries/clBLAS/blob/master/src/CMakeLists.txt#L125

lzamparo commented 9 years ago

Yeah, cmake fails to find Accelerate on my system. It also claims not to find boost, though this might just be a bug in the FindBoost cmake routine.

@kknox , I'm new to OSX. Based on this find snippet, it looks as if I do have Accelerate installed

mski1743:/ zamparol$ sudo find . -name Accelerate.h | grep Accelerate.h
Password:
./Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h
./Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Headers/Accelerate.h
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Headers/Accelerate.h
./System/Library/Frameworks/Accelerate.framework/Versions/A/Headers/Accelerate.h

^ this last one looks like what I want. How can I make cmake aware of it?

kknox commented 9 years ago

Sometimes, you have to delete the cmakecache.txt file if something changed on your system, like new packages installed. Once the cache is populated, cmake can short-circuit looking anymore.

Other than that, the logic for finding Accelerate is in the find_library call: http://www.cmake.org/cmake/help/v3.2/command/find_library.html
Perhaps you could customize it by providing it a HINTS section.

Another note: as a general rule, for building software from the command line, make sure you have pre-installed the 'apple command line tools': xcode-select --install

lzamparo commented 9 years ago

It seems cmake wasn't even looking for Accelerate; the block containing this line is not executed. Changing CORR_TEST_WITH_ACML to OFF seemed to work.

IMO, this is a cmake file bug. It's completely un-intuitive for users to have to set this flag on OSX. At the least, there should be an entry in the wiki for building that describes this situation for OSX users. I'm building now, hopefully it succeeds.

TimmyLiu commented 9 years ago

Is this issue solved? Can we close it?

lzamparo commented 9 years ago

I think it is solved, in so far as the build succeeds with CORR_TEST_WITH_ACML set to OFF. I don't think it should be closed until the build docs reflect this for Mac OSX though.

lzamparo commented 9 years ago

Sorry, I haven't had time to exercise the build much. If it matters, I support closing after a change (or even just a link) in the OSX build docs. If I encounter any other problem I can trace back to this, I'll reopen.

TimmyLiu commented 9 years ago

One solution is to add a line of code in cmake to detect if macos then set CORR_TEST_WITH_ACML off. Do you want to take on that and make a pull request?

lzamparo commented 9 years ago

Submitted.