After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789608 - Compilation problems when linking libraries
Compilation problems when linking libraries
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Build system
2.7.x
Other Linux
: Normal normal
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-29 00:06 UTC by Luciano Santos
Modified: 2018-06-30 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that passes -lX11 parameter (614 bytes, patch)
2017-10-29 00:06 UTC, Luciano Santos
none Details | Review
cmake's build without the patch (809.22 KB, text/plain)
2017-10-29 00:07 UTC, Luciano Santos
  Details
cmake's build stuck at the same point as without the patch (804.83 KB, text/plain)
2017-10-29 00:08 UTC, Luciano Santos
  Details
cmake's build stuck a little further w/o the patch (935.38 KB, text/plain)
2017-10-29 00:09 UTC, Luciano Santos
  Details
autotool's build log (443.42 KB, text/plain)
2017-10-29 00:10 UTC, Luciano Santos
  Details
cmake-ninja build failing in dbi building (243.45 KB, text/plain)
2017-11-04 01:33 UTC, Luciano Santos
  Details
cmake disabling of dbi failure (143.21 KB, text/plain)
2017-11-04 01:34 UTC, Luciano Santos
  Details
configure --disable-dbi build success (1.91 MB, text/plain)
2017-11-04 01:36 UTC, Luciano Santos
  Details

Description Luciano Santos 2017-10-29 00:06:23 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).
Comment 1 Luciano Santos 2017-10-29 00:07:46 UTC
Created attachment 362468 [details]
cmake's build without the patch
Comment 2 Luciano Santos 2017-10-29 00:08:50 UTC
Created attachment 362469 [details]
cmake's build stuck at the same point as without the patch
Comment 3 Luciano Santos 2017-10-29 00:09:59 UTC
Created attachment 362470 [details]
cmake's build stuck a little further w/o the patch
Comment 4 Luciano Santos 2017-10-29 00:10:44 UTC
Created attachment 362471 [details]
autotool's build log
Comment 5 André Klapper 2017-10-29 09:13:05 UTC
Why was viewing this ticket manually restricted to GnuCash Developers only? 
Is there anything secret in this ticket?
Comment 6 John Ralls 2017-10-29 14:59:38 UTC
(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.
Comment 7 Luciano Santos 2017-10-29 16:32:40 UTC
(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.
Comment 8 André Klapper 2017-10-29 16:42:09 UTC
(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.
Comment 9 John Ralls 2017-10-30 16:31:31 UTC
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.
Comment 10 Luciano Santos 2017-10-30 16:48:22 UTC
We use gcc. The stable version build without any problems. The differences between the stable and the alpha are that great?
Comment 11 John Ralls 2017-10-30 17:12:08 UTC
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.
Comment 12 Luciano Santos 2017-10-30 19:17:27 UTC
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.
Comment 13 John Ralls 2017-10-30 20:39:17 UTC
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.
Comment 14 Luciano Santos 2017-11-04 01:31:59 UTC
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.
Comment 15 Luciano Santos 2017-11-04 01:33:23 UTC
Created attachment 362945 [details]
cmake-ninja build failing in dbi building
Comment 16 Luciano Santos 2017-11-04 01:34:43 UTC
Created attachment 362947 [details]
cmake disabling of dbi failure
Comment 17 Luciano Santos 2017-11-04 01:36:06 UTC
Created attachment 362948 [details]
configure --disable-dbi build success
Comment 18 John Ralls 2017-11-09 22:53:20 UTC
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*).
Comment 19 Luciano Santos 2017-11-12 22:59:42 UTC
GNUCash unstable version 2.7.1 now is buildable and installable in openSUSE. Thank you for your efforts.
Comment 20 John Ralls 2017-11-13 01:42:29 UTC
Huzzah! What turned out to be the cause of the library-not-found problem?
Comment 21 Luciano Santos 2017-11-13 03:51:35 UTC
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.
Comment 22 John Ralls 2017-11-13 04:47:58 UTC
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.
Comment 23 Luciano Santos 2017-11-13 04:58:19 UTC
That's good information, I'll update our specfile. Thank you!
Comment 24 John Ralls 2018-06-30 00:00:22 UTC
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.