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: LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} -ldl -rdynamic
NEW: LIB += $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB} -ldl -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

Z

20 comments on “CUDA gpucomputingsdk-4.2.9.linux compile on Ubuntu 12.04 LTS fails with undefined reference to ‘gluErrorString’

  1. This still happens after all the changes.

    ~/NVIDIA_GPU_Computing_SDK/C/src/fluidsGL$ make
    /usr/bin/ld: cannot find -lrendercheckgl_x86_64
    collect2: ld returned 1 exit status
    make: *** [../../bin/linux/release/fluidsGL] Error 1

  2. This worked perfect, I used the script Warren MacEvoy posted (thanks everybody for the help!)

  3. thanks <3

  4. Markus-Hermann KochNo Gravatar on said:

    That’s the gospel, man! However, to all ye other folks: Read every word most carefully. Do not stop at simply hunting the lines containing NEW and OLD, lest ye oversee things like you have to change _every_occurrance_ when $(RENDERCHECKGLLIB) and ${OPENGLLIB} appear in the same line in common_cuda.mk and common.mk by swapping $(RENDERCHECKGLLIB) to the front. After that it works like a charm.

    I add my thanks to the long list of other grateful people!

  5. This did the trick, thanks!

  6. Thank u so much….it meant a lot for my project work…..

  7. Jitesh DoshiNo Gravatar on said:

    Thanks a lot.. saved upon lot of time

  8. cristobalNo Gravatar on said:

    thanks worked wth ubuntu 12.04 !

  9. Diógenes FreitasNo Gravatar on said:

    Thank you very much, man.

    I lost a lot of time trying to make it work.

    Thank you again!!

  10. Marko RistinNo Gravatar on said:

    thanks! worked for me as well on ubuntu 12.04

  11. Pingback: Installing CUDA on Ubuntu 12.04 « sn0v

  12. Warren MacEvoyNo Gravatar on said:

    #!/bin/bash
    if [ ! -f cudpp_license.txt ] ; then echo “run in cuda sdk directory.”; exit; fi
    echo “fixing library order…”
    sed -i- ‘s/${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB)/$(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB)/’ $(find . -type f -print0 | xargs -0 grep -l ‘${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB)’)
    sed -i- ‘s/$(CXX) $(INC) $(LIB) -o (.*)$/$(CXX) $(INC) -o 1 $(LIB)/’ $(find . -type f -print0 | xargs -0 grep -l ‘$(CXX) $(INC) $(LIB)’)
    if ! grep USERENDERCHECKGL CUDALibraries/src/randomFog/Makefile
    then
    sed -i- ‘/USEGLUT *:= 1/ a USERENDERCHECKGL := 1′ CUDALibraries/src/randomFog/Makefile
    fi

  13. Warren MacEvoyNo Gravatar on said:

    Running this bash script from the SDK root directory makes the above changes (except the LIB ends up on the end of the CXX line, which causes no harm):

    #!/bin/bash
    if [ ! -f cudpp_license.txt ] ; then echo \"run in cuda sdk directory.\"; exit; fi
    echo \"fixing library order...\"
    sed -i- \'s/${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB)/$(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB)/\' $(find . -type f -print0 | xargs -0 grep -l \'${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB)\')
    sed -i- \'s/$(CXX) $(INC) $(LIB) -o (.*)$/$(CXX) $(INC) -o 1 $(LIB)/\' $(find . -type f -print0 | xargs -0 grep -l \'$(CXX) $(INC) $(LIB)\')
    if ! grep USERENDERCHECKGL CUDALibraries/src/randomFog/Makefile
    then
    sed -i- \'/USEGLUT := 1/ a USERENDERCHECKGL := 1\' CUDALibraries/src/randomFog/Makefileo
    fi

  14. Mikhail KatliarNo Gravatar on said:

    Thank you very much! You’ve saved me lots of time!

  15. Pingback: Update: CUDA computing « Entertaining Research

  16. aDudeNo Gravatar on said:

    Thx! Your post finally got it all right how to fix it! Sweeeet….!

  17. DeckerNo Gravatar on said:

    Thanks for compiling this info. Not sure why the sdk doesn’t just point to its own binaries for libraries by default.

  18. Pingback: 如何在Ubuntu 12.04上配置CUDA 4.2 | bfcat-计算机视觉博客

  19. hilbert16No Gravatar on said:

    Wonderful, these changes worked for me…Thxxxx

Leave a Reply

Your email address will not be published. Required fields are marked *

*

     

HTML tags are not allowed.