Comment 9 for bug 1005329

Revision history for this message
Carlos Sánchez de La Lama (csanchezdll) wrote :

I think this is finally fully diagnosed. There are 3 different problems (but easy to mix because we are compiling a compiler which can be automatically used every time you recompile... :S)

1) Default clang in Mac OS X Lion generates external template instantiation with local visibility, when compiling llvm-3.1. So when loading pocl plugin, symbols corresponding to cl::opt<xxx> types used to parse command line parameters are not found. This happens with both static & dynamic builds of llvm. To solve this, compile llvm-3.1 with clang-3.1 or gcc.

2) Release builds of llvm strip opt when installing, so some symbols needed by pocl plugin are not found. I have reports this to llvmdev (can be easily fixed by adding KEEP_SYMBOLS := 1 to llvm/tools/opt/Makefile). This can be avoided with that patch or using Debug build of llvm.

3) Even when two first problems are avoided, if llvm-3.1 is compiled with a previously built clang-3.1 an error occurs in CommandLine library when parsing string parameters ("pointer being freed was not allocated"). I have googled a bit and seems to be happening to others, at least in the past.

Summing up, to use pocl on Mac OS X, *use gcc to compile llvm-3.1*. You have to force it otherwise it uses clang if found:
../../src/llvm-3.1/configure <whatever> CC=gcc CXX=g++
I am successfully using MacPorts gcc-4.6.
Also, either patch the opt Makefile not to strip symbols or use a shared llvm build (--enable-shared).

Closing the bug as it is not pocl-related.