Vous êtes sur la page 1sur 3

CUDA gpucomputingsdk-4.2.9.linux compile on Ubuntu 12.

04 LTS fails with undefined reference to gluErrorString


HAY GUISE. Once again, the common.mk files in CUDA SDK are not completely usable and minor adjustments are required. Out of the box compile gives you errors like: ../../lib/librendercheckgl_x86_64.a(rendercheck_gl.cpp.o): In function `CheckBackBuffer::checkStatus(char const*, int, bool)': rendercheck_gl.cpp:(.text+0xfbb): undefined reference to `gluErrorString' Quick fix is the following as I have found out from these sources. 1) change the order for all occurences of RENDERCHECKLIB in BOTH /C/common/common.mk and /CUDALibraries/common/common_cudalib.mk like this: OLD: -ldl NEW: -ldl LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} -rdynamic LIB += $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB} -rdynamic

and add -L../../../C/lib in common_cudalib.mk RENDERCHECKGLLIB definition line: OLD: RENDERCHECKGLLIB := -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX) NEW: RENDERCHECKGLLIB := -L../../../C/lib -lrendercheckgl_$ (LIB_ARCH)$(LIBSUFFIX) 2) In all files that use UtilNPP (boxFilterNPP, imageSegmentationNPP, freeImageInteropNPP, histEqualizationNPP), the makefiles have the wrong order of library linking ($LIB is before the source/out files), so go to the /CUDALibraries/src/*NPP/Makefile and change the order like: OLD: $(CXX) $(INC) $(LIB) -o freeImageInteropNPP freeImageInteropNPP.cpp -lUtilNPP_$(LIB_ARCH) -lfreeimage$ (FREEIMAGELIBARCH) NEW: $(CXX) $(INC) -o freeImageInteropNPP freeImageInteropNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH) 3) For randomFog, you also need to add USERENDERCHECKGL := 1 to the Makefile. Thanks to Cris/sofair. Need to spread the word (wasted enough time until I found this info). Good luck

Using Eclipse for CUDA Development

Here is how I got Eclipse (Ganymede) working with CUDA in Ubuntu 8.04. This includes syntax highlighting and having Eclipse use NVidia's makefiles. After setting up CUDA in Ubuntu, Installing Eclipse, setting up Eclipse for graphics programming, here's what I did: Syntax Highlighting for .cu Files: Window -> Preferences -> in C/C++ -> File Types -> New -> enter "*.cu" and select "C++ Source File" Working with NVidia's Makefiles: Here we'll make a copy of NVidia's template project and set it up in Eclipse. cd NVIDIA_CUDA_SDK/projects/ cp -r template/ foobar/ In Eclipse: New -> C++ Project -> Project Name: "Foobar" uncheck "Use default location" Location: "/home/yourusername/NVIDIA_CUDA_SDK/projects/foobar" Project types: Executable -> Empty Project

-> Next -> uncheck "Debug", select "Release" -> Advanced Settings -> in "C/C++ build" -> in "Builder Settings" tab -> uncheck "Generate Makefiles" Build Directory: "${workspace_loc:/foobar}" in "Behaviour" tab -> Build (incremental build):"" (delete "all") in C/C++ build -> Environment -> Add -> Name: "PATH" Value: "/usr/local/cuda/bin" -> OK Select PATH -> Edit -> Value: change ";/usr/local/cuda/bin" to ":/usr/local/cuda/bin" -> Ok -> Finish Ctrl+b to build should work now. In Makefile, replace "EXECUTABLE := template" with "EXECUTABLE := foobar" so it puts the executable in the right place. To set up Eclipse to run it: Run -> Run Configurations -> select "C/C++ Local Application" -> "New launch configuration (click the leftmost icon on the top) -> Name: "Foobar Release" Project: Foobar C/C++ Application: "/home/yourusername/NVIDIA_CUDA_SDK/bin/linux/release/foobar" -> Apply -> Close Try Ctrl+F11 to run. At this point I got: error while loading shared libraries: libcudart.so: cannot open shared object file: No such file or directory

Solution: (thanks to this guy) sudo sh -c "echo /usr/local/cuda/lib >> /etc/ld.so.conf; ldconfig" ou para sudo sh -c "echo /usr/local/cuda/lib64 >> /etc/ld.so.conf; ldconfig"

Vous aimerez peut-être aussi