Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building pyrealsense2 on Windows: Cannot open input file 'realsense2-gl.lib' #13040

Open
mrortach opened this issue Jun 15, 2024 · 9 comments
Open
Labels

Comments

@mrortach
Copy link

Body:
I'm trying to build pyrealsense2 from source on Windows using Visual Studio 2022. I followed the instructions provided in the Intel RealSense GitHub repository.

Here are the steps I took:

  1. Cloned the repository:

git clone https://github.com/IntelRealSense/librealsense.git cd librealsense git checkout v2.54.2

  1. Created and navigated to the build directory:

mkdir build cd build

  1. Ran CMake with the following command:

cmake .. -DFORCE_RSUSB_BACKEND=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE="C:/***/AppData/Local/Programs/Python/Python312/python.exe"

  1. Opened the generated .sln file in Visual Studio 2019 and built the solution using Build > Build Solution.

However, I'm encountering the following errors:

LNK1181: cannot open input file 'realsense2-gl.lib' LNK4199: /DELAYLOAD:realsense2d.dll ignored; no imports found from realsense2d.dll LNK4199: /DELAYLOAD:realsense2-gl.dll ignored; no imports found from realsense2-gl.dll LNK4199: /DELAYLOAD:realsense2.dll ignored; no imports found from realsense2.dll

image

Here is a screenshot of the error list in Visual Studio:

I have confirmed that realsense2.dll and realsense2-gl.dll are present in the C:\Windows\System32\librealsense\build\Release directory.

Additional Configuration:
In Configuration Properties > Linker > General > Additional Library Directories, I have added:

C:\Windows\System32\librealsense\build C:\Windows\System32\librealsense\build\Release

In Configuration Properties > Linker > Input > Additional Dependencies, I have added:

realsense2.lib realsense2-gl.lib

Despite this, the build fails with the errors mentioned above. How can I resolve this issue and successfully build pyrealsense2?

System Information:
OS: Windows 11
Visual Studio 2022
Python 3.12
Any help or suggestions would be greatly appreciated. Thank you!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 15, 2024

Hi @mrortach As you are using Visual Studio, I wonder whether you need to set up linkages to realsense2.dll. If the full RealSense SDK has been installed on Windows using the Intel.RealSense.SDK-WIN10 installer file then the SDK provides three .props property sheet files for doing this. They can be found at C: > Program Files (x86) > Intel RealSense SDK 2.0

image

Once the SDK is installed and you can access the three props files in the SDK folder, the link below has a C++ Visual Studio tutorial shared by a RealSense user for creating a starter project using the props files.

https://github.com/EduardoWang/visual-studio-real-sense-record-and-playback-project

@mrortach
Copy link
Author

I tried to compile pyrealsense2 version 2.54.2.5684 for Python 3.12 using the method you suggested, but it didn't work.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 20, 2024

As the errors reference GL, I wonder whether they are occurring because -DBUILD_GRAPHICAL_EXAMPLES=TRUE is not included in your CMake build instruction. When building librealsense from source, this instruction is required in order to build the SDK with OpenGL graphics support included.

When setting -DBUILD_GRAPHICAL EXAMPLES to True, -DBUILD_EXAMPLES must also be true. So adding these two flags to your CMake build instruction would make it look like this:

cmake .. -DFORCE_RSUSB_BACKEND=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE="C:/***/AppData/Local/Programs/Python/Python312/python.exe" -DBUILD_EXAMPLES=TRUE -DBUILD_GRAPHICAL_EXAMPLES=TRUE

@MartyG-RealSense
Copy link
Collaborator

Another approach to installation may be to install the 2.54.2 SDK without pyrealsense2 by using the Intel.RealSense.SDK-WIN10 installer file and de-selecting the Python wrapper component on the installer's configurartion options so that the Python 3.7 version of the wrapper is not installed.

https://github.com/IntelRealSense/librealsense/releases/tag/v2.54.2

image

Then once the 2.54.2 SDK is installed, build the Python wrapper separately from source code for Python 3.12.

@mrortach
Copy link
Author

I partially did it yesterday, but today I couldn't get it done.

@MartyG-RealSense
Copy link
Collaborator

What errors do you get when building the Python wrapper on Windows separately after the SDK is installed, please?

@MartyG-RealSense
Copy link
Collaborator

Hi @mrortach Do you require further assistance with this case, please? Thanks!

@mrortach
Copy link
Author

I still need help, I haven't tried the last shared things. I'll look as soon as I have time.

@MartyG-RealSense
Copy link
Collaborator

Okay, that's no problem at all. Thanks very much for the update. I look forward to your next report. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants