Assimp compilation errors Win10 + Visual studio 2017 community - assimp

I can't get assimp compiled on my laptop (Windows 10, Visual studio 2017 community). Everything compiles nice on my work PC.
I just clone repo:
git clone https://github.com/assimp/assimp.git
cd assimp
mkdir build
cd build
cmake ..
here out of cmake command
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Shared libraries enabled
-- Looking for DirectX...
-- DirectX_PREFIX_PATH changed.
-- Could not locate DirectX
-- Looking for ZLIB...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate ZLIB
-- compiling zlib from souces
CMake Deprecation Warning at contrib/zlib/CMakeLists.txt:8 (cmake_policy):
The OLD behavior for policy CMP0048 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.
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find rt (missing: RT_LIBRARY)
-- Enabled formats: AMF 3DS AC ASE ASSBIN ASSXML B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
-- Disabled formats:
-- Could NOT find IL (missing: IL_LIBRARIES IL_INCLUDE_DIR)
CMake Warning at CMakeLists.txt:439 (MESSAGE):
Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: Qt5 DevIL
-- Configuring done
-- Generating done
-- Build files have been written to:
this makes solution for my Visual studio, which I'm trying to build using Build All menu. I get following errors:
Severity Code Description Project File Line Suppression State
Error C2065 'AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE': undeclared identifier assimp
Error (active) E0020 identifier "AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY" is undefined assimp
Error C2065 'AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY': undeclared identifier assimp
But if I try to navigate to this define - Intellisense allow me to do this. I see this defines. What am I doing wrong, please help?

Related

cmake . -B build - Compiling Neural Graphic Primitives

I trying compile NGP but after cmake . -B build I get this lines:
I've installed
Visual Studio 2019
CUDA Toolkit 11.6
CMake 3.22
Python 3.10
Optix 7.6
C:\NGP\instant-ngp>cmake . -B build
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30147.0
-- The CXX compiler identification is MSVC 19.29.30147.0
-- The CUDA compiler identification is NVIDIA 11.6.124
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- **Obtained CUDA architectures automatically from installed GPUs**
**CMake Error: The source directory "SOURCES/CMakeFiles/CMakeTmp" does not exist.**
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error at dependencies/tiny-cuda-nn/CMakeLists.txt:107 (try_run):
Failed to configure test project build system.
Call Stack (most recent call first):
dependencies/tiny-cuda-nn/CMakeLists.txt:146 (TCNN_AUTODETECT_CUDA_ARCHITECTURES)
-- Configuring incomplete, errors occurred!
See also "C:/NGP/instant-ngp/build/CMakeFiles/CMakeOutput.log".
I am not coder I just want to try NERF. It ss possible download somewhere compiled NGP or it doesn't work that way?
EDIT: Noticed that OP is using the -S flag implicitly the issue seems to be elsewhere, hence the updated answer:
UPDATED ANSWER
Please bare in mind that with the limited information at my disposal. This is again only a wild guess, based on what I tried.
After re-examining the output of CMake I've noticed that the issue is within one of the dependencies i.e.
CMake Error at dependencies/tiny-cuda-nn/CMakeLists.txt:107 (try_run):
I was not able to completely replicate the problem, however I do believe I know how to debug these issues. My wild guess here is that either:
The individual dependencies were incorrectly pulled or
The CMake files were poorly generated due to some issue and you didn't clean them.
I would recommend trying the following:
Delete the build folder, and run cmake -S. -Bbuild again. And if that fails you can try the second option.
Remove the git repository (folder called instant-ngp) and clone it again using exactly this command:
git clone --recursive https://github.com/nvlabs/instant-ngp
Please note that the --recursive option is very important due to the fact that you need to pull the dependant repositories as well.
Now if all of that fails. You still have one more option and that is to go to the folder dependencies/tiny-cuda-nn/ and generate the CMake files yourself, however I do not recommend that due to the fact that if you have limited experience you may not know what exactly to do.
I've also checked the variables you wanted to set, and you may do that by running this in Powershell
$Env:CMAKE_CUDA_ARCHITECTURES=YOUR_VALUE_HERE (in my case it is 75 because I have a RTX2080). However bare in mind that
You shouldn't need it, because the architecture is discovered for you
You need to delete the build folder in order to clean up the cached CMake files
Hope it helps!

How to use cmake on windows with vs2019 and custom installed llvm?

I found someone mentioned to use such command line to use cmake with vs2019 and llvm toolset:
cmake -G "Visual Studio 2019" -T ClangCL
However, this would use the llvm version, which is 11.0 for now, was installed by the visual studio instanller.
I want to use a new version, thus 12.0, of llvm which I already installed somewhere else but I don't know how to make cmake and vs to use that.
UPDATE:
What I tried to set the compiler via command line:
E:\my_proj>cmake -G "Visual Studio 16 2019" -A x64 -T "ClangCL" -DCMAKE_C_COMPILER="C:\Program Files\LLVM\bin\clang.exe" -DCMAKE_CXX_COMPILER="C:\Program Files\LLVM\bin\clang++.exe" .
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- The C compiler identification is Clang 11.0.0 with MSVC-like command-line
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
As you could see the cmake picked the clang from the vs installed location and ignored the command line.
As described below, setting CMAKE flags explicitly has no effect when using VS generator. Thus choosing the default compiler installed by Visual Studio installer.
The VS generator produces .vcxproj files and uses MSBuild to actually
drive the build. The values of CMAKE_{C,CXX}_COMPILER are computed
automatically from the compiler MSBuild chooses so setting them has no
effect.

Can't tell cmake to use vcpkg for library link

I'm using a Cmake for a cross-platform project that use glibmm. Under Linux, the project build successfully without any problem (and works fine when executed).
But with Windows 10, Visual Studio 2019 (pro), I can't find how to build the project. I installed glibmm with vcpkg ("vcpkg install glibmm:x64-windows" and "vcpkg install glibmm:x86-windows")
I add to my cmake command the parameter -DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake
In the main CMakeLists.txt file, the following lines do not do their job.
find_package(PkgConfig REQUIRED)
pkg_check_modules(glibmm REQUIRED glibmm-2.4)
cmake -S D:\MachDrivetoolkit\libMachDrive -DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DPKG_CONFIG_EXECUTABLE:STRING="D:\vcpkg\downloads\tools\msys2\c809757c94447846\mingw32\bin\pkg-config.exe" -B D:\MachDrivetoolkit\libMachDriveVS
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.28.29334.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: D:\vcpkg\downloads\tools\msys2\c809757c94447846\mingw32\bin\pkg-config.exe (found version "0.29.2")
-- Checking for module 'glibmm-2.4'
-- No package 'glibmm-2.4' found
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:545 (message):
A required package was not found
Call Stack (most recent call first):
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:733 (_pkg_check_modules_internal)
libipc/CMakeLists.txt:37 (pkg_check_modules)
Then I modify the name of the glibmm library in the script to match the name of the installed file
find_package(PkgConfig REQUIRED)
pkg_check_modules(glibmm REQUIRED glibmm)
but it fail the same.
What parameters or what instruction should I use to link glibmm to my project ?

How to build a library using cmake in windows

