FedoraForum.org - Fedora Support Forums and Community
Results 1 to 10 of 10
  1. #1
    crazirican Guest

    CUDA compile error

    I am trying to compile examples from the book CUDA By Example. I am using a non-root account from a remote computer using terminal via SSH.

    When I try to compile code I get the following errors:

    /usr/bin/ld: /tmp/tmpxft_00002ebd_00000000-13_PassingParameters.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'
    /usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line
    /lib64/libpthread.so.0: could not read symbols: Invalid operation


    I guess I have to add libpthread.so.0 to /lib64/. Where can I get the libpthread.so.0 file?

    Thanks,

  2. #2
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,430
    Mentioned
    187 Post(s)
    Tagged
    0 Thread(s)

    Re: CUDA compile error

    It's in the glibc package, are you sure it's not installed (ie. try ls -l /lib64/libpthread.so.0 )?

  3. #3
    crazirican Guest

    Re: CUDA compile error

    [root@localhost ch_3.2.3]# ls -l /lib64/libpthread.so.0
    lrwxrwxrwx 1 root root 20 Feb 20 15:19 /lib64/libpthread.so.0 -> libpthread-2.12.2.so

    I guess it is installed. How do I update it to 2.2.5 and why do I get that error then?

  4. #4
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,430
    Mentioned
    187 Post(s)
    Tagged
    0 Thread(s)

    Re: CUDA compile error

    It seems likely to me you need to add -lpthread to your makefile where it does the linking

  5. #5
    crazirican Guest

    Re: CUDA compile error

    I added the -lpthread line to both makefiles under the sdk directory. It works when I write nvcc [name].cu -lpthread. Is there a way to implicitly link the library?

    Thanks,

  6. #6
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,430
    Mentioned
    187 Post(s)
    Tagged
    0 Thread(s)

    Re: CUDA compile error

    Try going to NVIDIA_GPU_Computing_SDK/C/common/common.mk and append -lpthread to LIB
    where I show it bolded (around line 310 in the current CUDA 3.2 copy of the file )
    Actually, where you do it doesn't really matter it's just that the position I show here is the final place where LIB is appended
    to in the existing file (where -lcusparse was added)

    ifeq ($(USECUSPARSE),1)
    LIB += -lcusparse
    endif

    LIB += -lpthread


    # Lib/exe configuration
    # Lib/exe configuration
    # Lib/exe configuration
    does that work?
    Last edited by marko; 24th February 2011 at 03:46 AM.

  7. #7
    crazirican Guest

    Re: CUDA compile error

    Nope it did not.

  8. #8
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,430
    Mentioned
    187 Post(s)
    Tagged
    0 Thread(s)

    Re: CUDA compile error

    Quote Originally Posted by crazirican
    Nope it did not.
    Did you at least see the "-lpthread" make it to the console at the expected place as the commands scroll by when you build?

    The trick is just to find the right place to add the -lpthread to the common.mk file

  9. #9
    crazirican Guest

    Re: CUDA compile error

    Hmm. I just write nvcc [name].cu -lpthread and it compiles. Nothing scrolls on the console unless there is an error.

  10. #10
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,430
    Mentioned
    187 Post(s)
    Tagged
    0 Thread(s)

    Re: CUDA compile error

    Quote Originally Posted by crazirican
    Hmm. I just write nvcc [name].cu -lpthread and it compiles. Nothing scrolls on the console unless there is an error.
    I think there's a flag in the makefile that activates verboseness

Similar Threads

  1. gcc 4.3 and CUDA SDK
    By jbenninghoff in forum Programming & Packaging
    Replies: 1
    Last Post: 11th June 2010, 05:50 AM
  2. CUDA mplayer etc
    By hiberphoptik in forum Using Fedora
    Replies: 4
    Last Post: 28th April 2010, 10:31 PM
  3. nvidia cuda sdk examples won't compile [SOLVED]
    By jsnark in forum Using Fedora
    Replies: 6
    Last Post: 30th October 2009, 08:09 PM
  4. How to get Boinc 6.4.5 to use CUDA
    By Kobuck in forum Using Fedora
    Replies: 7
    Last Post: 15th September 2009, 05:50 PM
  5. Anyone using CUDA?
    By drunkahol in forum Using Fedora
    Replies: 2
    Last Post: 7th August 2009, 01:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •