Undefined reference and no rule for target when including CUDA in a Qt Project
-
wrote on 25 Jan 2019, 03:24 last edited by 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:
- Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)
- “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:
- https://declanrussell.com/2015/04/16/compiling-cuda-dynamic-parallelism-with-qt-creator/
- https://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/
Project File: https://drive.google.com/drive/folders/1wjbd2Bih6PFsQQSck3qNRYRH8w-HQJd2?usp=sharing
-
Looking at problem statement you must be getting into cross platform path issue. Check the path is pro files.
-
wrote on 25 Jan 2019, 04:20 last edited by patelvrajn
@dheerendra Cross platform path issues might occur but we have only tested this on one platform, Linux, and we still get these errors.
-
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
-
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:
- Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)
- “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:
- https://declanrussell.com/2015/04/16/compiling-cuda-dynamic-parallelism-with-qt-creator/
- https://cudaspace.wordpress.com/2011/04/07/qt-creator-cuda-linux/
Project File: https://drive.google.com/drive/folders/1wjbd2Bih6PFsQQSck3qNRYRH8w-HQJd2?usp=sharing
@patelvrajn You should fix your LIBS like:
LIBS += -LPATH_TO_LIBS_DIR -lcudart -lcuda
-
wrote on 26 Jan 2019, 20:27 last edited by
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(…)"
-
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(…)"
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.
-
wrote on 27 Jan 2019, 21:26 last edited by
@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(…)"
-
Hi,
How did you declare these functions ?
-
wrote on 27 Jan 2019, 23:29 last edited by
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)
-
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.
-
wrote on 4 Feb 2019, 01:45 last edited by
@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.
-
Qt Champions 2022wrote on 4 Feb 2019, 02:52 last edited by dheerendra 2 Apr 2019, 07:06
Method missing can happen only if
- Method implementation missing.
- Compiler missmatch
- 64/32 bit mismatch
- Some dependent libraries are misssing
- Library expects you to do some defines like #define CUDA_STATIC 1
These are hints for you to look at the issue.
-
wrote on 11 Feb 2019, 04:02 last edited by
We are still looking into these listed causes, we will post and share the result of our findings if anything comes about.