I've tried to build a library (called libiec61850) using cmake in windows. I have installed cmake and configured the "path" environment with the directory where I have installed the cmake. Then,
1-I created a subfolder called "build" in my library's directory
2- I copy the subfolder directory in the command line and type
cmake -G "Visual Studio 14 2015" and got many errors as follows:
- la génération a démarré
- echec de la build
- Cmakeoutput.log : "The system is: Windows - 6.1.7601 - AMD64"
See the attached file.
Please, you help will be precious.error_cmake_windows
I just looked up the library and tried it out myself, and I got it to work.
I normally use NMake to compile Visual Studios programs. If you'd like to use the same, you need to make sure that the MSVC environment is set up properly before using it. I normally run vcvarsall.bat in cmd first like so:
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
You could do the same wherever your vcvarsall.bat file is in your Visual Studio 2015 folders (I used Visual Studio 2017, but it should work fine with Visual Studio 2015 as well).
Next, these were the commands that I used and their respective outputs:
D:\Users\patrick\src\vs2017>cd libiec61850
D:\Users\patrick\src\vs2017\libiec61850>mkdir build
D:\Users\patrick\src\vs2017\libiec61850>cd build
D:\Users\patrick\src\vs2017\libiec61850\build>cmake .. -G "NMake Makefiles"
-- The C compiler identification is MSVC 19.11.25547.0
-- The CXX compiler identification is MSVC 19.11.25547.0
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503
/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503
/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.255
03/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.255
03/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
server-example-logging: sqlite not found
-- Generating RC file : D:/Users/patrick/src/vs2017/libiec61850/build/src/version.rc
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Users/patrick/src/vs2017/libiec61850/build
D:\Users\patrick\src\vs2017\libiec61850\build>nmake
Microsoft (R) Program Maintenance Utility Version 14.11.25547.0
Copyright (C) Microsoft Corporation. All rights reserved.
Scanning dependencies of target iec61850
[ 0%] Building CXX object src/CMakeFiles/iec61850.dir/common/string_map.c.obj
string_map.c
It then continued compiling.
Try all of that out. If you make a build directory, you probably need to 'cd' into it, and then run cmake with a '..' to indicate that the CMakeLists.txt directory is one directory up. Let me know if you can't use NMake or if it doesn't work.

find_package(PCL 1.2 REQUIRED) using CMake returns wrong path

