Having trouble building the library onto my windows computer. I have cloned the repository and installed Visual Studio 2019 C++ build tools and Cmake but when I execute
cmake -G “Visual Studio 15 2017” -DBUILD_SHARED_LIBS=ON -Bbuild/default -H.
I get the error:
CMake Error at CMakeLists.txt:3 (project):
Generator
Visual Studio 15 2017
could not find any instance of Visual Studio.
– Configuring incomplete, errors occurred!
I have tried downloading further workloads from Visual Studio (such as MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)), uninstalling and reinstalling everything, and restarting my computer but keep getting the error.
Thank you for the response. However, that command introduced its own error: “Does not match the generator used previously, Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory”. After removing the txt file and directory, I received the original error “could not find any instance of Visual Studio”. See picture below.
Never mind, I just had to install Visual Studio 2017 rather than 2019 and it worked. However, I am now having trouble locally installing the SDK. I am trying to call this command:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/default -H.
in order to install this into my install folder but I get the following error saying it failed to build:
Thanks for the link, I actually followed some steps in the thread and got farther than I was. However, I am running into an issue with CURL. This is the code I have run so far:
git clone https://github.com/mavlink/MAVSDK.git
cd MAVSDK
git checkout develop
git submodule update --init --recursive
cmake -G "Visual Studio 15 2017" -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/default -H.)
cmake --build build/default --target install
At first, the cmake -G command produced the error: Could not find a configuration file for package “CURL” that is compatible with requested version " ". So I edited the CMakeLists.txt file and changed find_package(CURL REQUIRED CONFIG) to find_package(CURL REQUIRED Config) and the code ran without error. However, now the final cmake command is producing a large error with curl wrapper objects. I could not snip all of it but I will add a picture below. Any help would be great.
Hi, I have similar problems
I tried to clean, rebuild but stil having this :
error: patch failed: CMakeLists.txt:148
error: CMakeLists.txt: patch does not apply
error: patch failed: src/lib_json/CMakeLists.txt:69
error: src/lib_json/CMakeLists.txt: patch does not apply
CMakeFiles\jsoncpp.dir\build.make:118: recipe for target ‘jsoncpp/src/jsoncpp-stamp/jsoncpp-patch’ failed.
I don’t know what to try anymore, some ideas ?
Here is the result of the previous command, I do not see errors so it might be ok : Completed ‘curl’
Building Custom Rule C:/Users/rlan-douds-pontarlie/MAVSDK/third_party/curl/CMakeLists.txt
– Looking for pthread.h
– Looking for pthread.h - not found
– Found Threads: TRUE
– Found curl via config file: C:/Users/rlan-douds-pontarlie/MAVSDK/build/default/third_party/install/lib/cmake/CURL
– Found tinyxml2 via config file: C:/Users/rlan-douds-pontarlie/MAVSDK/build/default/third_party/install/lib/cmake/tinyxml2
– Version: 0.28.0-4-g8e2a5815
– Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
– Found JsonCpp: C:/Users/rlan-douds-pontarlie/MAVSDK/build/default/third_party/install/lib/jsoncpp.lib
– Found PythonInterp: C:/Users/rlan-douds-pontarlie/AppData/Local/Programs/Python/Python38-32/python.exe (found version “3.8.3”)
– Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
– BUILD_BACKEND not set: not building grpc backend
– Configuring done
– Generating done
– Build files have been written to: C:/Users/rlan-douds-pontarlie/MAVSDK/build/default
PS C:\Users\rlan-douds-pontarlie\MAVSDK> cmake --build build/default --config Debug
btw, my commands are :
cmake -G “Visual Studio 16 2019” -D BUILD_SHARED_LIBS=OFF -B build/default
then cmake --build build/default --config Debug
and finally cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -D CMAKE_INSTALL_PREFIX=install -B build/default
I do not use -H. because windows don’t recognize it.
Tried same in cmd using -H. but still getting same errors.
I tried to clean but I don’t know the exact command to do it…
C:\Users\rlan-douds-pontarlie\MAVSDK>git rm -rf build/default
fatal: pathspec ‘build/default’ did not match any files
C:\Users\rlan-douds-pontarlie\MAVSDK>rd /s /q build
Le répertoire n’est pas vide.
(The repertory is not empty)
And I deleted and reinstalled it like 10times manually…
[EDIT] Ok, it compiled totally so it’s better but i got a lot of errors during the procedure…
jsoncpp.lib(json_value.obj) : error LNK2038: discordance détectée pour ‘_ITERATOR_DEBUG_LEVEL’ : la valeur ‘0’ ne corre
spond pas à la valeur ‘2’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\src\plugins\mission\mavsdk
_mission.vcxproj]
jsoncpp.lib(json_value.obj) : error LNK2038: discordance détectée pour ‘RuntimeLibrary’ : la valeur ‘MD_DynamicRelease’
ne correspond pas à la valeur ‘MDd_DynamicDebug’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\sr
c\plugins\mission\mavsdk_mission.vcxproj]
jsoncpp.lib(json_reader.obj) : error LNK2038: discordance détectée pour ‘_ITERATOR_DEBUG_LEVEL’ : la valeur ‘0’ ne corr
espond pas à la valeur ‘2’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\src\plugins\mission\mavsd
k_mission.vcxproj]
jsoncpp.lib(json_reader.obj) : error LNK2038: discordance détectée pour ‘RuntimeLibrary’ : la valeur 'MD_DynamicRelease
’ ne correspond pas à la valeur ‘MDd_DynamicDebug’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\s
rc\plugins\mission\mavsdk_mission.vcxproj]
jsoncpp.lib(json_writer.obj) : error LNK2038: discordance détectée pour ‘_ITERATOR_DEBUG_LEVEL’ : la valeur ‘0’ ne corr
espond pas à la valeur ‘2’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\src\plugins\mission\mavsd
k_mission.vcxproj]
jsoncpp.lib(json_writer.obj) : error LNK2038: discordance détectée pour ‘RuntimeLibrary’ : la valeur 'MD_DynamicRelease
’ ne correspond pas à la valeur ‘MDd_DynamicDebug’ in mission.obj [C:\Users\rlan-douds-pontarlie\MAVSDK\build\default\s
rc\plugins\mission\mavsdk_mission.vcxproj]