borglab / gtsam

GTSAM is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision, using factor graphs and Bayes networks as the underlying computing paradigm rather than sparse matrices.
http://gtsam.org
Other
2.59k stars 759 forks source link

Running the example on windows #1874

Open Oussamaaat opened 3 days ago

Oussamaaat commented 3 days ago

Description

I get the following error when trying to run the example :

Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34123 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

CameraResectioning.cpp
CameraResectioning.cpp(19): fatal error C1083: Cannot open include file: 'gtsam/config.h': No such file or directory

Steps to reproduce

  1. run cl /EHsc CameraResectioning.cpp in the examples folder in powershell
  2. Here's my folder tree : ├───.github │ ├───ISSUE_TEMPLATE │ ├───scripts │ └───workflows ├───.settings ├───build │ ├───bin │ │ └───Release │ ├───cmake │ │ └───CMakeFiles │ ├───CMakeFiles │ │ ├───009b702aa365ce99b45c4ddf405d7827 │ │ ├───024b76bdf713882b75b3fbd1a0ac6755 │ │ ├───0318edbe23eb9be893232c475b9d031d │ │ ├───0bac22d37e19ed1def93b939d6984b0c │ │ ├───0f1a6388d174a2737ce1777adcc4c812 │ │ ├───224f33dc68691e7e2892d0d711a4e6a1 │ │ ├───2ee9cc0e533aca9c076e698fc8cd519f │ │ ├───3.30.4 │ │ │ ├───CompilerIdC │ │ │ │ ├───Debug │ │ │ │ │ └───CompilerIdC.tlog │ │ │ │ └───tmp │ │ │ ├───CompilerIdCXX │ │ │ │ ├───Debug │ │ │ │ │ └───CompilerIdCXX.tlog │ │ │ │ └───tmp │ │ │ ├───VCTargetsPath │ │ │ │ └───x64 │ │ │ │ └───Debug │ │ │ │ └───VCTargetsPath.tlog │ │ │ └───x64 │ │ │ └───Debug │ │ ├───3458a39990314220d236772c77c8b14a │ │ ├───378e7d2a2a0002cc1956237e531f5d4d │ │ ├───3b40b601a6ef63074ddcec0d50f482aa │ │ ├───411887702e276b175b3f646ce73db9e2 │ │ ├───4834f0a8343ebc9701bec404e2dab4b0 │ │ ├───4fedd56015b94a799d2e3050a031cfb9 │ │ ├───58cb2c47234a55253b864b2321897c67 │ │ ├───5db79b4dc3d35f45ecbfd6b73126aba8 │ │ ├───6535872647f1f80b69f28c0a67b8d125 │ │ ├───77cc8ca66815340ab4607042eca546b9 │ │ ├───79331cbb0d944a09cc64a29f5e9faf48 │ │ ├───8243d3359e0764e0da1cc8ad86087179 │ │ ├───89021a349c2b3b00e0bbad3f3fbdd0e3 │ │ ├───8f524d56e3aa755b48f561bd71f97b77 │ │ ├───94385e383192518afea48c382ec6b26b │ │ ├───9705e90498c2d5c227f32b64e8891ca9 │ │ ├───a111cf6ff36a58725e7e4206a8ce5945 │ │ ├───a26b24a6f0031982ae4c68858f332dfc │ │ ├───a6254b280b03b544efc4207e7042b7cb │ │ ├───ad5407f19d05aea1be214cc646f30654 │ │ ├───b68671162ad3cddeed9d1f9bc73236a6 │ │ ├───b7817b0e3976ff1aded27b9bd7cf3f97 │ │ ├───bbb9c42ab1b6fd35c948e949272c0c45 │ │ ├───bca33e3992f260536cfdae96c55cd539 │ │ ├───bceae929fcd7ccb9ee005c8d987bac47 │ │ ├───be0ad73519467a8133eea51c55ae7941 │ │ ├───c69bdef0acb1a3ce023c65ee659e02e6 │ │ ├───c7b8bd3573213bfdb5c459ea8199d905 │ │ ├───cefbada5b6e7bf88f43f681efa1b7372 │ │ ├───CMakeScratch │ │ ├───d5b758e54895c3d0b306a85178c744c9 │ │ ├───d9bca0636ef81a5c30f68e67716e7257 │ │ ├───de2bfd1672d6e8f984ced8d927a3d250 │ │ ├───de5291c23731950004ab9feeef56a0e6 │ │ ├───ebc90f1d351a06b55abcdc4dff3fe0ba │ │ ├───Export │ │ │ └───df49adab93b9e0c10c64f72458b31971 │ │ ├───f8142c4fa80bf4fc2e47c0d8897f7165 │ │ ├───FindOpenMP │ │ └───pkgRedirects │ ├───CppUnitLite │ │ ├───CMakeFiles │ │ └───CppUnitLite.dir │ │ └───Release │ │ └───CppUnitLite.tlog │ ├───examples │ │ └───CMakeFiles │ ├───gtsam │ │ ├───3rdparty │ │ │ ├───cephes │ │ │ │ ├───cephes-gtsam.dir │ │ │ │ │ └───Release │ │ │ │ │ └───cephes-gtsam.tlog │ │ │ │ └───CMakeFiles │ │ │ ├───ceres │ │ │ │ └───CMakeFiles │ │ │ ├───CMakeFiles │ │ │ └───metis │ │ │ ├───CMakeFiles │ │ │ ├───include │ │ │ │ └───CMakeFiles │ │ │ └───libmetis │ │ │ ├───CMakeFiles │ │ │ └───metis-gtsam.dir │ │ │ └───Release │ │ │ ├───metis-gtsam.tlog │ │ │ └─── │ │ │ └───GKlib │ │ ├───base │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───basis │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───CMakeFiles │ │ ├───discrete │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───geometry │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───gtsam.dir │ │ │ └───Release │ │ │ └───gtsam.tlog │ │ ├───hybrid │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───inference │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───linear │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───navigation │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───nonlinear │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───sam │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───sfm │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ ├───slam │ │ │ ├───CMakeFiles │ │ │ └───tests │ │ │ └───CMakeFiles │ │ └───symbolic │ │ ├───CMakeFiles │ │ └───tests │ │ └───CMakeFiles │ ├───lib │ │ └───Release │ ├───matlab │ │ ├───CMakeFiles │ │ └───gtsam_matlab_wrapper.dir │ │ └───Release │ │ └───gtsam_ma.FC1F87BA.tlog │ ├───tests │ │ └───CMakeFiles │ ├───timing │ │ └───CMakeFiles │ ├───wrap │ │ ├───cmake │ │ ├───CMakeFiles │ │ ├───gtsam │ │ │ ├───+gtsam │ │ │ │ ├───+GncGaussNewtonParams │ │ │ │ ├───+GncLMParams │ │ │ │ ├───+GraphvizFormatting │ │ │ │ ├───+gtsfm │ │ │ │ ├───+imuBias │ │ │ │ ├───+ISAM2Params │ │ │ │ ├───+lago │ │ │ │ ├───+noiseModel │ │ │ │ │ └───+mEstimator │ │ │ │ ├───+Ordering │ │ │ │ ├───+symbol_shorthand │ │ │ │ ├───+TriangulationResult │ │ │ │ └───+utilities │ │ │ └───+gtsamnoiseModelmEstimator │ │ │ └───+Base │ │ └───gtsam_mex │ │ └───Release │ └───x64 │ └───Release │ ├───ALL_BUILD │ │ └───ALL_BUILD.tlog │ └───ZERO_CHECK │ └───ZERO_CHECK.tlog ├───cmake │ ├───example_cmake_find_gtsam │ └───obsolete ├───containers │ └───gtsam-vnc ├───CppUnitLite ├───doc │ ├───Code │ ├───images │ └───Mathematica ├───examples │ ├───.vscode │ └───Data │ └───Balbianello ├───gtsam │ ├───3rdparty │ │ ├───CCOLAMD │ │ │ ├───Demo │ │ │ ├───Doc │ │ │ ├───Include │ │ │ ├───Lib │ │ │ ├───MATLAB │ │ │ └───Source │ │ ├───cephes │ │ │ └───cephes │ │ ├───ceres │ │ ├───Eigen │ │ │ ├───.gitlab │ │ │ │ ├───issue_templates │ │ │ │ └───merge_request_templates │ │ │ ├───bench │ │ │ │ ├───btl │ │ │ │ │ ├───actions │ │ │ │ │ ├───cmake │ │ │ │ │ ├───data │ │ │ │ │ ├───generic_bench │ │ │ │ │ │ ├───init │ │ │ │ │ │ ├───static │ │ │ │ │ │ ├───timers │ │ │ │ │ │ └───utils │ │ │ │ │ └───libs │ │ │ │ │ ├───BLAS │ │ │ │ │ ├───blaze │ │ │ │ │ ├───blitz │ │ │ │ │ ├───eigen2 │ │ │ │ │ ├───eigen3 │ │ │ │ │ ├───gmm │ │ │ │ │ ├───mtl4 │ │ │ │ │ ├───STL │ │ │ │ │ ├───tensors │ │ │ │ │ ├───tvmet │ │ │ │ │ └───ublas │ │ │ │ ├───perf_monitoring │ │ │ │ │ └───resources │ │ │ │ ├───spbench │ │ │ │ └───tensors │ │ │ ├───blas │ │ │ │ ├───f2c │ │ │ │ ├───fortran │ │ │ │ └───testing │ │ │ ├───ci │ │ │ ├───cmake │ │ │ ├───debug │ │ │ │ ├───gdb │ │ │ │ └───msvc │ │ │ ├───demos │ │ │ │ ├───mandelbrot │ │ │ │ ├───mix_eigen_and_c │ │ │ │ └───opengl │ │ │ ├───doc │ │ │ │ ├───examples │ │ │ │ ├───snippets │ │ │ │ └───special_examples │ │ │ ├───Eigen │ │ │ │ └───src │ │ │ │ ├───Cholesky │ │ │ │ ├───CholmodSupport │ │ │ │ ├───Core │ │ │ │ │ ├───arch │ │ │ │ │ │ ├───AltiVec │ │ │ │ │ │ ├───AVX │ │ │ │ │ │ ├───AVX512 │ │ │ │ │ │ ├───CUDA │ │ │ │ │ │ ├───Default │ │ │ │ │ │ ├───GPU │ │ │ │ │ │ ├───HIP │ │ │ │ │ │ │ └───hcc │ │ │ │ │ │ ├───MSA │ │ │ │ │ │ ├───NEON │ │ │ │ │ │ ├───SSE │ │ │ │ │ │ ├───SVE │ │ │ │ │ │ ├───SYCL │ │ │ │ │ │ └───ZVector │ │ │ │ │ ├───functors │ │ │ │ │ ├───products │ │ │ │ │ └───util │ │ │ │ ├───Eigenvalues │ │ │ │ ├───Geometry │ │ │ │ │ └───arch │ │ │ │ ├───Householder │ │ │ │ ├───IterativeLinearSolvers │ │ │ │ ├───Jacobi │ │ │ │ ├───KLUSupport │ │ │ │ ├───LU │ │ │ │ │ └───arch │ │ │ │ ├───MetisSupport │ │ │ │ ├───misc │ │ │ │ ├───OrderingMethods │ │ │ │ ├───PardisoSupport │ │ │ │ ├───PaStiXSupport │ │ │ │ ├───plugins │ │ │ │ ├───QR │ │ │ │ ├───SparseCholesky │ │ │ │ ├───SparseCore │ │ │ │ ├───SparseLU │ │ │ │ ├───SparseQR │ │ │ │ ├───SPQRSupport │ │ │ │ ├───StlSupport │ │ │ │ ├───SuperLUSupport │ │ │ │ ├───SVD │ │ │ │ └───UmfPackSupport │ │ │ ├───failtest │ │ │ ├───lapack │ │ │ ├───scripts │ │ │ ├───test │ │ │ └───unsupported │ │ │ ├───bench │ │ │ ├───doc │ │ │ │ ├───examples │ │ │ │ │ └───SYCL │ │ │ │ └───snippets │ │ │ ├───Eigen │ │ │ │ ├───CXX11 │ │ │ │ │ └───src │ │ │ │ │ ├───Tensor │ │ │ │ │ ├───TensorSymmetry │ │ │ │ │ │ └───util │ │ │ │ │ ├───ThreadPool │ │ │ │ │ └───util │ │ │ │ └───src │ │ │ │ ├───AutoDiff │ │ │ │ ├───BVH │ │ │ │ ├───Eigenvalues │ │ │ │ ├───EulerAngles │ │ │ │ ├───FFT │ │ │ │ ├───IterativeSolvers │ │ │ │ ├───KroneckerProduct │ │ │ │ ├───LevenbergMarquardt │ │ │ │ ├───MatrixFunctions │ │ │ │ ├───MoreVectorization │ │ │ │ ├───NonLinearOptimization │ │ │ │ ├───NumericalDiff │ │ │ │ ├───Polynomials │ │ │ │ ├───Skyline │ │ │ │ ├───SparseExtra │ │ │ │ ├───SpecialFunctions │ │ │ │ │ └───arch │ │ │ │ │ ├───AVX │ │ │ │ │ ├───AVX512 │ │ │ │ │ ├───GPU │ │ │ │ │ └───NEON │ │ │ │ └───Splines │ │ │ └───test │ │ ├───GeographicLib │ │ │ ├───cmake │ │ │ ├───doc │ │ │ ├───dotnet │ │ │ │ ├───examples │ │ │ │ │ ├───CS │ │ │ │ │ ├───ManagedCPP │ │ │ │ │ └───VB │ │ │ │ ├───NETGeographicLib │ │ │ │ └───Projections │ │ │ │ └───Properties │ │ │ ├───examples │ │ │ ├───include │ │ │ │ └───GeographicLib │ │ │ ├───java │ │ │ │ ├───direct │ │ │ │ │ └───src │ │ │ │ │ └───main │ │ │ │ │ └───java │ │ │ │ ├───inverse │ │ │ │ │ └───src │ │ │ │ │ └───main │ │ │ │ │ └───java │ │ │ │ ├───planimeter │ │ │ │ │ └───src │ │ │ │ │ └───main │ │ │ │ │ └───java │ │ │ │ └───src │ │ │ │ ├───main │ │ │ │ │ └───java │ │ │ │ │ └───net │ │ │ │ │ └───sf │ │ │ │ │ └───geographiclib │ │ │ │ └───test │ │ │ │ └───java │ │ │ │ └───net │ │ │ │ └───sf │ │ │ │ └───geographiclib │ │ │ ├───js │ │ │ │ ├───doc │ │ │ │ ├───samples │ │ │ │ ├───src │ │ │ │ └───test │ │ │ ├───legacy │ │ │ │ ├───C │ │ │ │ └───Fortran │ │ │ ├───m4 │ │ │ ├───man │ │ │ ├───matlab │ │ │ │ ├───geographiclib │ │ │ │ │ └───private │ │ │ │ └───geographiclib-legacy │ │ │ ├───maxima │ │ │ ├───python │ │ │ │ ├───doc │ │ │ │ └───geographiclib │ │ │ │ └───test │ │ │ ├───src │ │ │ ├───tools │ │ │ ├───windows │ │ │ └───wrapper │ │ │ ├───C │ │ │ ├───js │ │ │ ├───matlab │ │ │ └───python │ │ ├───metis │ │ │ ├───GKlib │ │ │ │ ├───conf │ │ │ │ └───test │ │ │ ├───graphs │ │ │ ├───include │ │ │ ├───libmetis │ │ │ ├───manual │ │ │ └───programs │ │ ├───Spectra │ │ │ ├───contrib │ │ │ ├───LinAlg │ │ │ ├───MatOp │ │ │ │ └───internal │ │ │ └───Util │ │ └───SuiteSparse_config │ │ └───xerbla │ ├───base │ │ ├───tests │ │ └───treeTraversal │ ├───basis │ │ └───tests │ ├───discrete │ │ └───tests │ │ └───data │ │ ├───FG │ │ └───UAI │ ├───geometry │ │ └───tests │ ├───hybrid │ │ └───tests │ ├───inference │ │ └───tests │ ├───linear │ │ └───tests │ ├───navigation │ │ └───tests │ ├───nonlinear │ │ ├───internal │ │ └───tests │ ├───sam │ │ └───tests │ ├───sfm │ │ └───tests │ ├───slam │ │ └───tests │ └───symbolic │ └───tests ├───gtsam_unstable │ ├───base │ │ └───tests │ ├───discrete │ │ ├───examples │ │ └───tests │ ├───dynamics │ │ └───tests │ ├───examples │ ├───geometry │ │ └───tests │ ├───linear │ │ └───tests │ ├───nonlinear │ │ └───tests │ ├───partition │ │ └───tests │ ├───slam │ │ ├───doc │ │ └───tests │ ├───testing_tools │ │ ├───base │ │ └───inference │ └───timing ├───matlab │ ├───+gtsam │ ├───gtsam_examples │ ├───gtsam_tests │ └───unstable_examples │ └───+imuSimulator │ └───+lib ├───python │ ├───gtsam │ │ ├───examples │ │ ├───notebooks │ │ ├───preamble │ │ ├───specializations │ │ ├───tests │ │ └───utils │ └───gtsam_unstable │ ├───examples │ ├───specializations │ └───tests ├───tests ├───timing └───wrap ├───.github │ └───workflows ├───cmake ├───docs │ └───parser ├───gtwrap │ ├───interface_parser │ │ └───pycache │ ├───matlab_wrapper │ │ └───pycache__ │ ├───template_instantiator │ │ └───pycache │ └───pycache ├───pybind11 │ ├───.github │ │ ├───ISSUE_TEMPLATE │ │ ├───matchers │ │ └───workflows │ ├───docs │ │ ├───advanced │ │ │ ├───cast │ │ │ └───pycpp │ │ ├───cmake │ │ └───_static │ │ └───css │ ├───include │ │ └───pybind11 │ │ ├───detail │ │ ├───eigen │ │ └───stl │ ├───pybind11 │ ├───tests │ │ ├───extra_python_package │ │ ├───extra_setuptools │ │ ├───test_cmake_build │ │ │ ├───installed_embed │ │ │ ├───installed_function │ │ │ ├───installed_target │ │ │ ├───subdirectory_embed │ │ │ ├───subdirectory_function │ │ │ └───subdirectory_target │ │ └───test_embed │ └───tools ├───scripts ├───sphinx ├───templates ├───tests │ ├───actual │ ├───expected │ │ ├───matlab │ │ │ ├───+gtsam │ │ │ │ ├───+MCU │ │ │ │ └───+OptimizerGaussNewtonParams │ │ │ ├───+ns1 │ │ │ ├───+ns2 │ │ │ │ └───+ns3 │ │ │ └───+Pet │ │ ├───python │ │ └───xml │ └───fixtures └───utilities

