CMake: Additional checks would ease installing
Closed this issue · 2 comments
The usual invocation of cmake
doesn't check all dependencies needed to compile Ginkgo CADx. Thus on rather minimal systems cmake
frequently terminates successfully but make
fails due to missing dependencies.
Affected components plus error messages of make
in order of appearance after cmake
had completed successfully:
Cairo
[ 0%] Building CXX object cadxcore/CMakeFiles/CADxCore.dir/api/icontexto.cpp.o
/usr/local/peter/Tests/GinkgoCADx/Projekt/ginkgocadx/cadxcore/api/icontexto.cpp:28:25: fatal error: cairo/cairo.h: No such file or directory
compilation terminated.
cadxcore/CMakeFiles/CADxCore.dir/build.make:86: recipe for target 'cadxcore/CMakeFiles/CADxCore.dir/api/icontexto.cpp.o' failed
make[2]: *** [cadxcore/CMakeFiles/CADxCore.dir/api/icontexto.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:118: recipe for target 'cadxcore/CMakeFiles/CADxCore.dir/all' failed
make[1]: *** [cadxcore/CMakeFiles/CADxCore.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
GTK2
Rather for the record as cmake
does throw a warning -------GTK2 NOT FOUND----------
and just doesn't fail. So a failure of make
takes places only when that warning is ignored and a user is relying on the usual -- Build files have been written to: ...
instead.
[ 92%] Building CXX object cadxcore/CMakeFiles/CADxCore.dir/VTKInria3D/wxVTK/wxVTKRenderWindowInteractor.cpp.o
/usr/local/peter/Tests/GinkgoCADx/Projekt/ginkgocadx/cadxcore/VTKInria3D/wxVTK/wxVTKRenderWindowInteractor.cpp:139:22: fatal error: gdk/gdkx.h: No such file or directory
compilation terminated.
cadxcore/CMakeFiles/CADxCore.dir/build.make:9062: recipe for target 'cadxcore/CMakeFiles/CADxCore.dir/VTKInria3D/wxVTK/wxVTKRenderWindowInteractor.cpp.o' failed
make[2]: *** [cadxcore/CMakeFiles/CADxCore.dir/VTKInria3D/wxVTK/wxVTKRenderWindowInteractor.cpp.o] Error 1
CMakeFiles/Makefile2:118: recipe for target 'cadxcore/CMakeFiles/CADxCore.dir/all' failed
make[1]: *** [cadxcore/CMakeFiles/CADxCore.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
GLU
[ 99%] Built target visualizator
Scanning dependencies of target ginkgocadx
[100%] Building CXX object ginkgocadx/CMakeFiles/ginkgocadx.dir/main.cpp.o
make[2]: *** No rule to make target '/usr/lib64/libGLU.so', needed by 'ginkgocadx/ginkgocadx'. Stop.
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:174: recipe for target 'ginkgocadx/CMakeFiles/ginkgocadx.dir/all' failed
make[1]: *** [ginkgocadx/CMakeFiles/ginkgocadx.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Python 2.7
[ 99%] Built target visualizator
Scanning dependencies of target ginkgocadx
[100%] Building CXX object ginkgocadx/CMakeFiles/ginkgocadx.dir/main.cpp.o
make[2]: *** No rule to make target '/usr/lib/libpython2.7.so', needed by 'ginkgocadx/ginkgocadx'. Stop.
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:174: recipe for target 'ginkgocadx/CMakeFiles/ginkgocadx.dir/all' failed
make[1]: *** [ginkgocadx/CMakeFiles/ginkgocadx.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
TCP Wrapper
[ 99%] Built target visualizator
Scanning dependencies of target ginkgocadx
[100%] Building CXX object ginkgocadx/CMakeFiles/ginkgocadx.dir/main.cpp.o
[100%] Linking CXX executable ginkgocadx
/usr/bin/ld: cannot find -lwrap
/usr/bin/ld: cannot find -lwrap
collect2: error: ld returned 1 exit status
ginkgocadx/CMakeFiles/ginkgocadx.dir/build.make:328: recipe for target 'ginkgocadx/ginkgocadx' failed
make[2]: *** [ginkgocadx/ginkgocadx] Error 1
CMakeFiles/Makefile2:174: recipe for target 'ginkgocadx/CMakeFiles/ginkgocadx.dir/all' failed
make[1]: *** [ginkgocadx/CMakeFiles/ginkgocadx.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
WebKit GTK
[100%] Linking CXX executable ginkgocadx
../cadxcore/libCADxCore.a(incomingdicomassociationcommand.cpp.o): In function `GADAPI::PACS::IncomingDicomAssociationCommand::storeSCP(T_ASC_Association*, T_DIMSE_Message*, unsigned char, OFCondition*)':
incomingdicomassociationcommand.cpp:(.text+0x3253): warning: the use of `tempnam' is dangerous, better use `mkstemp'
/usr/bin/ld: warning: libwebkitgtk-1.0.so.0, needed by /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libwx_gtk2u_webview-3.0.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libhdf5.so.10, needed by /opt/vtk6/lib/libvtkxdmf2.so.1, may conflict with libhdf5.so.100
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libwx_gtk2u_webview-3.0.so: undefined reference to `webkit_web_view_can_redo'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libwx_gtk2u_webview-3.0.so: undefined reference to `webkit_web_back_forward_list_add_item'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libwx_gtk2u_webview-3.0.so: undefined reference to `webkit_web_view_new'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/libwx_gtk2u_webview-3.0.so: undefined reference to `webkit_web_view_get_back_forward_list'
[...]
collect2: error: ld returned 1 exit status
ginkgocadx/CMakeFiles/ginkgocadx.dir/build.make:328: recipe for target 'ginkgocadx/ginkgocadx' failed
make[2]: *** [ginkgocadx/ginkgocadx] Error 1
CMakeFiles/Makefile2:174: recipe for target 'ginkgocadx/CMakeFiles/ginkgocadx.dir/all' failed
make[1]: *** [ginkgocadx/CMakeFiles/ginkgocadx.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I'm not too familiar with CMake and can't tell for sure that's it's technically feasible to detect those missing pieces. But if so I think it would ease installing Ginkgo CADx a lot if CMake displayed corresponding warnings.
Seen compiling a8819b7 on Arch Linux and Debian testing.
I will add the check that are needed, it is already on my mental backlog, but so far I was mostly concerned about that it builds properly on Debian sid.
I'm surprised to see Python 2.7 and _WebKit GTK_though because both are not used directly by Ginkgo.
Actually, regarding webkit, there is currently a discussion about this within the corresponding
bug 786986 .
FYI, the packages that are apparently needed on Debian are listed in its control file (I'm not sure why libgdcm-tools is there though),
I've added tests for cairo, gtk2, and libcurl.
As for the others:
- tcpwrapper is not directly used and it seems it is not really needed for linking so I removed the link reference (I think DCMTK is linked against it, but doesn't expose its interface, so it is not needed when linking Ginkgo).
- WebKitGTK is not needed, i.e. neither in my Gentoo installation nor in Debian sid Ginkgo is linked against it. In fact libwx_gtk2u_webview-3.0.so is not even available when building Ginkgo on Debian, because the according package libwxgtk-webview3.0-dev is not required to build it, and hence it s not listed in the build dependencies. If it fails on your setup, then there is something wrong with the wx-config setup.
- Python 2.7 and GLU are pulled in by VTK, but are also not really required. At least on Debian the libvtk6-dev package pulls in the python-vtk6 package which in turn pulls in python2.7, and also libglu-dev is pulled in.
On Gentoo one would have to remove python/GLU after building VTK to get a (broken) setup where these libraries are pulled in by VTK but not available, and Gentoo is the same setup you would get when you were building all the dependencies manually. In summary, if Python and libGLU were missing on your system, but VTK requires them, then the according vtk6 devel package doesn't handle its dependencies properly. Technically, it is a bug in VTK because it should not expose these internal dependencies, but thats a completely different story and related to the bug you reported in the Debian BTS Debian 826050.
Hope that clarifies things a bit,
best, Gert