here’s a summary of what needs to be done to get CUDA 2.3 working nice on Snow Leopard.
I did not find out this stuff, I’m just summing up the stuff gathered from various other forum posts.
Fix 1:
NVCC is not compatible with gcc and g++ 4.2, but these are the default compilers on Snow Leopard and nvcc uses the defaults.
The solution is to make versions 4.0 the system defaults again (as was the case with Leopard)
To remove the symbolic links to versions 4.2 and re-create the links to versions 4.0 execute:
Fix 2:
CUDA is not yet capable of 64bit development under OS X, but it looks like the compilers now default to creating 64bit code.
To prevent that, the parameter -m32 needs to be passed to all compilers (gcc, g++ and nvcc).
In order to build the CUDA SDK samples on SL, the following adjustments are needed to the SDKs common make file:
Edit /Developer/GPU Computing/C/common/common.mk
The lines
NVCCFLAGS :=
CXXFLAGS := $(CXXWARN_FLAGS)
CFLAGS := $(CWARN_FLAGS)
Need to be changed to
NVCCFLAGS := -m32
CXXFLAGS := -m32 $(CXXWARN_FLAGS)
CFLAGS := -m32 $(CWARN_FLAGS)
FIx 3:
Due to a bug in the CUDA Driver (or Toolkit?) installer, some permissions are not correctly set, which prevents the CUDA kernel extension from being loaded after a system restart.
Hopefully that’s all - but actually I messed so much with my system lately that I cannot be sure I didn’t miss something.
So if CUDA still does not work please give feedback here so we can adjust/expand this summary.
FIX 4: (added 10.Sept.09)
Wrong permissions on the “/usr/local/cuda/lib” folder
This one seems to happen under some circumstances only - on 5 CUDA installs it happened to me once. Anyway, after installing the CUDA driver and toolkit make sure check if this folder does can be read by all users.
This was all pretty handy in terms of getting things to start compiling, but I’m noticing a LOT of problems with GL header files. Is anyone else running into this?
This is using -I/Developer/GPU/C/common/inc (GPU just being a symlink to GPU Computing so that there is no space in the pathname.)
/usr/X11R6/include/GL/gl.h(1746): error: invalid redeclaration of type name “PFNGLTEXIMAGE3DPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1175): here
/usr/X11R6/include/GL/gl.h(1850): error: invalid redeclaration of type name “PFNGLSECONDARYCOLORPOINTERPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1460): here
/usr/X11R6/include/GL/gl.h(1852): error: invalid redeclaration of type name “PFNGLPOINTPARAMETERFVPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1443): here
/usr/X11R6/include/GL/gl.h(1856): error: invalid redeclaration of type name “PFNGLMULTIDRAWARRAYSPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1440): here
/usr/X11R6/include/GL/gl.h(1857): error: invalid redeclaration of type name “PFNGLMULTIDRAWELEMENTSPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1441): here
/usr/X11R6/include/GL/gl.h(1936): error: invalid redeclaration of type name “PFNGLGETVERTEXATTRIBPOINTERVPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1747): here
/usr/X11R6/include/GL/gl.h(1974): error: invalid redeclaration of type name “PFNGLGETUNIFORMLOCATIONPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1744): here
/usr/X11R6/include/GL/gl.h(1978): error: invalid redeclaration of type name “PFNGLGETSHADERSOURCEPROC”
/Developer/GPU/C/common/inc/GL/glew.h(1742): here
@Brett:
Yes, I think NVIDIA is doing a little mess with the OpenGL headers.
Under OS X glew, glu, glut are all shipped with the system but the CUDA SDK ships and uses with it’s own copies of those. So probably you’ll run into trouble if you create an app that uses both the Mac headers AND the SDK common includes. Is that the case? Do the SDK samples (that use OpenGL) compile?
@fercook
No idea. Did you try ‘make clean’ and then ‘make’?
make -C src/3DFD/
make[1]: g++: No such file or directory
make[1]: *** […/…/bin/darwin/release/3dfd] Error 1
make: *** [src/3DFD/Makefile.ph_build] Error 2
The examples do compile, however none of them use glx.h, and it seems that nVidia isn’t distributing it. glx.h in turn includes gl.h, which then causes the issue. Not really sure what I can do about this, but this is COMPLETELY killing my productivity at this point.
This was definitely working perfectly under 10.5, and only became a problem in Snow Leopard. The code in question is multi-platform, so I’m not sure if I can change it without causing issues on other platforms.
I might be able to do massive #ifdefs, but that definitely won’t be pretty.
Anyhow, I do appreciate the input, and I’ll at least take a gander and see if it might be feasible. As you might imagine, it’s just frustrating to have a lot of work created by something that was previously working perfectly.