Open kloczek opened 3 years ago
Which version of gtk-doc are you using?
cmake -DCMAKE_INSTALL_PREFIX="/usr/local" -DGTKDOC_ENABLED=ON "/usr/src/build/libinstpatch-1.1.5" ... -- gtkdoc-mktmpl not found
gtkdoc-tmpl was removed from gtk-doc v1.26 over four years ago (August 11, 2017) so with newer versions of gtk-doc, building of the GTK document will not even be attemtpted from a Mafkefile generated from cmake generated configuration of libinstpatch v1.1.6
The maintainers of libinstpatch should either fix this or remove the option as well as checking for other obsolete code features.
The maintainers of libinstpatch should either fix this or remove the option as well as checking for other obsolete code features
I don't know anything about gtk-doc. Removing it seems not like a good option. But I'd welcome a PR for fixing it!
I made a mistake when writing my comment above. When I was doing the build and got the message about "gtkdoc-mktmpl not found" I thought I had updated my configuration to build v1.1.6 but was in fact building v1.1.5. (I had changed the version to build on one machine and forgotten to copy it over to the one where I was doing the building).
So I did in fact get the same error as reported by kloczek on trying to build v1.1.6 with GTKDOC_ENABLED=ON.
Sorry for the confusion.
Now I nothing about gtk-doc but tried changing the CMakeList in docs/reference. As instpatch-1.0 does not exist in the docs/reference directory (nor is created) I thought it might have been an typographical error and changed it to "DEPENDS ../../libinstpatch-1.0.pc" since that file does exist. However this resulted in numerous errors so that was not the magic "simple" solution.
Generating libinstpatch.signals
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for modules 'glib-2.0;gobject-2.0'
-- Found glib-2.0, version 2.62.6
-- Found gobject-2.0, version 2.62.6
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_PREFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_SUFFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_PREFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_SUFFIXES
-- Executing gtkdoc-scangobj with:
-- CFLAGS: '-I/usr/src/build/libinstpatch-1.1.6' '-I/usr/include/glib-2.0' '-I/usr/lib64/glib-2.0/include'
-- LDFLAGS: '-L/usr/src/build/libinstpatch-1.1.6/build/docs/reference/../../libinstpatch' '-linstpatch-1.0' '-lgobject-2.0' '-lglib-2.0'
-- LDPATH: /lib64:/lib:/usr/lib64:/usr/lib:/usr/local/lib64:/usr/local/lib:/usr/src/build/libinstpatch-1.1.6/build/docs/reference/../../libinstpatch
libinstpatch-scan.c: In function ‘main’:
l ibinstpatch-scan.c:267:3: warning: implicit declaration of function ‘ipatch_init’; did you mean ‘g_value_init’? [-Wimplicit-function-declaration]
ipatch_init();
^~~~~~~~~~~
g_value_init
-- Scan succeeded.
make[2]: *** [docs/reference/CMakeFiles/doc-libinstpatch.dir/build.make:128: docs/reference/ l ibinstpatch.signals] Error 1
My suggrestion would be to remove the option if you do not have somebody who know how to maintain the gtk-doc documentation generation, or as you indicate that you are not happy with that, just put a warning in the README that this feature is broken and should not be enabled, until some future time when it does get fixed and the waring can be removed.
Which version of gtk-doc are you using?
1.33.2
On an openSUSE 15.3
cmake --version
cmake version 3.19.6
Building libinstpatch v1.16 with cmake option -DGTKDOC_ENABLED=ON
(no mention of check for gtkdoc-mktmpl)
Gtk-Doc API reference: yes
[ 96%] Generating dir.stamp, .
make[2]: *** No rule to make target 'docs/reference/instpatch-1.0', needed by 'docs/reference/html.stamp'. Stop.
make[1]: *** [CMakeFiles/Makefile2:311: docs/reference/CMakeFiles/doc-libinstpatch.dir/all] Error 2
make: *** [Makefile:171: all] Error 2
Building swami v2.2.2 fwith cmake option "-DGTKDOC_ENABLED=ON
-- gtkdoc-mktmpl not found
Gtk-Doc API reference: no
so ttherefore does not even try to build any gtk-documentation and build completes successfully.
pkg-config --modversion gtk-doc
1.32
which gtkdoc-mktmpl
/which: no gtkdoc-mktmpl in ...
On a Linux Mint 18,3 (based Ubuntu 16.04 LTS)
cmake --version
cmake version 3.17.3
Building libinstpatch v1.16 with cmake option -DGTKDOC_ENABLED=ON
Gtk-Doc API reference: yes
Scanning dependencies of target doc-libinstpatch
make[2]: *** No rule to make target 'docs/reference/instpatch-1.0', needed by 'docs/reference/libinstpatch/html.stamp'. Stop.
CMakeFiles/Makefile2:311: recipe for target 'docs/reference/CMakeFiles/doc-libinstpatch.dir/all' failed
make[1]: *** [docs/reference/CMakeFiles/doc-libinstpatch.dir/all] Error 2
Makefile:171: recipe for target 'all' failed
make: *** [all] Error 2
pkg-config --modversion gtk-doc
1.25
which gtkdoc-mktmpl
/usr/bin/gtkdoc-mktmpl
Building swami b2.2.2 with cmake option -DGTK_ENABLED=ON
Gtk-Doc API reference: yes
[ 89%] Generating libswami/libswami.signals
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for modules 'glib-2.0;gobject-2.0'
-- Found glib-2.0, version 2.48.2
-- Found gobject-2.0, version 2.48.2
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_PREFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_SUFFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_PREFIXES
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_SUFFIXES
-- Executing gtkdoc-scangobj with:
-- CFLAGS: "-I/usr/src/build/swami-2.2.2/src" "-I/usr/include/glib-2.0" "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
-- LDFLAGS: "-L/usr/src/build/swami-2.2.2/build/src/libswami" "-lswami" "-lgobject-2.0" "-lglib-2.0"
-- LDPATH: /usr/src/build/swami-2.2.2/build/src/libswami
libswami-scan.c: In function ‘main’:
libswami-scan.c:122:3: warning: implicit declaration of function ‘swami_init’ [-Wimplicit-function-declaration]
swami_init();
^
./libswami-scan: error while loading shared libraries: libinstpatch-1.0.so.2: cannot open shared object file: No such file or directory
Scan failed:
CMake Error at /usr/src/build/swami-2.2.2/cmake/GtkDocScanGObjWrapper.cmake:39 (message):
Scan failed.
So the same error occurs for libinstpatch whether gtk-doc is an ancient version (1.25 with gtkdoc-templ) or a relatively recent version (1.32 where gtkdoc-templ has ceased to be), and the documentation for swami is not built either.
./libswami-scan: error while loading shared libraries: libinstpatch-1.0.so.2: cannot open shared object file: No such file or directory
I can build successfully with GTKDOC_ENABLED=ON
for Fedora Linux, but only if I force the build to be serial rather than parallel (-j1
). I’m using -GNinja
, but I remember that the problem exists when using the Unix Makefiles
generator too. Somehow CMake is not aware of the dependency on the library despite the DEPENDS instpatch-1.0
in the gtk_doc_add_module
invocation.
Maybe the call to gtk_doc_add_module
should have LIBRARY instpatch-1.0
instead, and stop bothering with manually setting CFLAGS
/LDFLAGS
/LDPATH
. I don’t know if that would work or not, or whether it would affect the generated docs if it does work. I haven’t taken time to find out.
I've tried adding LIBRARIES libinstpatch
and removing the flags as you suggested. But in my case it comes up with completely messed up, autogenerated flags, causing the scan to fail. I don't know what going on.
Until recently, I had been working around this by limiting the build to one CPU. That stopped working, and I found a new workaround.
-DGTKDOC_ENABLED:BOOL=OFF
.-DGTKDOC_ENABLED:BOOL=ON
on the build directory.In Fedora spec-file terms, this looks like:
# We cannot reliably build gtkdoc documentation at the same time as the
# library. It appears that gtkdoc-scangobj attempts to link the library before
# it is built.
#
# The best fix would be to find the missing dependency relationship or other
# problem in the CMake build scripts, but this is not quite obvious.
#
# Historically this could be worked around by setting _smp_ncpus_max to 1, but
# this has stopped working.
#
# Instead, we build with gtkdoc documentation disabled to get the library, then
# enable the gtkdoc documentation and rebuild. This guarantees the library is
# ready when gtkdoc-scangobj runs.
#
# See: 1.1.6: build with GTKDOC_ENABLED=ON fails
# https://github.com/swami/libinstpatch/issues/65
%cmake \
-DGTKDOC_ENABLED:BOOL=OFF \
-DINTROSPECTION_ENABLED:BOOL=\
%{?with_introspection:ON}%{!?with_introspection:OFF} \
-GNinja
%cmake_build
# Enable the GTK docs and build again.
%{__cmake} %{_vpath_builddir} -DGTKDOC_ENABLED:BOOL=ON
%cmake_build