easystroke fails to build on s390x (with fix)

Bug #1883520 reported by Marius Hillenbrand
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
easystroke (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

easystroke fails to build on s390x with -march=z13 and newer (as introduced in Ubuntu 20.04) because of an unexpected interaction of C++ template and compiler optimizations. tl;dr: The code relies on compiler- and optimization-level dependent behavior and the relatively aggressive inlining parameters on s390x with -march=z13 expose these. Note that I can reproduce the build failures on x86_64 with equivalent gcc parameters --param max-inline-insns-auto=80 --param inline-min-speedup=2 (I did not try any other arch).

The build can be fixed by moving the definition of template member functions Stroke::save() and Stroke::load() into gesture.h. As a side-effect, that change unifies code style, since all other classes have their ::save() and ::load() definitions in header files, too.

I have prepared a patch to that avail and submitted a PR upstream (https://github.com/thjaeger/easystroke/pull/14). While the upstream repo appears inactive, "markdstjohn" has included the patch in his fork https://github.com/markdstjohn/easystroke

What is going wrong in detail:
In gesture.h, the template member functions Stroke::save and Stroke::load get called via the serialize() function generated by boost's macro BOOST_SERIALIZATION_SPLIT_MEMBER(). Since the definitions of save()/load() are only available in gesture.cc, the compiler may produce two versions of Stroke::serialize(): one with save()/load() inlined in gesture.o and one with calls to save()/load() in all other translation units that #include gesture.h but lack the definitions from gesture.cc. Since the compiler inlined Stroke::save() and Stroke::load(), it will not export them in gesture.o (which is legitimate, to my analysis, since the code only requests an export of Stroke::serialize). As a result, linking can fail, depending on the link order (i.e., when the linker picks a version of Stroke::serialize() that would call save()/load() instead of the version with these functions inlined).

Tags: patch
Revision history for this message
Marius Hillenbrand (mhillen) wrote :

Note that my patch in https://github.com/markdstjohn/easystroke/commit/686b7778767f1f94cf9f6d5c2acd401d76bb3d4a applies cleanly on top of 0.6.0-0ubuntu14.

Revision history for this message
Marius Hillenbrand (mhillen) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "proposed patch for the Ubuntu package (including DEP3 metadata)" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Balint Harmath (bharmath) wrote :

The fix is provided - the bug is valid.

Changed in easystroke (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.