I'm using an Ubuntu 12.04 machine and I have the following problem:
I'm trying to compile and build a C++ file using CMake, but when I give the command "make" after "cmake .." I get the error:
pcl_openni_grabber.cpp:2:29: fatal error: pcl/point_cloud.h: No such file or directory
compilation terminated.
Now my CMakeLists.txt it's the following:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(pcl-openni-grabber)
find_package(PCL 1.2 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (pcl_openni_grabber pcl_openni_grabber.cpp)
target_link_libraries (pcl_openni_grabber ${PCL_LIBRARIES})
where the environment variable PCL_INCLUDE_DIRS contains:
/usr/include/pcl-1.5
Now after 2 hours of work to understand the problem, I found it in the command find_package(). In practice when I run "cmake .." it returns the wrong path to the libraries of pcl (point cloud library). Indeed this is the output of "cmake ..":
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'eigen3'
-- found eigen3, version 3.0.5
-- Found eigen: /usr/include/eigen3
-- Boost version: 1.46.1
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- checking for module 'flann'
-- found flann, version 1.7.1
-- Found Flann: /opt/ros/fuerte/lib/libflann_cpp_s.a
-- checking for module 'openni-dev'
-- found openni-dev, version 1.5.2.23~precise
-- Found openni: /usr/lib/libOpenNI.so
-- Found libusb-1.0: /usr/include
-- Found qhull: /usr/lib/libqhull.so
-- looking for PCL_COMMON
-- Found PCL_COMMON: /opt/ros/fuerte/lib/libpcl_common.so
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /opt/ros/fuerte/lib/libpcl_kdtree.so
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /opt/ros/fuerte/lib/libpcl_octree.so
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /opt/ros/fuerte/lib/libpcl_search.so
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /opt/ros/fuerte/lib/libpcl_sample_consensus.so
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /opt/ros/fuerte/lib/libpcl_filters.so
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /opt/ros/fuerte/lib/libpcl_tracking.so
-- looking for PCL_IO
-- Found PCL_IO: /opt/ros/fuerte/lib/libpcl_io.so
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /opt/ros/fuerte/lib/libpcl_features.so
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /opt/ros/fuerte/lib/libpcl_registration.so
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /opt/ros/fuerte/lib/libpcl_segmentation.so
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /opt/ros/fuerte/lib/libpcl_surface.so
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /opt/ros/fuerte/lib/libpcl_visualization.so
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /opt/ros/fuerte/lib/libpcl_keypoints.so
-- Found PCL: /usr/lib/libboost_system-mt.so;/usr/lib/libboost_filesystem-mt.so;/usr/lib/libboost_thread-mt.so;pthread;/usr/lib/libboost_date_time-mt.so;/usr/lib/libboost_iostreams-mt.so;optimized;/opt/ros/fuerte/lib/libpcl_common.so;debug;/opt/ros/fuerte/lib/libpcl_common.so;optimized;/opt/ros/fuerte/lib/libflann_cpp_s.a;debug;/opt/ros/fuerte/lib/libflann_cpp_s-gd.a;optimized;/opt/ros/fuerte/lib/libpcl_kdtree.so;debug;/opt/ros/fuerte/lib/libpcl_kdtree.so;optimized;/opt/ros/fuerte/lib/libpcl_octree.so;debug;/opt/ros/fuerte/lib/libpcl_octree.so;optimized;/opt/ros/fuerte/lib/libpcl_search.so;debug;/opt/ros/fuerte/lib/libpcl_search.so;optimized;/opt/ros/fuerte/lib/libpcl_sample_consensus.so;debug;/opt/ros/fuerte/lib/libpcl_sample_consensus.so;optimized;/opt/ros/fuerte/lib/libpcl_filters.so;debug;/opt/ros/fuerte/lib/libpcl_filters.so;optimized;/opt/ros/fuerte/lib/libpcl_tracking.so;debug;/opt/ros/fuerte/lib/libpcl_tracking.so;/usr/lib/libOpenNI.so;vtkCommon;vtkRendering;vtkHybrid;optimized;/opt/ros/fuerte/lib/libpcl_io.so;debug;/opt/ros/fuerte/lib/libpcl_io.so;optimized;/opt/ros/fuerte/lib/libpcl_features.so;debug;/opt/ros/fuerte/lib/libpcl_features.so;optimized;/opt/ros/fuerte/lib/libpcl_registration.so;debug;/opt/ros/fuerte/lib/libpcl_registration.so;optimized;/opt/ros/fuerte/lib/libpcl_segmentation.so;debug;/opt/ros/fuerte/lib/libpcl_segmentation.so;optimized;/usr/lib/libqhull.so;debug;/usr/lib/libqhull.so;optimized;/opt/ros/fuerte/lib/libpcl_surface.so;debug;/opt/ros/fuerte/lib/libpcl_surface.so;optimized;/opt/ros/fuerte/lib/libpcl_visualization.so;debug;/opt/ros/fuerte/lib/libpcl_visualization.so;optimized;/opt/ros/fuerte/lib/libpcl_keypoints.so;debug;/opt/ros/fuerte/lib/libpcl_keypoints.so (Required is at least version "1.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jacopo/dev/university/prova/build
As you can see, it returns the path to the pcl library of a particular package of ros (Robot Operating System) which is installed via Synaptic Package Manager on "/opt/ros" directory. The right pcl library and includes are in "/usr/include/pcl.1.5" and "/usr/lib".
When uninstalling ros, find_package returns the right paths and I'm be able to compile and build without problems. But since I need ros for university and at the same time I need cmake, how can I have cmake working having ros installed? Any idea?
You can fine-tune the search path in the find_package command:
find_package(PCL 1.2 REQUIRED PATHS /usr NO_DEFAULT_PATH)
This might be a bit brute-force; you could maybe find a better way to exclude /opt from consideration when CMake searches for the package.
As an aside, you probably shouldn't use link_directories. The documentation indicates why it's not usually needed.