Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

course 09 compile error: nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified #27

Closed
Housz opened this issue Oct 20, 2023 · 2 comments

Comments

@Housz
Copy link

Housz commented Oct 20, 2023

OS: Win11
cmake version 3.26.4
CUDA version 12.1

编译过程:

  1. vcpkg安装openvdb
  2. make:PS D:\Projects\parallel101\course\09\01_texture\08> cmake -B .\build -DCMAKE_TOOLCHAIN_FILE=D:\Projects\parallel101\course\09\01_texture\08\vcpkg\scripts\buildsystems\vcpkg.cmake
    输出:
    `-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
    COMPONENT = openvdb
    -- Found OpenVDB: D:/Projects/parallel101/course/09/01_texture/08/vcpkg/installed/x64-windows/include (found version "10.0.0") found components: openvdb
    -- OpenVDB ABI Version: 10
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - not found
    -- Found Threads: TRUE
    CMake Warning at C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1384 (message):
    New Boost version may have incorrect or missing dependencies and imported
    targets
    Call Stack (most recent call first):
    C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1508 (_Boost_COMPONENT_DEPENDENCIES)
    C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2119 (_Boost_MISSING_DEPENDENCIES)
    vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
    vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
    vcpkg/installed/x64-windows/share/openvdb/FindOpenVDB.cmake:504 (find_package)
    vcpkg/installed/x64-windows/share/openvdb/vcpkg-cmake-wrapper.cmake:10 (_find_package)
    vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
    CMakeLists.txt:16 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1508 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2119 (_Boost_MISSING_DEPENDENCIES)
vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
vcpkg/installed/x64-windows/share/openvdb/FindOpenVDB.cmake:504 (find_package)
vcpkg/installed/x64-windows/share/openvdb/vcpkg-cmake-wrapper.cmake:10 (_find_package)
vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
CMakeLists.txt:16 (find_package)

-- Found Boost: D:/Projects/parallel101/course/09/01_texture/08/vcpkg/installed/x64-windows/include (found version "1.83.0") found components: iostreams regex
-- Found ZLIB: optimized;D:/Projects/parallel101/course/09/01_texture/08/vcpkg/installed/x64-windows/lib/zlib.lib;debug;D:/Projects/parallel101/course/09/01_texture/08/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.3.0")
-- Found OpenVDB 10.0.0 at D:/Projects/parallel101/course/09/01_texture/08/vcpkg/installed/x64-windows/lib/openvdb.lib
-- Configuring done (7.6s)
-- Generating done (0.1s)
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_TOOLCHAIN_FILE

-- Build files have been written to: D:/Projects/parallel101/course/09/01_texture/08/build`

  1. build:PS D:\Projects\parallel101\course\09\01_texture\08> *cmake --build .\build*
    输出:
    `MSBuild version 17.4.3+7e646be43 for .NET Framework
    Checking Build System
    Building Custom Rule D:/Projects/parallel101/course/09/01_texture/08/CMakeLists.txt
    Compiling CUDA source file ..\main.cu...

D:\Projects\parallel101\course\09\01_texture\08\build>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc.exe" --use-local-env -ccbin "C:\Program Files\Microsof
t Visual Studio\2022\Professional\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64" -x cu -ID:\Projects\parallel101\course\09\01_texture\08. -ID:\Projects\parallel101\course\09\01_
texture\08....\include -I"D:\Projects\parallel101\course\09\01_texture\08\vcpkg\installed\x64-windows\include" -I"D:\Projects\parallel101\course\09\01_texture\08\vcpkg\instal
led\x64-windows\include\Imath" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart s
tatic -std=c++17 --generate-code=arch=compute_52,code=[compute_52,sm_52] --extended-lambda --expt-relaxed-constexpr /EHsc -Xcompiler="/EHsc -Ob0 -Zi" -g -D_WINDOWS -DOPENVDB_D
LL -D_WIN32 -DNOMINMAX -DOPENVDB_ABI_VERSION_NUMBER=10 -DOPENVDB_USE_DELAYED_LOADING -DIMATH_DLL -DTBB_USE_DEBUG -D"CMAKE_INTDIR="Debug"" -D_MBCS -DWIN32 -D_WINDOWS -DOPENVDB
_DLL -D_WIN32 -DNOMINMAX -DOPENVDB_ABI_VERSION_NUMBER=10 -DOPENVDB_USE_DELAYED_LOADING -DIMATH_DLL -DTBB_USE_DEBUG -D"CMAKE_INTDIR="Debug"" -Xcompiler "/EHsc /W1 /nologo /Od
/FS /Zi /RTC1 /MDd " -Xcompiler "/Fdmain.dir\Debug\vc143.pdb" -o main.dir\Debug\main.obj "D:\Projects\parallel101\course\09\01_texture\08\main.cu"
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.1.targets(799,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU

Computing Toolkit\CUDA\v12.1\bin\nvcc.exe" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64" -x cu
-ID:\Projects\parallel101\course\09\01_texture\08. -ID:\Projects\parallel101\course\09\01_texture\08....\include -I"D:\Projects\parallel101\course\09\01_texture\08\vcpkg\insta
lled\x64-windows\include" -I"D:\Projects\parallel101\course\09\01_texture\08\vcpkg\installed\x64-windows\include\Imath" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.
1\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -std=c++17 --generate-code=arch=compute_52,code=[compute_52,sm_52] --extended-lambda
--expt-relaxed-constexpr /EHsc -Xcompiler="/EHsc -Ob0 -Zi" -g -D_WINDOWS -DOPENVDB_DLL -D_WIN32 -DNOMINMAX -DOPENVDB_ABI_VERSION_NUMBER=10 -DOPENVDB_USE_DELAYED_LOADING -DIMATH_
DLL -DTBB_USE_DEBUG -D"CMAKE_INTDIR="Debug"" -D_MBCS -DWIN32 -D_WINDOWS -DOPENVDB_DLL -D_WIN32 -DNOMINMAX -DOPENVDB_ABI_VERSION_NUMBER=10 -DOPENVDB_USE_DELAYED_LOADING -DIMATH_
DLL -DTBB_USE_DEBUG -D"CMAKE_INTDIR="Debug"" -Xcompiler "/EHsc /W1 /nologo /Od /FS /Zi /RTC1 /MDd " -Xcompiler "/Fdmain.dir\Debug\vc143.pdb" -o main.dir\Debug\main.obj "D:\Proj
ects\parallel101\course\09\01_texture\08\main.cu"”已退出,返回代码为 1。 [D:\Projects\parallel101\course\09\01_texture\08\build\main.vcxproj]`

谢谢!

@archibate
Copy link
Collaborator

出现这个问题时需要把/EHsc选项改成-EHsc选项,因为nvcc不认识/开头的微软风格参数。我不确定是哪个第三方库里加了这个参数,因为我不用msvc。

@Housz
Copy link
Author

Housz commented Oct 28, 2023

谢谢小彭老师

@Housz Housz closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants