PlusToolkit / PlusLib

Software library for data acquisition, pre-processing, and calibration for navigated image-guided interventions.
http://www.plustoolkit.org
Other
130 stars 102 forks source link

Cannot compile Plus on Debian 12 (bookworm) Linux #1096

Open benzwick opened 1 year ago

benzwick commented 1 year ago

When I try to compile Plus on Debian 12 (bookworm) Linux I get the following error:

[ 95%] Linking CXX shared module ../../../lib/qml/VTK.9.1/libqmlvtkpluginD.so
Generating qmltypes file using qmlplugindump
QQmlComponent: Component is not ready
make[5]: *** [GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/build.make:150: lib/qml/VTK.9.1/libqmlvtkpluginD.so] Error 3
make[5]: *** Deleting file 'lib/qml/VTK.9.1/libqmlvtkpluginD.so'
make[4]: *** [CMakeFiles/Makefile2:11494: GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/all] Error 2
make[3]: *** [Makefile:136: all] Error 2
make[2]: *** [CMakeFiles/vtk.dir/build.make:98: vtk-prefix/src/vtk-stamp/vtk-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/vtk.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

Maybe it is related to https://gitlab.kitware.com/vtk/vtk/-/issues/18219, https://gitlab.kitware.com/vtk/vtk/-/issues/18714 or https://gitlab.kitware.com/vtk/vtk/-/issues/18964 but I cannot find a solution.

benzwick commented 1 year ago

The results are similar on Ubuntu 22.04.

I've created a GitHub action here to test the compilation of PlusBuild on Ubuntu 22.04: https://github.com/benzwick/PlusBuild/pull/1

This is the output (https://github.com/benzwick/PlusBuild/actions/runs/5359279119/jobs/9722668307?pr=1):

[ 95%] Linking CXX shared module ../../../lib/qml/VTK.9.1/libqmlvtkpluginD.so
Generating qmltypes file using qmlplugindump
QQmlComponent: Component is not ready
make[5]: *** [GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/build.make:150: lib/qml/VTK.9.1/libqmlvtkpluginD.so] Error 3
make[5]: *** Deleting file 'lib/qml/VTK.9.1/libqmlvtkpluginD.so'
make[4]: *** [CMakeFiles/Makefile2:11476: GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/all] Error 2
make[3]: *** [Makefile:136: all] Error 2
make[2]: *** [CMakeFiles/vtk.dir/build.make:98: vtk-prefix/src/vtk-stamp/vtk-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/vtk.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
Error: Process completed with exit code 2
turtleizzy commented 10 months ago

I encountered similar issue on Ubuntu 22.04 and this comment helped.

If anyone came across this on Ubuntu 20.04 using Qt 5 from the distro packages and none of the above helped, you are most likely missing these packages. sudo apt install qml-module-qtquick* fixed it for me.

FYI, on Ubuntu 22.04 qt5-default doesn't exist any longer, this is the actual apt install command I used for successful building.

sudo apt update && sudo apt install git build-essential cmake qtbase5-dev qt5-qmake qtmultimedia5-dev qttools5-dev libqt5xmlpatterns5-dev qtbase5-private-dev libqt5x11extras5-dev libxt-dev qtdeclarative5-dev libqt5webenginewidgets5 qml-module-qtquick\*

lassoan commented 10 months ago

Thank you for the comments and suggestions @turtleizzy and @benzwick.

@Sunderlandkyl when you have the time it would be nice if you could add these to the documentaiton.

adamrankin commented 7 months ago

Documentation added in https://github.com/PlusToolkit/PlusBuild/commit/cc636604201602cebeddda04eb786c3bfcc5769e

aitor-ollo commented 6 months ago

Hello, I am trying to build Plus in Ubuntu 22.04.

Even after using the above mentioned apt install command, I still get the same error in the master branch, it is a clean installation and I followed the documentation step by step (I got a similar result in Ubuntu 20.04):

[ 95%] Linking CXX shared module ../../../lib/qml/VTK.9.1/libqmlvtkpluginD.so
Generating qmltypes file using qmlplugindump
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QQmlComponent: Component is not ready
make[5]: *** [GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/build.make:150: lib/qml/VTK.9.1/libqmlvtkpluginD.so] Error 3
make[5]: *** Deleting file 'lib/qml/VTK.9.1/libqmlvtkpluginD.so'
make[4]: *** [CMakeFiles/Makefile2:11494: GUISupport/QtQuick/qml/CMakeFiles/qmlvtkplugin.dir/all] Error 2
make[3]: *** [Makefile:136: all] Error 2
make[2]: *** [CMakeFiles/vtk.dir/build.make:92: vtk-prefix/src/vtk-stamp/vtk-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/vtk.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

I tried to compile the Plus-2.8 branch, and I don't get any link error at this point.

Thank you!

adamrankin commented 6 months ago

I will try a clean build and confirm

adamrankin commented 6 months ago

Are you able to build the vtk subproject and identify its build error?

I am getting one as well, but I'm not sure if it's specific to my hardware.

turtleizzy commented 6 months ago

I did have a successful de-novo binary build on Ubuntu 22.04 (to be exact, Linux Mint 21.2) following this instruction: https://github.com/PlusToolkit/PlusBuild/blob/master/Docs/BuildInstructionsLinux.md I was using VTK toolkit in the SuperBuild bundle without further configuration. However since I have quite a lot of packages installed, I am not sure whether some random package on my machine happened to be the key to successful build. I think reproducing in a ubuntu 22.04 docker can actually verify if the dependency suffices.

aitor-ollo commented 6 months ago

Are you able to build the vtk subproject and identify its build error?

I am getting one as well, but I'm not sure if it's specific to my hardware.

Thank you for the quick response. I will let you know as soon as I figure out how to build the vtk subproject (I am not really experienced with cmake).

aitor-ollo commented 6 months ago

I did have a successful de-novo binary build on Ubuntu 22.04 (to be exact, Linux Mint 21.2) following this instruction: https://github.com/PlusToolkit/PlusBuild/blob/master/Docs/BuildInstructionsLinux.md I was using VTK toolkit in the SuperBuild bundle without further configuration. However since I have quite a lot of packages installed, I am not sure whether some random package on my machine happened to be the key to successful build. I think reproducing in a ubuntu 22.04 docker can actually verify if the dependency suffices.

I also tried to build it in a new virtual machine with Mint 21.2 following the instructions you mentioned, and I get exactly the same error. To get to this point I had to install OpenGL with sudo apt-get install libgl1-mesa-dev and sudo apt-get install libegl1-mesa-dev.

adamrankin commented 6 months ago

I had to install libglvnd-dev to get a step further, still have an error though

aitor-ollo commented 6 months ago

I tried installing libglvnd-dev, this was enough to avoid installing libgl1-mesa-dev and libegl1-mesa-dev, but then I got the same error as before.

turtleizzy commented 5 months ago

I reproduced building process in ubuntu 22.04 docker. I can confirm installing libglvnd-dev was necessary. Here is my dockerfile.

FROM ubuntu:22.04
ADD PlusBuild-master.zip /
WORKDIR /
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y \
    # Necessary commandline utilities
    unzip git \
    # Here are from the documentation
    build-essential cmake \
    qtbase5-dev qt5-qmake qtmultimedia5-dev qttools5-dev libqt5xmlpatterns5-dev \
    qtbase5-private-dev libqt5x11extras5-dev libxt-dev qtdeclarative5-dev libqt5webenginewidgets5 qml-module-qtquick\* \
    # Here are the additional packages
    libglvnd-dev \
    # Here are some other utilities specific to my network connection
    # you can safely remove proxychains before the make command
    # if you don't need a proxy to clone from github
    proxychains
RUN unzip PlusBuild-master.zip && \
    mv PlusBuild-master PlusBuild && \
    mkdir PlusBuild-bin && \
    cd PlusBuild-bin && \
    cmake ../PlusBuild -DCMAKE_BUILD_TYPE=Release
ADD proxychains.conf /etc/
RUN cd /PlusBuild-bin && \
    proxychains make -j8

PlusBuild-master.zip was the mirror of the current master branch (commit: 2caaeb4).

Note that you can safely remove everything related to proxychains as long as you don't have connectivity issues with github. I didn't wait until the whole building process finished due to connectivity issues but I confirmed the successful building of vtk. I think following the steps in the documentation and installing libglvnd-dev should be sufficient to successfully build vtk 9.1 in the superbuild bundle.

image

Update:

The building process finished successfully with the provided dockerfile. You can try this out.

image

aitor-ollo commented 5 months ago

Thank you @adamrankin and @turtleizzy for your support!

Apart from missing the libglvnd-dev I was executing cmake ../PlusBuild instead of cmake ../PlusBuild -DCMAKE_BUILD_TYPE=Release

I looks like it was trying to link this: Linking CXX shared module ../../../lib/qml/VTK.9.1/libqmlvtkpluginD.so instead of Linking CXX shared module ../../../lib/qml/VTK.9.1/libqmlvtkplugin.so