Instructions for making CUDA 2.3 work on Snow Leopard How to fix permissions and nvcc linker errors

That’s weird, because Xcode should install gcc, g++ etc in /usr/bin - and nvcc requires those to be there.

So if you do not have gcc and g++ in there I guess something did not go well.

My first post… some observations:

Just installed Snow Leopard (on a Mac Pro 2009) and finally got CUDA 2.3 installed (had to reinstall the Driver package to get libcuda.dylib).
No permissions problems that I’ve found so far - I wonder if that’s caused by an installer changing permissions asynchronously?
Moved /Developer/GPU Computing to /Developer/CUDA (whose idea was it to put a space in the folder name? anyway…)
The usual chaos reported by others trying to compile in /Developer/GPU Computing/C (fun fun fun)

I think there’s no need to edit common/common.mk
The ‘machine’ error reported above is triggered by the presence of both ‘-m32’ and ‘-m64’:

$ nvcc -m32 -m64
nvcc fatal : redefinition of argument ‘machine’

so adding miscellaneous ‘-m32’ in common.mk probably not wise. Instead try this:
$ make i386=1 x86_64=0

/System/Library/StartupItems/ is empty.

I have a brand new mac pro (running snow leopard)

with:

EVGA 01G-P3-1080-TR GeForce GTX 285 for Mac

System profiler sees both this and the GT 120 that came with the machine.

SystemProfiler tells me

64-bit Kernel and Extensions: No

When I tried to reinstall the driver I’m told

No driver update is needed for this system. This system already has drivers which support this NVIDIA graphics solution.

Scott

Hello,

I made further modifications in the common.mk:

  • replace 10.6 with 10.6.1

  • replace ifneq($(SNOWLEOPARD),) with ifeq($(SNOWLEOPARD),) in line 114

It worked to me

Hope this helps

Francesco

I think that I am having problems with permissions but I don’t understand how to fix them. I think I accidentally made the problem worse because now my /usr/local/cuda/lib just give a “permission denied” error message when I try to go there. Any help out of this mess would be greatly appreciated.

boob:~ lash$ ls -l /usr/local/cuda/

total 0

drwxrwxr-x 11 root wheel 374 Oct 3 22:40 bin

drwxrwxr-x 16 root wheel 544 Oct 3 22:40 doc

drwxrwxr-x 35 root wheel 1190 Oct 3 22:40 include

d----w---- 9 root wheel 306 Oct 3 22:40 lib

drwxrwxr-x 4 root wheel 136 Mar 11 2009 man

drwxrwxr-x 4 root wheel 136 Mar 11 2009 open64

drwxrwxr-x 3 root wheel 102 Oct 3 22:40 src

I deleted cuda and reinstalled, permission are normal now but my program still doesn’t compile. I just get an error about the library not being found, help please?

gcc -o read_lib read_lib.cu.o read_and_store_library.o n_queries_mgf.o read_and_store_query.o bin_queries.o bin_library.o -L /usr/local/cuda/lib/ -lcuda

ld: library not found for -lcuda

On Snow Leopard the 3.0.1_beta installed with the default gcc 4.2.1 and no -m32 flags. To get make to work in /Developer/GPU Computing/C, I did

sudo chmod 755 /usr/local/cuda/lib

I tested some (not all) of the examples and they passed.

Hi,

I have SnowLeopard, and have been having the exact same problems. After tinkering all day, I managed to get the SDK to compile (although the SDK compilation has a number of warnings). First, I noticed that my MacOS X version number is 10.6.2, so I’ve updated Francesco’s contribution so that it works for me. This might help some of you with the problems you are experiencing.

I made further modifications in the common.mk:

  • replace 10.6 with 10.6.2
  • replace ifneq($(SNOWLEOPARD),) with ifeq($(SNOWLEOPARD),) in line 114

In addition, it is important to realize that all of the SDK examples link to a file in the ‘/Developer/GPU Computing/C/lib’ directory called ‘libcutil_i386.a’. This file is an archive of several object files created from source files in the ‘/Developer/GPU Computing/C/common/src’ directory.

When you execute the ‘make’ command with no arguments from the ‘Developer/GPU Computing/C’ directory, the first thing the make command does is to compile the source code in the ‘/Developer/GPU Computing/C/common/src’ directory (if needed), which generates a collection of ‘.o’ files in the ‘/Developer/GPU Computing/C/common/obj/i386/release’ directory. These are the files that are archived in ‘libcutil_i386.a’. However, they are NOT replaced when you run make. Thus, part of the problem may be that the make command was previously executed with an incorrect ‘common.mk’ file, generating an incorrect collection of ‘.o’ files in the common sub-directory tree. Subsequently, when the corrections are made, the make command will NOT overwrite the ‘.o’ files. You must delete them first with a ‘make clean’, or manually. Try this, and re-run make.

Hi guys just got my CUDA 2.3 installed successfully on Snow Leopard without making all those amendment mentioned above.

After installation of Xcode, just try to “make” with “i386=1 x86_64=0”
everything will work out right.

indeed, you dont even need the “x86_64=0”

Unfortunately, I am having trouble with the install even with all these corrections. When I attempt to make I error when it gets to the bicubicTexture file. Has anyone else had a similar problem? Is there something wrong with how the libraries are set up? Particularly librendercheck_gl. Any help would be greatly appreciated. This install is starting to make me want to hurt puppies.

make -C src/asyncAPI/ 

make -C src/bandwidthTest/ 

make -C src/bicubicTexture/

bicubicTexture.cpp:689: warning: unused parameter ‘argc’

bicubicTexture.cpp:578: warning: ‘shaderCode’ defined but not used

ld: warning: in ../../lib/librendercheckgl_i386.a, file is not of required architecture

Undefined symbols:

  "CheckBackBuffer::CheckBackBuffer(unsigned int, unsigned int, unsigned int, bool)", referenced from:

	  runCUDASample(int, char**)in bicubicTexture.cpp.o

	  runAutoTest(int, char**)in bicubicTexture.cpp.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make[1]: *** [../../bin/darwin/release/bicubicTexture] Error 1

make: *** [src/bicubicTexture/Makefile.ph_build] Error 2

[quote name=‘tchapm’ post=‘1009184’ date=‘Feb 27 2010, 11:44 PM’]

Unfortunately, I am having trouble with the install even with all these corrections. When I attempt to make I error when it gets to the bicubicTexture file. Has anyone else had a similar problem? Is there something wrong with how the libraries are set up? Particularly librendercheck_gl. Any help would be greatly appreciated. This install is starting to make me want to hurt puppies.

[codebox]make "i386=1 x86_64=0"

a - obj/i386/release/bank_checker.cpp.o

a - obj/i386/release/cmd_arg_reader.cpp.o

a - obj/i386/release/cutil.cpp.o

a - obj/i386/release/stopwatch.cpp.o

a - obj/i386/release/stopwatch_linux.cpp.o

a - obj/i386/release/multithreading.cpp.o

make -C src/3DFD/

make -C src/alignedTypes/

make -C src/asyncAPI/

make -C src/bandwidthTest/

make -C src/bicubicTexture/

bicubicTexture.cpp:689: warning: unused parameter ‘argc’

bicubicTexture.cpp:578: warning: ‘shaderCode’ defined but not used

ld: warning: in …/…/lib/librendercheckgl_i386.a, file is not of required architecture

Undefined symbols:

“CheckBackBuffer::CheckBackBuffer(unsigned int, unsigned int, unsigned int, bool)”, referenced from:

  runCUDASample(int, char**)in bicubicTexture.cpp.o

  runAutoTest(int, char**)in bicubicTexture.cpp.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make[1]: *** […/…/bin/darwin/release/bicubicTexture] Error 1

make: *** [src/bicubicTexture/Makefile.ph_build] Error 2[/codebox]

Every time I do the make I do make clean before, I made Francesco’s changes. I don’t really know what I have to do.

However the fact that more than one person are having the same errors means that it is a common error.

Thanks in advance for any reply.

I resolved my problems:

I changed common.k in these points:

replace 10.6 with 10.6.2
replace ifneq($(SNOWLEOPARD),) with ifeq($(SNOWLEOPARD),) in line 114

and I compiled with “i386=1 x86_64=0” like this:

make “i386=1 x86_64=0”

(well… really I should say that I added emu=1 because I’m running snow leopard on a mac without Nvidia card, however even when I compiled without the emu=1 variable, it was working and I quit it).

The solution came when I deleted MANUALLY the .o in /Developer/GPU Computing/C/common/obj/i386/release and /Developer/GPU Computing/C/common/obj/x86_64/release.

Hope with all my heart that this can help.

Paolo.

With the current SDK (2.3a), I found that default compiler (gcc-4.2) works without problem. It is not necessary to change the symlinks of gcc and g++ anymore.

I stilll need to modify /Developer/GPU Computing/C/common/common.mk in two places:

Fix 1: at line 39, change from
[font=“Courier New”] SNOWLEOPARD = $(strip $(findstring 10.6, $(shell egrep “10.6” /System/Library/CoreServices/SystemVersion.plist)))[/font]
to
[font=“Courier New”] SNOWLEOPARD = $(strip $(findstring 10.6, $(shell egrep “10.6” /System/Library/CoreServices/SystemVersion.plist)))[/font]

Notice the deletion of ‘’. This fix is necessary because after Software Update, my OS version becomes 10.6.2, not 10.6.

Earlier in the thread, someone suggested replace ‘10.6’ by ‘10.6.2’. This is a improper fix. Although it will work for now, but when Apple releases another kernel update and bumps the version to 10.6.3, it will break as a result.

