GNOME Bugzilla – Bug 789608
Compilation problems when linking libraries
Last modified: 2018-06-30 00:00:22 UTC
Created attachment 362467 [details] [review] Patch that passes -lX11 parameter I have been trying to compile the alpha version 2.7.0 in Open Build Service but I keep getting this linking problems in cmake: [ 237s] CMakeFiles/gncmod-gnome-utils.dir/gnc-gnome-utils.c.o: In function `gnc_x_error': [ 237s] /home/abuild/rpmbuild/BUILD/gnucash-2.7.0/gnucash/gnome-utils/gnc-gnome-utils.c:630: undefined reference to `XGetErrorText' [ 237s] CMakeFiles/gncmod-gnome-utils.dir/gnc-gnome-utils.c.o: In function `gnc_ui_start_event_loop': [ 237s] /home/abuild/rpmbuild/BUILD/gnucash-2.7.0/gnucash/gnome-utils/gnc-gnome-utils.c:656: undefined reference to `XSetErrorHandler' [ 237s] collect2: error: ld returned 1 exit status [ 237s] make[2]: *** [gnucash/gnome-utils/CMakeFiles/gncmod-gnome-utils.dir/build.make:2224: lib/gnucash/libgncmod-gnome-utils.so] Error 1 [ 237s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/build' [ 237s] make[1]: *** [CMakeFiles/Makefile2:7351: gnucash/gnome-utils/CMakeFiles/gncmod-gnome-utils.dir/all] Error 2 [ 237s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/build' [ 237s] make: *** [Makefile:166: all] Error 2 [ 237s] error: Bad exit status from /var/tmp/rpm-tmp.YegQBv (%build) Even with X11/Xlib.h in place and healthy. And here's another problem of the same sort, but with autotools: gnc-backend-dbi.cpp:257:6: note: candidates are: void error_handler(void*, void*) [ 445s] void error_handler(void* conn, void* data); [ 445s] ^~~~~~~~~~~~~ [ 445s] gnc-backend-dbi.cpp:256:29: note: template<DbType Type> void error_handler(void*, void*) [ 445s] template <DbType Type> void error_handler(void* conn, void* data); [ 445s] ^~~~~~~~~~~~~ [ 445s] gnc-backend-dbi.cpp: In instantiation of 'dbi_conn_s* GncDbiBackend<Type>::conn_setup(PairVec&, UriStrings&) [with DbType Type = (DbType)1; dbi_conn = dbi_conn_s*; PairVec = std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >]': [ 445s] gnc-backend-dbi.cpp:621:27: required from 'void GncDbiBackend<Type>::session_begin(QofSession*, const char*, bool, bool, bool) [with DbType Type = (DbType)1; QofSession = QofSessionImpl]' [ 445s] gnc-dbisqlresult.hpp:51:9: required from here [ 445s] gnc-backend-dbi.cpp:281:28: error: no matches converting function 'error_handler' to type 'dbi_conn_error_handler_func {aka void (*)(struct dbi_conn_s*, void*)}' [ 445s] dbi_conn_error_handler (conn, error_handler<Type>, this); [ 445s] ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ 445s] gnc-backend-dbi.cpp:257:6: note: candidates are: void error_handler(void*, void*) [ 445s] void error_handler(void* conn, void* data); [ 445s] ^~~~~~~~~~~~~ [ 445s] gnc-backend-dbi.cpp:256:29: note: template<DbType Type> void error_handler(void*, void*) [ 445s] template <DbType Type> void error_handler(void* conn, void* data); [ 445s] ^~~~~~~~~~~~~ [ 445s] cc1plus: warning: unrecognized command line option '-Wno-deprecated-register' [ 445s] make[5]: *** [Makefile:679: gnc-backend-dbi.lo] Error 1 [ 445s] make[5]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/libgnucash/backend/dbi' [ 445s] make[4]: *** [Makefile:694: all-recursive] Error 1 [ 445s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/libgnucash/backend/dbi' [ 445s] make[3]: *** [Makefile:517: all-recursive] Error 1 [ 445s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/libgnucash/backend' [ 445s] make[2]: *** [Makefile:536: all-recursive] Error 1 [ 445s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0/libgnucash' [ 445s] make[1]: *** [Makefile:825: all-recursive] Error 1 [ 445s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnucash-2.7.0' [ 445s] make: *** [Makefile:679: all] Error 2 [ 445s] error: Bad exit status from /var/tmp/rpm-tmp.0PItbW (%build) I tried using the attached patch that passes -lX11 to the compiler but without result. The only difference is that sometimes the compilation goes a little further (see attachment).
Created attachment 362468 [details] cmake's build without the patch
Created attachment 362469 [details] cmake's build stuck at the same point as without the patch
Created attachment 362470 [details] cmake's build stuck a little further w/o the patch
Created attachment 362471 [details] autotool's build log
Why was viewing this ticket manually restricted to GnuCash Developers only? Is there anything secret in this ticket?
(In reply to André Klapper from comment #5) > Why was viewing this ticket manually restricted to GnuCash Developers only? > Is there anything secret in this ticket? Probably just a misunderstanding on the reporter's part. On the other hand it clearly doesn't work since you were able to see it and comment on it.
(In reply to André Klapper from comment #5) > Why was viewing this ticket manually restricted to GnuCash Developers only? > Is there anything secret in this ticket? Sorry, my mistake. I should've left it unchecked and let the assigned resolve what to do.
(In reply to John Ralls from comment #6) > it clearly doesn't work since you were able to see it and comment on it. It does work because it also includes admins.
Luciano Santos: It looks like OpenSuSE has more problems than just needing libX11. The last attachment, the autotools build, looks like you're not using a capable compiler. I don't see the actual error in the two cmake builds that link -lX11. It seems to complete linking a module and then die for no reason.
We use gcc. The stable version build without any problems. The differences between the stable and the alpha are that great?
Ah, but what *version* of GCC? Yes, unstable requires C++11, so gcc-4.8 or later. We've decided to remove the X11 direct dependency, but there are clearly other problems with OpenSuSE.
We use the latest gcc7. I can't see the actual error in cmake build neither. Could it be the flags used? If so I could attach both autotools and cmake flags that is passed to the compiler.
The flags going to the compiler are already visible in the error dumps. How about running the build from the command line without the build service in the middle? Another thought is that the dependency tree is a bit underspecified to cmake. Ninja figures out the dependencies for itself and seems to always work OK but make sometimes has issues, though the failures are usually in building Guile modules rather than linking. "make -j 1" might work around it. For the autotools failure it seems odd that it fails with autotools and not cmake if it's the same compiler. See if --- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp +++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp @@ -253,8 +253,8 @@ GncDbiBackend<Type>::set_standard_connection_options (dbi_conn conn, return true; } -template <DbType Type> void error_handler(void* conn, void* data); -void error_handler(void* conn, void* data); +template <DbType Type> void error_handler(dbi_conn conn, void* data); +void error_handler(dbi_conn conn, void* data); template <DbType Type> dbi_conn GncDbiBackend<Type>::conn_setup (PairVec& options, UriStrings& uri) makes a difference.
I run some more tests in both OBS and in my machine. When I used Ninja the build failured in DBI (see attachment), about the same point where autotools were failing. Then I tried to disable DBI with cmake but got an error (see attatchment). Did the same with autotools and, for my surprise, gnucash built like a charm (see attachment) Now we can say that there is something going on with dbi part of the compilation. So it's not exactly a linking problem, the proof is that we can see in the attachment where I used cmake-make this entries: [ 223s] make[2]: *** [libgnucash/backend/dbi/CMakeFiles/gncmod-backend-dbi.dir/build.make:67: libgnucash/backend/dbi/CMakeFiles/gncmod-backend-dbi.dir/gnc-backend-dbi.cpp.o] Error 1 [ 233s] make[1]: *** [CMakeFiles/Makefile2:2956: libgnucash/backend/dbi/CMakeFiles/gncmod-backend-dbi.dir/all] Error 2 The first error when linking libgnc-backend-xml-utils.so and the second one when building gnc-tree-model-commodity.c.o. But somehow make managed to keep on. It's a big leap so far and now we can try to triangulate the source of this issue.
Created attachment 362945 [details] cmake-ninja build failing in dbi building
Created attachment 362947 [details] cmake disabling of dbi failure
Created attachment 362948 [details] configure --disable-dbi build success
I found that Debian 9 has the same errors, which made it easy to test fixes. It's partly a mistake I made rewriting into C++: I separated the use of HAVE_DBI_TO_LONGLONG from its definition so it was trying to compile the code for libdbi-0.8.x. The other part is that gcc-6 and later are pickier about template matching, so error_hander<>(dbi_conn, void*) doesn't match template typename<T>(void*, void*).
GNUCash unstable version 2.7.1 now is buildable and installable in openSUSE. Thank you for your efforts.
Huzzah! What turned out to be the cause of the library-not-found problem?
After running ldconfig the complain got away. Then I built gnucash in OBS and installed the rpm package along with some perl packages and slib, all runtime dependencies. I ran the application and all good. I'm happy now since autotools is working just fine now. But I'm still having issues with cmake. I'll file a new bug proper to this matter.
The perl packages (Date::Manip and Finance::Quote) are optional, for online price retrieval. Most distros handle them separately. SLib hasn't been required since we dropped support for Guile 1.6 for Gnucash 2.6.0. Its functionality is incorporated directly in Guile 1.8 and later.
That's good information, I'll update our specfile. Thank you!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=789608. Please update any external references or bookmarks.