Build error with 2.78 and XCode 4.0.2

NashTrash
Posts: 1
Joined: Wed Apr 20, 2011 5:30 pm

Build error with 2.78 and XCode 4.0.2

Post by NashTrash »

I just downloaded 2.78 and am trying to build on OS X 10.6.7 with XCode 4.0.2. Following http://bulletphysics.org/mediawiki-1.5.8/index.php, I did this:

cmake . -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON -DFRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURE='i386;x86_64' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/Library/Frameworks -DCMAKE_INSTALL_NAME_DIR=/Library/Frameworks -DBUILD_DEMOS:BOOL=OFF

make -j4

The build went all the way through 100% and then died with the following error:

Linking CXX shared library BulletSoftBodySolvers_CPU.framework/Versions/2.78/BulletSoftBodySolvers_CPU
[100%] Built target BulletSoftBodySolvers_CPU
Linking CXX shared library BulletSoftBodySolvers_OpenCL_Mini.framework/Versions/2.78/BulletSoftBodySolvers_OpenCL_Mini
Undefined symbols for architecture x86_64:
"_clGetProgramInfo", referenced from:
CLFunctions::compileCLKernelFromString(char const*, char const*, char const*)in btSoftBodySolver_OpenCL.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/BulletSoftBodySolvers_OpenCL_Mini.framework/Versions/2.78/BulletSoftBodySolvers_OpenCL_Mini] Error 1
make[1]: *** [src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeFiles/BulletSoftBodySolvers_OpenCL_Mini.dir/all] Error 2
make: *** [all] Error 2

This would appear to be an issue with my OpenCL setup (not having a clGetProgramInfo for x86_64). Any thoughts?
Thanks,
Graham
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Build error with 2.78 and XCode 4.0.2

Post by dphil »

I had the exact same problem on the same OS (10.6.7). The problem seems to be a missing implementation of clGetProgramInfo. After looking over the code, seems to me it is supposed to be in MiniCL.cpp (which holds other cl method implementations, like clGetProgramBuildInfo, etc). Adding the following

Code: Select all

CL_API_ENTRY cl_int clGetProgramInfo(cl_program         /* program */,
                 cl_program_info    /* param_name */,
                 size_t             /* param_value_size */,
                 void *             /* param_value */,
                 size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0
{
	return 0;
}
to that file fixed it for me. I'm not sure if this was just mistakenly left out of the source code or what...
Oh, and don't mind the fact that it just returns 0. So does the pre-existing clGetProgramBuildInfo implementation. They are never called/used except when an error has already occurred anyway (theoretically I suppose they would return info useful for an error log).