Expected behavior

I expect it to generate a .exe file

Environment

Windows 10, last version of gtsam built with visual studio 2022

Thanks in advance !

varunagrawal commented 3 days ago

I am not familiar with cl. Any reason you are not using CMake and then building the examples via the documented process? It seems like in your process, the linker doesn't know the path to the GTSAM files for compilation.

Oussamaaat commented 3 days ago

Thank you for your answer !

My goal is to know if i compiled succesfully and enabling matlab wrapper, but i'm not familiar with building c++ apps.. I tried using the steps provided with the visual studio GUI but i failed.. so i used the following steps which seems to build without any errors but i have to check :

I installed boost cmake tbb and mkl

then :

git clone https://github.com/borglab/gtsam.git
cd gtsam
mkdir build
cd build 

cmake .. -DCMAKE_BUILD_TYPE=Release -DGTSAM_BUILD_UNSTABLE:OPTION=OFF DGTSAM_INSTALL_MATLAB_TOOLBOX:OPTION=ON -G "Visual Studio 17 2022" -A x64

cmake --build . --config Release
cmake --install . --config Release 

Then the command i mentioned before to run the example

Thank you for your time

varunagrawal commented 3 days ago

After the above steps, you should be able to run

cl examples/CameraResectioning

which is generated as an executable in the build directory.

varunagrawal commented 3 days ago

Note: You may have to add the correct extension, e.g. cl examples/CameraResectioning.exe.

Oussamaaat commented 2 days ago

I still have the same issue, i think it's related to the paths of the different .h files but i'm not sure how to solve it, for example : when i 1st run i get fatal error C1083 'gtsam/config.h' : No such file or directory which is the relative path in the 19th of CameraResectioning.cpp, when i change this path to #include "../build/gtsam/config.h" he finds the confing.h but not symbol.h so i changed the 20th line to #include "../gtsam/inference/symbol.h" but then he cant find the Testable.h file even if i added a #include "../gtsam/base/Testable.h" which seems very werid..

can you please tell me where the CameraResectioning.cpp, config.h and Tetable.h for examlple should be located after building and installing so i'll make sure i'm running in the correct folders with the correct include paths ?

Thanks again

Oussamaaat commented 2 days ago

I don't know if it is related but i found out that several dependencies were not found on my machine when trying to use gtsam_wrapper.mexw64 with matlab :

image