microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.83k stars 6.3k forks source link

[colmap] Build error #30272

Closed alvin-xu-5745 closed 3 months ago

alvin-xu-5745 commented 1 year ago

Host Environment

To Reproduce

Steps to reproduce the behavior:

./vcpkg install colmap[cuda]:x64-windows

Failure logs stdout-x64-windows.log

install-x64-windows-dbg-out.log

JackBoosY commented 1 year ago
nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
alvin-xu-5745 commented 1 year ago

Any ideas would could be causing that problem?

JackBoosY commented 1 year ago

Maybe help: https://forums.developer.nvidia.com/t/solved-nvcc-fatal-a-single-input-file-is-required-for-a-non-link-phase-when-an-outputfile-is-s/37807

Tobe2d commented 1 year ago

@JonLiu1993 forward me here to help fixing my issue.

everything I try from those links give me similar error:

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: "C:/Program Files/CMake/bin/cmake.exe" --build . --config Debug --target install -- -v -j33
    Working Directory: E:/Ai__Project/nerfstudio/vcpkg/buildtrees/colmap/x64-windows-dbg
    See logs for more information:
      E:\Ai__Project\nerfstudio\vcpkg\buildtrees\colmap\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/colmap/portfile.cmake:60 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

error: building colmap:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+colmap
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?title=[colmap]+Build+error&body=Copy+issue+body+from+E%3A%2FAi__Project%2Fnerfstudio%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

Any help please?

I am on Windows 11 RTX 4090

FrankXie05 commented 1 year ago

@Tobe2d Paths with special characters may cause NVCC to interpret them as multiple files being passed in. Mabye try to modify it to a standardized path and please provide the error log: install-x64-windows-dbg-out.log

Tobe2d commented 1 year ago

Thanks @FrankXie05 for the reply,

Below is the log file:

install-x64-windows-dbg-out.log

FrankXie05 commented 1 year ago

@Tobe2d Could you please try replacing the colmap in your vcpkg\ports directory with mine? I made a patch.

It seems that the upstream did not include when using the macro COLMAP_ADD_CUDA_SOURCES to pass in the header file of cuda https://github.com/colmap/colmap/blob/3.8/cmake/CMakeHelper.cmake#LL89C1-L107C34

colmap.zip

Tobe2d commented 1 year ago

Thanks @FrankXie05 I replaced the zip to colmap in vcpkg\ports I test building colmap and again got this:

error: building colmap:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+colmap
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?title=[colmap]+Build+error&body=Copy+issue+body+from+E%3A%2FAi__Project%2Fnerfstudio%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
FrankXie05 commented 1 year ago

Errror log?

Tobe2d commented 1 year ago

Failure logs

-- Using cached colmap-colmap-30da037ce19bdceb6d239c45342fadb221bdabb2.tar.gz. -- Cleaning sources at E:/nerfstudio/vcpkg/buildtrees/colmap/src/b221bdabb2-a77d7326e5.clean. Use --editable to skip cleaning for the packages you specify. -- Extracting source E:/nerfstudio/vcpkg/downloads/colmap-colmap-30da037ce19bdceb6d239c45342fadb221bdabb2.tar.gz -- Applying patch fix-dependencies.patch -- Applying patch fix-cuda-include.patch -- Using source at E:/nerfstudio/vcpkg/buildtrees/colmap/src/b221bdabb2-a77d7326e5.clean -- Found external ninja('1.11.0'). -- Configuring x64-windows-dbg -- Configuring x64-windows-rel -- Building x64-windows-dbg CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message): Command failed: "C:/Program Files/CMake/bin/cmake.exe" --build . --config Debug --target install -- -v -j33 Working Directory: E:/nerfstudio/vcpkg/buildtrees/colmap/x64-windows-dbg See logs for more information: E:\nerfstudio\vcpkg\buildtrees\colmap\install-x64-windows-dbg-out.log

