Hello there,
I’m trying to compile CUDA code on an Jetson TX2, resulting in the error “nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified”.
The code has already run without CUDA, so I suspect that the integration of the CUDA code is the problem. CUDA itself is correctly installed, since the exmaples compiled and run.
Versions:
Ubuntu 16.04 LTS
Qt Creator 3.5.1
cmake version 3.5.1
cuda-9.0
nvcc V9.0.252
openCV 3.3.1
Compile output:
14:34:30: Running steps for project CudaPic...
14:34:30: Configuration unchanged, skipping qmake step.
14:34:30: Starting: "/usr/bin/make"
/usr/lib/aarch64-linux-gnu/qt5/bin/qmake -spec linux-g++ CONFIG+=debug -o Makefile ../CudaPic/CudaPic.pro
WARNING: Compiler: cuda: No output file specified
/usr/local/cuda-9.0/bin/nvcc -D_DEBUG -D/usr/local/cuda-9.0 -lcudart -lcuda --machine 64 sm_62 -c -o cudaobj/Debug/fkt_alles_cuda.o ../CudaPic/fkt_alles.cu
Makefile:318: recipe for target 'cudaobj/Debug/fkt_alles_cuda.o' failed
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
make: *** [cudaobj/Debug/fkt_alles_cuda.o] Error 1
14:34:30: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project CudaPic (kit: JetsonTX2)
When executing step "Make"
14:34:30: Elapsed time: 00:00.
Project Files:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
## SYSTEM_TYPE - compiling for 32 or 64 bit architecture
SYSTEM_TYPE = 64
SOURCES += main.cpp \
tcamimage.cpp \
tcamcamera.cpp
HEADERS += \
tcamimage.h \
tcamcamera.h \
fkt_alles_emxutil.h \
fkt_alles_initialize.h \
fkt_alles_terminate.h \
fkt_alles_types.h \
fkt_alles.h \
MWCudaDimUtility.h \
rt_nonfinite.h \
rtGetInf.h \
rtGetNaN.h \
rtwtypes.h
# Cuda sources
CUDA_SOURCES += fkt_alles.cu
CUDA_SOURCES += fkt_alles_emxutil.cu
CUDA_SOURCES += fkt_alles_initialize.cu
CUDA_SOURCES += fkt_alles_terminate.cu
CUDA_SOURCES += MWCudaDimUtility.cu
CUDA_SOURCES += rt_nonfinite.cu
CUDA_SOURCES += rtGetInf.cu
CUDA_SOURCES += rtGetNaN.cu
# Path to cuda toolkit install
CUDA_SDK = /usr/local/cuda-9.0/samples
CUDA_DIR = /usr/local/cuda-9.0
CUDA_DEFINES += /usr/local/cuda-9.0
# Path to header and libs files
INCLUDEPATH += $$CUDA_DIR/include
INCLUDEPATH += $$CUDA_SDK/common/inc
INCLUDEPATH += $$CUDA_SDK/../shared/inc
QMAKE_LIBDIR += $$CUDA_DIR/lib64
QMAKE_LIBDIR += $$CUDA_SDK/common/lib/linux
#CUDA_OBJECTS_DIR = ./
# libs used in your code
LIBS += -lcudart -lcuda
CUDA_LIBS = -lcudart -lcuda
# GPU architecture
CUDA_COMPUTE_ARCH = 62
CUDA_ARCH = sm_62
# Here are some NVCC flags I've always used by default.
NVCCFLAGS = --use_fast_math --ptxas-options=-v
## correctly formats CUDA_DEFINES for nvcc
for(_defines, CUDA_DEFINES):{
formatted_defines += -D$$_defines
}
CUDA_DEFINES = $$formatted_defines
QMAKE_EXTRA_COMPILERS += cuda
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += gstreamer-1.0
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += gstreamer-video-1.0
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += gtk+-3.0
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += gobject-introspection-1.0
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += tcam
LIBS += `pkg-config opencv --libs`
unix: PKGCONFIG += gstreamer-app-1.0
DISTFILES += \
fkt_alles_terminate.cu \
MWCudaDimUtility.cu \
rt_nonfinite.cu \
rtGetInf.cu \
rtGetNaN.cu \
fkt_alles_emxutil.cu \
fkt_alles_initialize.cu \
fkt_alles.cu
#nvcc config
CONFIG(debug, debug|release) {
#Debug settings
CUDA_OBJECTS_DIR = cudaobj/$$SYSTEM_NAME/Debug
cuda_d.input = CUDA_SOURCES
cuda_d.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
cuda_d.commands = $$CUDA_DIR/bin/nvcc -D_DEBUG $$CUDA_DEFINES $$NVCC_OPTIONS $$CUDA_INC $$CUDA_LIBS --machine $$SYSTEM_TYPE $$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda_d.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda_d
}
else {
# Release settings
CUDA_OBJECTS_DIR = cudaobj/$$SYSTEM_NAME/Release
cuda.input = CUDA_SOURCES
cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
cuda.commands = $$CUDA_DIR/bin/nvcc $$CUDA_DEFINES $$NVCC_OPTIONS $$CUDA_INC $$CUDA_LIBS --machine $$SYSTEM_TYPE $$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda
}
## correctly formats CUDA_COMPUTE_ARCH to CUDA_ARCH with code gen flags
## resulting format example: -gencode arch=compute_20,code=sm_20
for(_a, CUDA_COMPUTE_ARCH):{
formatted_arch =$$join(_a,'',' -gencode arch=compute_',',code=sm_$$_a')
CUDA_ARCH += $$formatted_arch
}
The layout for the Project-File is taken from this instruction: https://nidclip.wordpress.com/2014/04/07/setting-up-nvcc-for-cuda-in-qt/. I hope that this is some glaringly obvious mistake that a noob such as myself just doesn’t see, and that somebody can point it out.
not sure if it matters, but I use regular c++ for picture recording via cam, then process said picture via matlab code that was automatically “translated” into c++ and integrated into the project. worked fine when it was just translated to c++, gave me this error when translated into CUDA.
I assume that the designation of the output path might be false, but this point it’s nothing more than a guess.
Thank’s to everybody who makes time to help!