Fix 2: at line 311, change from
[font=“Courier New”] LINKLINE = ar rucv $(TARGET) $(OBJS)[/font]
to
[font=“Courier New”] LINKLINE = ar rucvs $(TARGET) $(OBJS)[/font]

Notice the additional ‘s’. The ‘s’ flag tells ar to build the object file index in the library. Without the ‘s’ flag, I will get this error:

[font=“Courier New”]ld: in …/…/lib/libcutil_i386.a, archive has no table of contents[/font]

After both fixes, a simple “make” will compile the SDK without any error. Hope this helps.

Hi,

I just installed CUDA (driver 3.0.14, toolkit 3.0, …) on my Mac running OS X 10.6.3.

Trying to compile the SDK gave errors (no option “-arch”) so I incorporated the mentioned modifications to common.mk.

I had to do it however to both /Developer/GPU\ Computing/C/commom/common.mk as well as /Developer/GPU\ Computing/shared/common.mk to get rid of all “-arch” errors.

This made the make-process compile the code in the “commom” directory successfully.

It breaks however when it comes to the projects:

In file included from /usr/local/cuda/bin/../include/common_functions.h:102:0,

				 from /usr/local/cuda/bin/../include/crt/host_runtime.h:279,

				 from /tmp/tmpxft_00006140_00000000-4_simpleGL_kernel.compute_10.cudafe1.stub.c:2,

				 from /tmp/tmpxft_00006140_00000000-4_simpleGL_kernel.compute_10.cudafe1.stub.c:1:

/usr/local/cuda/bin/../include/math_functions.h:3274:72: error: new declaration ‘double exp10(double)’

/usr/local/cuda/bin/../include/math_functions.h:137:45: error: ambiguates old declaration ‘double exp10(double)’

/usr/local/cuda/bin/../include/math_functions.h: In function ‘double exp10(double)’:

/usr/local/cuda/bin/../include/math_functions.h:3274:96: error: new declaration ‘double exp10(double)’

/usr/local/cuda/bin/../include/math_functions.h:137:45: error: ambiguates old declaration ‘double exp10(double)’

/usr/local/cuda/bin/../include/math_functions.h: At global scope:

/usr/local/cuda/bin/../include/math_functions.h:3279:71: error: new declaration ‘float exp10f(float)’

/usr/local/cuda/bin/../include/math_functions.h:139:44: error: ambiguates old declaration ‘float exp10f(float)’

/usr/local/cuda/bin/../include/math_functions.h: In function ‘float exp10f(float)’:

/usr/local/cuda/bin/../include/math_functions.h:3279:94: error: new declaration ‘float exp10f(float)’

/usr/local/cuda/bin/../include/math_functions.h:139:44: error: ambiguates old declaration ‘float exp10f(float)’

/usr/local/cuda/bin/../include/math_functions.h: At global scope:

/usr/local/cuda/bin/../include/math_functions.h:3284:99: error: new declaration ‘void sincos(double, double*, double*)’

/usr/local/cuda/bin/../include/math_functions.h:112:43: error: ambiguates old declaration ‘void sincos(double, double*, double*)’

In file included from /usr/local/cuda/bin/../include/common_functions.h:102:0,

				 from /usr/local/cuda/bin/../include/crt/host_runtime.h:279,

				 from /tmp/tmpxft_00006140_00000000-4_simpleGL_kernel.compute_10.cudafe1.stub.c:2,

				 from /tmp/tmpxft_00006140_00000000-4_simpleGL_kernel.compute_10.cudafe1.stub.c:1:

/usr/local/cuda/bin/../include/math_functions.h: In function ‘void sincos(double, double*, double*)’:

/usr/local/cuda/bin/../include/math_functions.h:3284:150: error: new declaration ‘void sincos(double, double*, double*)’

/usr/local/cuda/bin/../include/math_functions.h:112:43: error: ambiguates old declaration ‘void sincos(double, double*, double*)’

/usr/local/cuda/bin/../include/math_functions.h: At global scope:

/usr/local/cuda/bin/../include/math_functions.h:3290:97: error: new declaration ‘void sincosf(float, float*, float*)’

/usr/local/cuda/bin/../include/math_functions.h:114:43: error: ambiguates old declaration ‘void sincosf(float, float*, float*)’

/usr/local/cuda/bin/../include/math_functions.h: In function ‘void sincosf(float, float*, float*)’:

/usr/local/cuda/bin/../include/math_functions.h:3290:146: error: new declaration ‘void sincosf(float, float*, float*)’

/usr/local/cuda/bin/../include/math_functions.h:114:43: error: ambiguates old declaration ‘void sincosf(float, float*, float*)’

make: *** [obj/i386/release/simpleGL_kernel.cu.o] Error 1

Does anybody know how to solve this issue? Any help would be appreciated.

Solved it:

I just commented the lines 3273 to 3298 in math_functions.h out.

Somehow my gcc/g++ 4.5 would not compile the examples in 32 bit (even with -march=i386 instead of -arch i386) so I used the standard 4.2 ones to get it running.