Call Stack (most recent call first): installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process) installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build) ports/colmap/portfile.cmake:61 (vcpkg_cmake_install) scripts/ports.cmake:147 (include)

cheng-chi commented 1 year ago

Hi @FrankXie05 I encountered similar issue and this is my error log after applying your colmap.zip patch to vcpkg/ports install-x64-windows-dbg-out.log

FrankXie05 commented 1 year ago

I don't see an error in the log file you provided. Could you please provide the console output? @cheng-chi

cheng-chi commented 1 year ago

@FrankXie05 Thanks for the fast reply! The errors are buried a little deep here. You can find them by searchring for nvcc fatal in the file. One example error is:

FAILED: src/CMakeFiles/colmap_cuda.dir/mvs/gpu_mat_ref_image.cu.obj 
C:\PROGRA~1\NVIDIA~2\CUDA\v11.7\bin\nvcc.exe -forward-unknown-to-host-compiler -DBOOST_ALL_DYN_LINK=1 -DCGAL_ENABLED -DCGAL_USE_GMPXX=1 -DCUDA_ENABLED -DEIGEN_INITIALIZE_MATRICES_BY_NAN -DGFLAGS_IS_A_DLL=1 -DGLOG_NO_ABBREVIATED_SEVERITIES -DGL_GLEXT_PROTOTYPES -DGUI_ENABLED -DIMATH_DLL -DOPENEXR_DLL -DOPENGL_ENABLED -DOPENMP_ENABLED -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DWIN32_LEAN_AND_MEAN -D_MWAITXINTRIN_H_INCLUDED -IC:\Users\cchi\vcpkg\buildtrees\colmap\src\b221bdabb2-a77d7326e5.clean\lib -IC:\Users\cchi\vcpkg\buildtrees\colmap\src\b221bdabb2-a77d7326e5.clean\src -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\eigen3 -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\qt5 -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\qt5\QtCore -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\tools\qt5\mkspecs\win32-msvc -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\qt5\QtOpenGL -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\qt5\QtWidgets -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\qt5\QtGui -isystem="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\webp -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\OpenEXR -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\Imath -isystem=C:\Users\cchi\vcpkg\installed\x64-windows\include\GKlib -D_WINDOWS -Xcompiler="/W3 /GR /EHsc" -D_FORCE_INLINES -Wno-deprecated-gpu-targets --use_fast_math --default-stream per-thread -Xptxas=-suppress-stack-size-warning -Xcompiler="-MDd  -Zi -Ob0 -Od /RTC1" -arch=native /EHsc -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -std=c++14 -MD -MT src\CMakeFiles\colmap_cuda.dir\mvs\gpu_mat_ref_image.cu.obj -MF src\CMakeFiles\colmap_cuda.dir\mvs\gpu_mat_ref_image.cu.obj.d -x cu -c C:\Users\cchi\vcpkg\buildtrees\colmap\src\b221bdabb2-a77d7326e5.clean\src\mvs\gpu_mat_ref_image.cu -o src\CMakeFiles\colmap_cuda.dir\mvs\gpu_mat_ref_image.cu.obj -Xcompiler=-Fdsrc\CMakeFiles\colmap_cuda.dir\colmap_cuda.pdb,-FS
nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
cheng-chi commented 1 year ago

@FrankXie05 Here's my console output:

./vcpkg install colmap[cuda]:x64-windows
Computing installation plan...
The following packages will be built and installed:
    colmap[core,cuda]:x64-windows -> 2023-03-12#2
Detecting compiler hash for triplet x64-windows...
Restored 0 package(s) from C:\Users\cchi\AppData\Local\vcpkg\archives in 95.3 us. Use --debug to see more details.
Installing 1/1 colmap:x64-windows...
Building colmap[core,cuda]:x64-windows...
-- Using cached colmap-colmap-30da037ce19bdceb6d239c45342fadb221bdabb2.tar.gz.
-- Cleaning sources at C:/Users/cchi/vcpkg/buildtrees/colmap/src/b221bdabb2-a77d7326e5.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/cchi/vcpkg/downloads/colmap-colmap-30da037ce19bdceb6d239c45342fadb221bdabb2.tar.gz
-- Applying patch fix-dependencies.patch
-- Applying patch fix-cuda-include.patch
-- Using source at C:/Users/cchi/vcpkg/buildtrees/colmap/src/b221bdabb2-a77d7326e5.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows-dbg
-- Configuring x64-windows-rel
-- Building x64-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: C:/Users/cchi/vcpkg/downloads/tools/cmake-3.25.1-windows/cmake-3.25.1-windows-i386/bin/cmake.exe --build . --config Debug --target install -- -v -j25
    Working Directory: C:/Users/cchi/vcpkg/buildtrees/colmap/x64-windows-dbg
    See logs for more information:
      C:\Users\cchi\vcpkg\buildtrees\colmap\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/colmap/portfile.cmake:61 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

error: building colmap:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+colmap
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?title=[colmap]+Build+error&body=Copy+issue+body+from+C%3A%2FUsers%2Fcchi%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
FrankXie05 commented 1 year ago

Could you please provide the file: C:\Users\cchi\vcpkg\buildtrees\colmap\config-x64-windows-dbg-out.log?

cheng-chi commented 1 year ago

@FrankXie05 Here you go! Unfortunately I don't have much experience with vcpkg and windows programming in general. Sorry for not providing all information upfront config-x64-windows-dbg-out.log

bjornpiltz commented 1 year ago

I ran in to this and the problem seems to be the stray /EHsc passed to nvcc (the unquoted one). If I remove it, I can get a single nvcc command to run.

I haven't been able to able to make the project to compile, though. Patching away this line didn't help.

SharkWipf commented 1 year ago

Issue is still present today. Following the steps to install nerfstudio on Windows, after compiling deps for over an hour, the COLMAP steps:

git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install colmap[cuda]:x64-windows

just fail with the same error. --head fails as well. nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified CUDA toolkit 11.8.

install-x64-windows-dbg-out.log

acse-pms122 commented 1 year ago

Hi, I have the same error here. Apparently it has something to do with VSCode and some spaces in the paths

alexmgee commented 1 year ago

Issue is still present today. Following the steps to install nerfstudio on Windows, after compiling deps for over an hour, the COLMAP steps:

git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install colmap[cuda]:x64-windows

just fail with the same error. --head fails as well. nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified CUDA toolkit 11.8.

install-x64-windows-dbg-out.log

I am having this problem now also.

adrien-StGir commented 1 year ago

Hey all, I'm also getting a similar error. Has anyone managed to solve the issue? It's quite frustrating as I'd love to play with nerfstudio :/

error: building colmap:x64-windows failed with: BUILD_FAILED Elapsed time to handle colmap:x64-windows: 59 s Please ensure you're using the latest port files with git pull and vcpkg update. Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+colmap You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?title=[colmap]+Build+error&body=Copy+issue+body+from+C%3A%2FUsers%2Fadrie%2FDocuments%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

SharkWipf commented 1 year ago

For nerfstudio, you may be able to run conda install colmap instead, or download it manually, and then point nerfstudio at the colmap binaries with ns-process-data video --colmap-cmd \path\to\colmap.exe. Another option is to run nerfstudio in WSL2. Then you can just add conda install colmap to your install commands and it should just work.

I have not tested either of these, I ended up installing it on Linux instead.

adrien-StGir commented 1 year ago

conda install colmap Retrieving notices: ...working... done Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

:(

adrien-StGir commented 1 year ago

and even with the --colmap-cmd i get the following error : Could not find COLMAP. Please install COLMAP. See https://colmap.github.io/install.html for installation instructions.

SharkWipf commented 1 year ago

conda install colmap Retrieving notices: ...working... done Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  • colmap

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

:(

My bad, it's a conda-forge package, the correct command is: conda install -c conda-forge colmap

and even with the --colmap-cmd i get the following error : Could not find COLMAP. Please install COLMAP. See https://colmap.github.io/install.html for installation instructions.

You need to actually specify the full path to colmap.exe in the --colmap-cmd. So you first need to have a working colmap through some other method (i.e. conda or manual download), and then you need to point nerfstudio at its location using --colmap-command followed by the path to colmap.exe.

adrien-StGir commented 1 year ago

conda install -c conda-forge colmap -> that worked! thanks so much :D

adrien-StGir commented 1 year ago

Spoke too soon... it runs fine for part of the process and then it errors out with : Number of frames in video: 4698 Number of frames to extract: 314 [22:36:41] πŸŽ‰ Done converting video to images. process_data_utils.py:172 [22:39:12] πŸŽ‰ Done downscaling images. process_data_utils.py:362 ────────────────────────────────────────────── πŸ’€ πŸ’€ πŸ’€ ERROR πŸ’€ πŸ’€ πŸ’€ ─────────────────────────────────────────────── Error running command: colmap -h ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

adrien-StGir commented 1 year ago

Screenshot 2023-07-03 225116 this is the error window that pops up along with it

SharkWipf commented 1 year ago

Ah, yes, welp. I ran into that as well, had it working for like 2 runs and then it broke again. That's when I decided to run it on Linux instead. I have no solution for that. You might have more luck with WSL2.

alexmgee commented 1 year ago

I decided to run it on Linux instead.

I am a total Linux idiot but have set it up before on a virtual machine. Could I run nerfstudio from Linux within a virtual machine?

Would it be possible to install Linux on my machine and dual-boot between Windows 11 and Linux?

SharkWipf commented 1 year ago

I decided to run it on Linux instead.

I am a total Linux idiot but have set it up before on a virtual machine. Could I run nerfstudio from Linux within a virtual machine?

Would it be possible to install Linux on my machine and dual-boot between Windows 11 and Linux?

No, not easily, you need the video card for CUDA, which the VM doesn't get access to. I'd suggest trying WSL2, which is like a Linux virtual machine integrated in Windows, with CUDA support.

alexmgee commented 1 year ago

No, not easily, you need the video card for CUDA, which the VM doesn't get access to. I'd suggest trying WSL2, which is like a Linux virtual machine integrated in Windows, with CUDA support.

Thank you for the response, I appreciate all the help we can get on this issue. Is the dual-boot concept not an option either?

I will look into WSL2... haven't had time yet to try the above methods.

SharkWipf commented 1 year ago

Is the dual-boot concept not an option either?

Dual boot is perfectly fine, though keep in mind you'll have to pre-distribute your disk space between operating systems, and NeRFs can use up a lot of space pretty quickly. I'm up to 500GB on my NeRF folder already.

That said, this is getting pretty off-topic for this issue/repo, and does not lead to a fix for the actual issue, so it might be time to move this elsewhere. The Nerfstudio Discord is a better place for individual support.

Randomblock1 commented 1 year ago

I was able to get nerfstudio working by installing both colmap and mpir from conda-forge. But building it manually from vcpkg still doesn't work.

BinglunWang commented 1 year ago

Issue is still present today. Following the steps to install nerfstudio on Windows, after compiling deps for over an hour, the COLMAP steps:

git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install colmap[cuda]:x64-windows

just fail with the same error. --head fails as well. nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified CUDA toolkit 11.8. install-x64-windows-dbg-out.log

I am having this problem now also.

Hi, have you solved this problem? I have the same log error as you. If yes, may I know how you solve it? Thank you so much in advance

adrien-StGir commented 1 year ago

Sadly I never found a solution and ended up leaving it and using luma.ai and volunga to process my nerfs. :/ Sad to hear it’s still an issue. Any further ideas welcome.

On Wed 23 Aug 2023 at 17:13, Binglun Wang @.***> wrote:

Issue is still present today. Following the steps to install nerfstudio on Windows, after compiling deps for over an hour, the COLMAP steps:

git clone https://github.com/microsoft/vcpkg cd vcpkg bootstrap-vcpkg.bat vcpkg install colmap[cuda]:x64-windows

just fail with the same error. --head fails as well. nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified CUDA toolkit 11.8. install-x64-windows-dbg-out.log https://github.com/microsoft/vcpkg/files/11638228/install-x64-windows-dbg-out.log

I am having this problem now also.

Hi, have you solved this problem? I have the same log error as you. If yes, may I know how you solve it? Thank you so much in advance

β€” Reply to this email directly, view it on GitHub https://github.com/microsoft/vcpkg/issues/30272#issuecomment-1690146611, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBA274S77LUZ3QTDHIJG4ADXWYMYBANCNFSM6AAAAAAV7TH2KM . You are receiving this because you commented.Message ID: @.***>

everydaydigital commented 1 year ago

Hi there - after hours of downloading and building vcpkg on Windows 10 while trying to get nerfstudio to work, I had the same error message:

error: building colmap:x64-windows failed with: BUILD_FAILED

Thankfully, after a bit of tweaking and reading through this post and some other github comments, I was able to get nerfstudio to run smoothly across multiple hard drives, with the following steps. Your mileage may vary but hope these notes help -

  • Install MS VS community 2022 along with desktop development C++ toolkit. (Make sure to uninstall any other versions of VS and VS BuildTools - having multiple versions caused me so many headaches!)

  • Install CUDA 11.8 (make sure to include the Visual Studio Integration Component during CUDA install under Custom>CUDA>Visual Studio Integration)

  • Install CUDNN - download and extract the folder from within the zip to your desktop (this validates correct user file permissions) and then copy and replace all of the folders (bin, include & lib) from the extracted cudnn folder into the CUDA toolkit folder here, replacing all existing files/folders: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

  • To be certain that the file paths were correct during installation, copy the 4 files from the CUDA toolkit extras folder: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\extras\visual_studio_integration\MSBuildExtensions

  • Paste them into the VS plugins directory here, ensuring that the visual studio plugin is now definitely in the correct location: D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations

  • Here I'm using 'D:\Code\nerf-studio\env' as both the name of the env and the storage path of the env files (this lets you choose an install drive other than the default C:).

  • By pointing your conda environment to this vcvarsall.bat file (quotes and all), you can run the cmake build process within the conda command prompt window. conda create --prefix D:\Code\nerf-studio\env -y python=3.8 conda activate D:\Code\nerf-studio\env python -m pip install --upgrade pip pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit cd\ D: cd D:\Code\nerf-studio\ git clone --recursive https://github.com/nvlabs/tiny-cuda-nn cd D:\Code\nerf-studio\tiny-cuda-nn "D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 cmake . -B build cmake --build build --config RelWithDebInfo -j cd D:\Code\nerf-studio\tiny-cuda-nn\bindings\torch python setup.py install pip install nerfstudio conda install -c conda-forge colmap conda install -c conda-forge mpir cd D:\Code\nerf-studio\videos

  • RUN THIS COMMAND to build the training data from 360 video [crop bottom 20% on 30s (3*30=90) video) : ns-process-data video --camera-type equirectangular --images-per-equirect 8 --num-frames-target 90 --crop-factor 0 0.2 0 0 --data D:\Code\nerf-studio\videos\input\test_360-video_50mbps_3840x1920_h.265_remove-grain.mp4 --output-dir D:\Code\nerf-studio\videos\output

  • or image: ns-process-data images --camera-type equirectangular --crop-factor 0 0.2 0 0 --data D:\Code\nerf-studio\images\input --output-dir D:\Code\nerf-studio\images\output

  • At this point, I was able visualize the data with either of these commands: ns-train nerfacto --data D:\Code\nerf-studio\videos\output ns-train nerfacto --data D:\Code\nerf-studio\images\output

  • This took about 1 hour to complete processing the NERF from a 30-second, 360 degree video from an Insta360 ONE X2 Camera using an i9-9700 CPU, with 32GB RAM and an NVIDIA RTX 3070 GPU with 8GB VRAM.

  • After that's done, you can view it again any time with this command: ns-viewer --load-config D:\Code\nerf-studio\videos\outputs\output\nerfacto\2023-09-01_155318\config.yml

  • Exporting a point cloud of the trained data was as easy as: ns-export pointcloud --load-config D:\Code\nerf-studio\videos\outputs\output\nerfacto\2023-09-01_155318\config.yml --output-dir D:\Code\nerf-studio\videos\exports\pcd\ --num-points 1000000 --remove-outliers True --normal-method open3d --use-bounding-box True --bounding-box-min -1 -1 -1 --bounding-box-max 1 1 1

tfwittwer commented 1 year ago

The build error is caused by the /EHsc argument in the nvcc command line. A manual workaround is to edit the build.ninja file and run ninja directly.

SamuelJamesFisher commented 1 year ago

Same issue, Have tried making sure there are no spaces in ANY paths. Cuda, vcpkg, visual studio all have no spaces in their paths.

C:\NVIDIAGPU C:\Tool\vcpkg C:\Tool\VisualStudio

Log. install-x64-windows-dbg-out.log

tfwittwer commented 1 year ago

The issue is not with spaces, but with arguments with slashes - in this case the /EHsc command. This can be deleted from the ninja files. In one case I encountered it was possible to edit the build.ninja file, in other cases I had to edit the rules.ninja file and delete the $FLAGS argument in the nvcc calls. Then run ninja from a Visual Studio Developer Prompt as shown on line 3 of your log.

SamuelJamesFisher commented 1 year ago

Still no luck tried both and a combination of the two. Taken from the Visual Studio Developer Prompt with the command: C:/Tool/VisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe -v -v -j17 install All /EHsc commands were deleted from build.ninja and $FLAGS were deleted from rules .ninja where the exe was nvcc.exe

outputLogNoFlagsInNVCCCalls.txt outputLogNoEHsc.txt outputLogNoEHscAndNoFlags.txt

tfwittwer commented 1 year ago

Which version of Visual Studio and CUDA do you use? I haven't encountered those errors using the latest version of Visual Studio 2022 and CUDA 12.1.

SamuelJamesFisher commented 12 months ago

Visual studio 2019 per colmaps recomendation, cuda 12.2. Have just tried visual studio 2022 latest version and 12.1 same errors.

SamuelJamesFisher commented 11 months ago

Just an update. I gave up on windows, installed a linux os on dual-boot, had colmap working in around an hour. I spent over a week trying to sort this error on windows.

samr commented 10 months ago

I ran in to this and the problem seems to be the stray /EHsc passed to nvcc (the unquoted one). If I remove it, I can get a single nvcc command to run.

I haven't been able to able to make the project to compile, though. Patching away this line didn't help.

I ran into the same exact behavior/issue, but adding the following hack that essentially "escapes" the extra \EHsc fixed it for me.

if(CUDA_ENABLED)
    COLMAP_ADD_LIBRARY(
        NAME colmap_mvs_cuda
        ...
    )
    # Hack for the extra \EHsc that gets added on Windows to the nvcc compile line, which causes the error:
    # "nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified..."
    if(IS_MSVC)
        set_target_properties(colmap_mvs_cuda PROPERTIES COMPILE_OPTIONS -Xcompiler)
    endif()
longhuan2018 commented 9 months ago

It works.

I ran in to this and the problem seems to be the stray passed to nvcc (the unquoted one). If I remove it, I can get a single nvcc command to run./EHsc I haven't been able to able to make the project to compile, though. Patching away this line didn't help.

I ran into the same exact behavior/issue, but adding the following hack that essentially "escapes" the extra \EHsc fixed it for me.

if(CUDA_ENABLED)
    COLMAP_ADD_LIBRARY(
        NAME colmap_mvs_cuda
        ...
    )
    # Hack for the extra \EHsc that gets added on Windows to the nvcc compile line, which causes the error:
    # "nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified..."
    if(IS_MSVC)
        set_target_properties(colmap_mvs_cuda PROPERTIES COMPILE_OPTIONS -Xcompiler)
    endif()

Create new file fix-cuda.patch

diff --git a/src/colmap/mvs/CMakeLists.txt b/src/colmap/mvs/CMakeLists.txt
index a15d3bb5c..952e1e56b 100644
--- a/src/colmap/mvs/CMakeLists.txt
+++ b/src/colmap/mvs/CMakeLists.txt
@@ -90,6 +90,12 @@ if(CUDA_ENABLED)
             CUDA::curand
     )

+    # Hack for the extra \EHsc that gets added on Windows to the nvcc compile line, which causes the error:
+    # "nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified..."
+    if(IS_MSVC)
+        set_target_properties(colmap_mvs_cuda PROPERTIES COMPILE_OPTIONS -Xcompiler)
+    endif()
+
     COLMAP_ADD_TEST(
         NAME gpu_mat_test
         SRCS gpu_mat_test.cu

Modify ports/colmap/portfile.cmake

vcpkg_from_github(
    ......
    PATCHES
        fix-cuda.patch
)
snoutmate commented 7 months ago

For background info - this is caused by IMath and OpenEXR libraries (both dependencies of FreeImage which is dependency of colmap) declaring compile argument '/EHsc' in cmake as INTERFACE_COMPILE_OPTIONS, which is fine for C compiler, but not for CUDA(nvcc). The patch posted by longhuan2018 should work, it is also possible to replace the flag with conditional '$<$<NOT:$>:/EHsc>' so that it still applies to C targets.

Here is a patch for top level CMakeLists.txt i made before stumbling upon this thread:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00337e5..54d543f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,6 +251,17 @@ set_target_properties(
     EXCLUDE_FROM_ALL 1
     EXCLUDE_FROM_DEFAULT_BUILD 1)

+# On Windows, libraries IMath and OpenEXR (both imported via FreeImage lib) 
+# declare parameter '/EHsc' in interface options properties. With CUDA enabled 
+# this however gets also passed to NVCC compiler as a commandline argument
+# causing compile errors, so we need to fix that.
+if(CUDA_ENABLED AND IS_MSVC)
+    foreach(tgt Imath::Imath OpenEXR::Iex OpenEXR::IlmThread OpenEXR::OpenEXRCore OpenEXR::OpenEXR OpenEXR::OpenEXRUtil)
+        get_property(iface_opts TARGET ${tgt} PROPERTY INTERFACE_COMPILE_OPTIONS)
+        string(REPLACE "/EHsc" "\$<\$<NOT:\$<COMPILE_LANGUAGE:CUDA>>:/EHsc>" new_iface_opts "${iface_opts}")
+        set_property(TARGET ${tgt} PROPERTY INTERFACE_COMPILE_OPTIONS ${new_iface_opts})
+    endforeach()
+endif()

 ################################################################################
 # Install and uninstall scripts
TicoCh1 commented 7 months ago

in case anyone's still attempting nerfstudio, i kinda made it work

  1. download a released zip version of colmap from git eg. https://github.com/colmap/colmap/releases/tag/3.9.1
  2. unzip the file, rename the folder as colmap and put it to C:\
  3. by now you should have C:\colmap\bin\colmap.exe
  4. copy everything in C:\colmap\lib to C:\Windows\System32
  5. go to system environment variables and put C:\colmap\bin in the Path
  6. restart
  7. try colmap in cmd, it should work now
alikarami-CM commented 5 months ago

Hi, I have the same error here. Apparently it has something to do with VSCode and some spaces in the paths

if so how did you solve ??