Open hirenpatel1207 opened 2 months ago
Hi @hirenpatel1207, can you try to see if this branch helps you build on Windows https://github.com/ouster-lidar/ouster-sdk/pull/608
The changes in the PR above were merged into master, so if you use: https://codeload.github.com/ouster-lidar/ouster-sdk/zip/refs/heads/master it should work.
@matthew-lidar I was able to build the master branch. Thanks. However the build directly generates the example executables. By that way, I would have to import the ouster-sdk source code into my project and then build it together, which is not a great idea for versioning and keeping sdk's seperate. Is it possible to pre-built the sdk seperately and generate the .h, .lib and .dll s and then use them?
Usually what one would do is build the CMake package, then install
it using a command like so run from your build directory:
cmake --install . --config x64-Release
If you used Visual studio, there's probably also a way to trigger this, but I was unable to find documentation saying specifically how.
This will copy the .h .lib and .dll files to a central directory and enable other CMake projects, such as your's to find_package
it.
Then do something like the following in your project's CMake and it will automatically find and include those files:
project(your_project)
cmake_minimum_required(VERSION 3.10)
find_package(OusterSDK REQUIRED)
add_executable(your_project main.cpp)
target_link_libraries(your_project OusterSDK::ouster_client)
set_property(TARGET your_project PROPERTY CXX_STANDARD 14)
Do you mean this option in VS? install.zip
With that option, I was able to generate the header files and ouster_client.lib, ouster_osf.lib, ouster_pcap.lib, and ouster_viz.lib files (see the attached install.zip folder). But there are no dlls. Also I tried to use these header and .lib files in a QT project .pro file but I am getting the following error: I think something related to networking stuff is not getting generated in the install step.
Do you mean this option in VS? install.zip
With that option, I was able to generate the header files and ouster_client.lib, ouster_osf.lib, ouster_pcap.lib, and ouster_viz.lib files (see the attached install.zip folder). But there are no dlls. Also I tried to use these header and .lib files in a QT project .pro file but I am getting the following error: I think something related to networking stuff is not getting generated in the install step.
EDIT: I was able to solve the problem by including "-lws2_32". The build is successfull. But during runtime, i am getting "write access violation", I think it has something to do with the spdlog. The program crashes at line-> ouster::sensor::init_logger("info"); Here is the minimalistic example that I am trying:
Yeah, that looks to have done it. Currently the SDK is only built statically, so you will not find any .dlls generated, only .libs.
As for the crash, do you have the full stacktrace?
Got it. My "Hello World" sample program runs now. I had linked wrong .libs from vcpkg. Thanks for the help.
Sorry for going back and forth on opening this issue as I was not sure on whether to open a new issue or keep this one. The build is successfully but the release library version has some problem I think. For e.g. if i run the client_example.exe of the debug version, it works fine. But the same client_example.exe of release version does not work. The method sensor::poll_client(*handle); returns value "0". What does Timed-out state actually mean?
On Windows you need to make sure you link debug builds of your program with debug builds of the SDK (and release builds with release builds) for things to work correctly generally. I would check to make sure that is occurring.
Timeout means that no packets were received in the timeout provided to the poll_client
function. The default is 1 second.
Yes, I was getting problems with my programs during the release build. Then I had gone back to check if the release version demos work or not. I have tried the demos with no modifications. I had just followed the guide line in the docs to build the package. I had checkout vcpkg 2024.04.26(git checkout 2024.04.26) so that correct libraray versions are linked.
Describe your question Building the sdk from source from C++ throws error in compilation.
Screenshots
Platform (please complete the following information):
Goal: Use the C++ sdk to build an application in Windows to capture and store the Lidar data (without using ros2). I followed the instructions given at https://static.ouster.dev/sdk-docs/cpp/building.html . In the last step it is metioned to open https://github.com/ouster-lidar/ouster-sdk/archive/refs/tags/20240703.zip in Visual studio and build the project. But I am getting errors linkage errors. Is it possible to get prebuilt binaries for Windows platform?