Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Undefined reference and no rule for target when including CUDA in a Qt Project
Forum Updated to NodeBB v4.3 + New Features

Undefined reference and no rule for target when including CUDA in a Qt Project

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #2

    Looking at problem statement you must be getting into cross platform path issue. Check the path is pro files.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    1 Reply Last reply
    0
    • P Offline
      P Offline
      patelvrajn
      wrote on last edited by patelvrajn
      #3

      @dheerendra Cross platform path issues might occur but we have only tested this on one platform, Linux, and we still get these errors.

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #4

        Just a guess. You must be taking some path in configuratin file which are from other platforms. Like c: etc. This is typical issue for no rule to make Target etc

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        2
        • P patelvrajn

          We are having an issue with including CUDA in a Qt Project. Attached with this post is the project file. Here are the errors we are facing:

          1. Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)
          2. “No rule to make target ‘-’ needed by ‘../../proj_dir.’ Stop.”

          These are the main errors we came across when modifying the project file in an attempt for a successful execution. We have tried various solutions on the internet to solve these problems with no luck. It would be much appreciated if anyone could assist us in finding a solution.

          For additional context, listed below are the resources we utilized in creating our project file:

          1. https://declanrussell.com/2015/04/16/compiling-cuda-dynamic-parallelism-with-qt-creator/
          2. https://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/

          Project File: https://drive.google.com/drive/folders/1wjbd2Bih6PFsQQSck3qNRYRH8w-HQJd2?usp=sharing

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @patelvrajn You should fix your LIBS like:

          LIBS += -LPATH_TO_LIBS_DIR -lcudart -lcuda
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3
          • P Offline
            P Offline
            patelvrajn
            wrote on last edited by
            #6

            I have updated the drive link with the edits made to the file, jsulm_ver.pro is the latest file.

            @dheerendra I checked the project file and some of the included files, I could not find a path in a format used in other platforms.

            @jsulm I have fixed the LIBS as you suggested (as seen in the juslm_ver.pro) however, it still outputs the following error:

            "Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"

            aha_1980A 1 Reply Last reply
            0
            • P patelvrajn

              I have updated the drive link with the edits made to the file, jsulm_ver.pro is the latest file.

              @dheerendra I checked the project file and some of the included files, I could not find a path in a format used in other platforms.

              @jsulm I have fixed the LIBS as you suggested (as seen in the juslm_ver.pro) however, it still outputs the following error:

              "Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @patelvrajn

              Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"

              So you need to find out in which library this function resides and then compare with your linker command line (in compile output), if you are actually linking to this library.

              Should be easy to fix.

              Qt has to stay free or it will die.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                patelvrajn
                wrote on last edited by
                #8

                @aha_1980 This was one of the solutions we thought of before with no success however, I did reattempt this solution. This time I ran a 'ls' command of the 'opt/cuda/lib64' directory and listed all the libraries in a text file, cuda_libs.txt (uploaded in the google drive link). Afterwards, I included all of the libraries in the project file, aha1980_ver.pro (uploaded in the google drive link), and ran it (clean, qmake, build & run) and got the same error.

                By same error I am referring to:

                "Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Hi,

                  How did you declare these functions ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    patelvrajn
                    wrote on last edited by
                    #10

                    @SGaist

                    The following is the declaration of the function gpuFlow in cudaflow.cu that is referenced by the error:

                    void gpuFlow(int a, int b, float *c, float *d, float *e, float *f, float *g, float *h, float *i, float *&j, float *&k, int l, int m, float o)

                    1 Reply Last reply
                    0
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by
                      #11

                      See if some defines are missing to say which library to use. Do you see method defined in header files ? That may give some hint on any export defines to best used.

                      Dheerendra
                      @Community Service
                      Certified Qt Specialist
                      http://www.pthinks.com

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        patelvrajn
                        wrote on last edited by
                        #12

                        @dheerendra I don't see any definitions missing. I do see the method declared but not defined in the header file. It is defined in the cudaflow.cu file. I also removed all the code from the gpuFlow function and left the function definition empty but the error is still the same (I see this as odd considering if we were missing libraries that were essential to the function call then wouldn't this still work?).

                        However, I did notice something that I didn't notice before which was a message from NVBLAS telling us that it was missing a path to the CPU Blas library. I fixed this issue by creating a nvblas config file (which was missing, I also uploaded the one I created to the drive link) but it not seem to change anything.

                        1 Reply Last reply
                        0
                        • dheerendraD Offline
                          dheerendraD Offline
                          dheerendra
                          Qt Champions 2022
                          wrote on last edited by dheerendra
                          #13

                          Method missing can happen only if

                          1. Method implementation missing.
                          2. Compiler missmatch
                          3. 64/32 bit mismatch
                          4. Some dependent libraries are misssing
                          5. Library expects you to do some defines like #define CUDA_STATIC 1

                          These are hints for you to look at the issue.

                          Dheerendra
                          @Community Service
                          Certified Qt Specialist
                          http://www.pthinks.com

                          1 Reply Last reply
                          2
                          • P Offline
                            P Offline
                            patelvrajn
                            wrote on last edited by
                            #14

                            We are still looking into these listed causes, we will post and share the result of our findings if anything comes about.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved