Error occurs when compiling OptiX SDK 3.9 with CMake - visual-studio

I'm using Win10-x64.
I install Visual Studio 2010, CUDA 7.5, OptiX SDK 3.9.0 and CMake 3.5 in order.
Then I follow the INSTALL-WIN.txt in OptiX/SDK/ and try to compile the samples. I press configure, then:
CMake Error at CMake/FindOptiX.cmake:75 (message):
optix library not found. Please locate before proceeding.
Call Stack (most recent call first):
CMake/FindOptiX.cmake:84 (OptiX_report_error)
CMakeLists.txt:189 (find_package)
Then I copy /../lib64/* to /../lib/* and /../bin64/* to /../bin/*
Error above seem to be fixed but new ERROR:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cufft_LIBRARY (ADVANCED)
linked by target "ocean" in directory C:/ProgramData/NVIDIA Corporation/OptiX SDK 3.9.0/SDK/ocean
I try CMake3.0 and get the same result.

Three month ago, OptiX 3.9 was released. ALL 32-bit support has been removed.
If you compile the file with 32-bit compiler, CMake will report this error.
The INSTALL-WIN.txt document in the \SDK directory is updated, and it reminds user to compile with 64-bit compiler. Just choose the compiler with the "win64" suffix.
win64 compiler

Related

cmake can't find visual studio When using Ninja although it is installed and cygwin also installed

i have cygwin in path and visual studio also
i like to build VS project for "Visual Studio 16 2019" host=x64 as this is what is installed .
i project is using Ninja and have to generate the project like this :
cmake -G "Ninja" ..
CMake Deprecation Warning at CMakeLists.txt:16 (cmake_policy):
The OLD behavior for policy CMP0046 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: C:/cygwin64/bin/cc
-- Check for working C compiler: C:/cygwin64/bin/cc -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/cygwin64/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Dev/my/a/build2/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MICROS~1/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_19d3d && ninja: fatal: CreateProcess: Access is denied.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
-- Configuring incomplete, errors occurred!

The MinGW gfortran compiler is not able to compile a simple test program

Following this post, I'm trying to compile Elmer FEM on Windows using the MinGW compilers. However when running the
cmake -DCMAKE_C_COMPILER=C:\\MinGW\\bin\\gcc.exe -DCMAKE_CXX_COMPILER=C:\\MinGW\\bin\\g++.exe -DCMAKE_Fortran_COMPILER=C:\\MinGW\\bin\\gfortran.exe ..
command in the build folder I get the error:
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.18363.
-- The Fortran compiler identification is unknown
-- Check for working Fortran compiler: C:\MinGW\bin\gfortran.exe
-- Check for working Fortran compiler: C:\MinGW\bin\gfortran.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestFortranCompiler.cmake:45 (message):
The Fortran compiler
"C:\MinGW\bin\gfortran.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/foobar/Desktop/elmer/elmerfem/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTC_8d573 &&
Microsoft Visual Studio 2017 Version 15.0.28010.2050.
Copyright (C) Microsoft Corp. All rights reserved.
Some errors occurred during migration. For more information, see the migration report:
C:\Users\foobar\Desktop\elmer\elmerfem\build\CMakeFiles\CMakeTmp\UpgradeLog.htm
Invalid project
from here I tried adding the
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
to the CmakeLists.txt file, running the cmd as admin from here, and from here tried uninstalling (from Chocolatey) and re-installing MinGW from the original website with no avail. I would appreciate it if you could help me know what is the problem and how I can solve it.
P.S. To solve the above issue one shoudl use the command:
cmake -DCMAKE_C_COMPILER=C:/MinGW/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/MinGW/bin/g++.exe -DCMAKE_Fortran_COMPILER=C:/MinGW/bin/gfortran.exe -DCMAKE_MAKE_PROGRAM=C:/MinGW/bin/mingw32-make.exe .. -G "MinGW Makefiles"
But then there is the missing BLAS issue. I'm trying to solve. this using MSYS2
To build Elmer on Windows, you need MSYS as you pointed out (the Visual Studio error about an invalid project is because an Intel Fortran Visual Studio project was generated when running in cmd.exe but the Intel Fortran Visual Studio extension is not installed). Use pacman to install Elmer's MSYS dependencies: cmake, openblas, qt5, qwt-qt5, and nsis (as of commit 442ea2000f87). See this script for all the commands required to install these dependencies. You can also run that script in MSYS to install all the required dependencies, build Elmer, and create a local Elmer install directory with executable Elmer binaries.

compiling YCM for vim under cygwin windows with visual studio and cmake

So,
I'm trying to compile YouCompleteMe plugin for vim in windows using visual studio as documented. The current cmake that ships with cygwin doesn't have a generator for visual studio so I installed the official cmake through an installer and copied all the nessecary files into cygwin's bin folder including the share folder in the cygwin folder in order for it to work.
When I do cmake --version it displays cmake version 3.4.1 correctly and it seems to be working. However when I use the following command I'm getting a few errors:
cmake -G "Visual Studio 12 2013 Win64" . ..\third_party\ycmd\cpp
This command is the one I should be using to compile YCM under windows as stated in the docs. (without c autocomplete because I can't compile LLVM correctly under cygwin)
However it seems that it doesn't pick up the right compiler nor the right python version. I'm getting the following error:
Your C++ compiler does NOT support C++11, compiling in c++03 mode.
CMake Error at C:/cygwin64/share/cmake3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "2.6")
Call Stack (most recent call first):
C:/cygwin64/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/cygwin64/share/cmake-3.4/Modules/FindPythonLibs.cmake:264 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
BoostParts/CMakeLists.txt:30 (find_package)
--Configuring incomplete, errors occured!
See also: "C:/cygwin64/home/Hylke/.vim/bundle/YouCompleteMe/build/CMakeFiles/CMakeOutput.log".
Does anybody know of an easier way to get YCM working under cygwin? Aren't there some pre-compiled versions out there that I may use?
Or... Could someone point me into the right direction on how to compile it correctly using visual studio 2013 community 64 bits.
I've already tried using this command to fix the compiler issue:
cmake -G "Visual Studio 12 2013 Win64" -D CMAKE_C_COMPILER="/usr/bin/gcc.exe" -D CMAKE_CXX_COMPILER="/usr/bin/g++.exe" . ../third_party/ycmd/cpp
But that seems to give the same output.

CMake unable to find my Windows installation of wxWidgets

I've tried to link wxWidgets 3.0.2 to my C++ project but CMake can't seem to find it.
The wxWidgets that I'm trying to get CMake to find is from wxMSW-Setup-3.0.2.exe
This is the error it gives me:
-- Building for: Visual Studio 12 2013
CMake Error at D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find wxWidgets (missing: wxWidgets_FOUND)
Call Stack (most recent call first):
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindwxWidgets.cmake:871 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:66 (find_package)
-- Configuring incomplete, errors occurred!
CMakeLists.txt:66 refers to this line:
find_package(wxWidgets REQUIRED core base)
I've tried changing the CMake generator, and running set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.0.2"), both of which didn't fix the problem.
CMake is version 3.3.1.
I think cmake used environement variable to find wxwidgets. You have to set wxDir or wxWin variable to C:/wxWidgets-3.0.2
Use find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net) instead of find_package(wxWidgets REQUIRED COMPONENTS core base). And when you build the wxWidgets https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW, use build the static libraries instead of dynamic libraries, I fixed it by using these two steps.

Boost installation on windows, libraries missing

I am trying to build boost. I followed the instructions here. I create a folder C:\Boost which contains include and libs and I add it to my enviroment path. However, when I tried to build another project with cMake I am getting:
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1106 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Boost/include/boost-1_55
The following Boost libraries could not be found:
boost_system
boost_filesystem
boost_signals
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:88 (find_package)
Any idea about those missing libs?
It's a bad thing to start an answer with a question, but I do it nevertheless:
First, am I right in assuming that you've set an environment variable BOOST_ROOT pointing to C:\Boost? (Simply adding it to the path might not be sufficient here.)
Second, which CMake generator are you running? Visual Studio, Makefile, ninja?
I've head a similar problem recently that was connected to the generator that I was actually using. More precisely, I was trying to create a Ninja project from within cmake-gui and got almost the same error message. However, I was able to create a Visual Studio project in cmake-gui project without problem.
When looking a little closer at the command output for the Ninja case I found the following two lines at the very beginning:
The C compiler identification is unknown
The CXX compiler identification is unknown
This hints at the actual problem. While it is clear which compiler will be in use for Visual Studio (9, 10, 11, ...), cmake cannot infer a default compiler for Ninja because it is a generic build system that runs with different compilers. In the end boost wasn't found because the compiler is unknown.
A simple solution was to open the Developer Command Prompt for the Visual Studio version that you want to run with. When you create the project in this "extended" command prompt CMake will be able to infer the correct compiler. Alternatively, you can set the CMAKE_CXX_COMPILER and CMAKE_C_COMPILER flags when running cmake.
cmake -G "Ninja" <path/to/CMakeLists.txt>
cmake -G "Ninja" <path/to/CMakeLists.txt> -DCMAKE_CXX_COMPILER="path/to/cxx/compiler" -CMAKE_C_COMPILER="path/to/c/compiler"

Resources