# Cannot Open libQt6OpenGLWidgets.so.6

**URL:** <https://discourse.vtk.org/t/cannot-open-libqt6openglwidgets-so-6/13047>\
**Category:** Development\
**Created:** [January 10, 2024, 8:49pm UTC](https://discourse.vtk.org/t/cannot-open-libqt6openglwidgets-so-6/13047 "2024-01-10T20:49:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [January 10, 2024, 8:49pm UTC](https://discourse.vtk.org/t/cannot-open-libqt6openglwidgets-so-6/13047/1 "2024-01-10T20:49:07Z")

</div>

If the message: “error while loading shared libraries: libQt6OpenGLWidgets.so.6: cannot open shared object file: No such file or directory” pops should I reinstall qt? Even if this directory is there…

Thank you

I search qt like this:

```
  set(qt_components Core Gui Widgets)
  if(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)
    list(APPEND qt_components OpenGLWidgets)
  endif()
  
  
  list(SORT qt_components)
  # We have ui files, so this will also bring in the macro:
  # qt5_wrap_ui or qt_wrap_ui from Widgets.
  find_package(Qt6 QUIET
    REQUIRED COMPONENTS ${qt_components} OpenGLWidgets Core Gui Widgets
  )
  
  foreach(_qt_comp IN LISTS qt_components)
    list(APPEND qt_modules "Qt${VTK_QT_VERSION}::${_qt_comp}")
  endforeach()

```

The file is defenitely there:

![image](https://discourse.vtk.org/uploads/default/original/2X/3/3fe1e25af361d6010581e1ef64f0503ff2508be9.png)

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [January 11, 2024, 10:39am UTC](https://discourse.vtk.org/t/cannot-open-libqt6openglwidgets-so-6/13047/2 "2024-01-11T10:39:30Z")

</div>

Hello,

I think `find_package(Qt6 ...)` should be placed before any reference to Qt configuration is made.

take care,

Paulo
