@Gerd Thank you for these build instructions! Though I only found this post AFTER figuring out the problem. My CUDA code stopped working after upgrading Qt and some other libraries. I was getting invalid symbol and invalid texture errors at runtime, not linking errors. So it took days to track this down. How did you find this?
#since qt5.9 they use /Zc:rvalueCast- /Zc:inline- in the msvc-mkspecs
# we have to switch that off!!
# else linking __device__ __managed__ vars wont work correctly (in release mode only)
QMAKE_CUFLAGS = $$replace(QMAKE_CUFLAGS, -Zc:inline, )
Do you think it makes sense to report this change as a bug in qmake? It's easy to work around and I doubt they'd revert it, but it's a frustrating invisible change that breaks things.
Here is the change that broke it:
https://code.qt.io/cgit/qt/qtbase.git/commit/mkspecs/common/msvc-version.conf?h=5.9&id=255d291efd5ed3e193a6340055c35887f687f0ca
To fix the problem and make the build consistent between Qt 5.8 and newer, I added this to my general configuration:
equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 9):*msvc* {
QMAKE_CXXFLAGS += -Zc:rvalueCast
QMAKE_CXXFLAGS += -Zc:referenceBinding
# Need to unset this for CUDA code
QMAKE_CXXFLAGS += -Zc:inline
}
and this to just the library that uses CUDA:
*msvc* {
# Fix symbols and textures removed from library
# https://forum.qt.io/post/584959
QMAKE_CXXFLAGS -= -Zc:inline
QMAKE_CXXFLAGS += -Zc:inline-
}