Bug #72585 Workbench doesn't compile against ctemplate 2.3
Submitted: 9 May 2014 0:24 Modified: 28 Sep 2015 0:09
Reporter: Marcel Korpel Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.1.4 OS:Linux
Assigned to: CPU Architecture:Any
Tags: ctemplate

[9 May 2014 0:24] Marcel Korpel
Description:
When trying to build MySQL Workbench to ctemplate 2.3 it errors on tpl->ReloadIfChanged not being available anymore [1] (it was already deprecated in 2010 [2]).

[1] https://code.google.com/p/ctemplate/#19_March_2014
[2] https://code.google.com/p/ctemplate/#20_April_2010

How to repeat:
Compile the new version of ctemplate and then try to compile MySQL Workbench.

Suggested fix:
I created a patch [1] that changes all calls to tpl->ReloadIfChanged to ctemplate::Template::ReloadAllIfChanged. I didn't test it extensively, let alone the components that use the functions in recordset_text_storage.cpp, but at least MySQL Workbench builds and runs again.

[1] http://pastebin.com/3kK3zNqg
[27 May 2014 4:13] Filipe Rosset
Hi guys,

Can you please release a compiled version (6.1.6 maybe?) against ctemplate 2.3?
I'm unable to update ctemplate in Fedora rawhide w/ mysql-workbench installed here. It affects both versions 6.1.4 and 6.1.6

[filiperosset@rosset-server ~]$ rpm -qi mysql-workbench-community
Name        : mysql-workbench-community
Version     : 6.1.6
Release     : 1.fc20
Architecture: x86_64
Install Date: Ter 27 Mai 2014 01:04:08 BRT
Group       : Applications/Databases
Size        : 113082198
License     : GPLv2
Signature   : DSA/SHA1, Qui 15 Mai 2014 08:28:02 BRT, Key ID 8c718d3b5072e1f5
Source RPM  : mysql-workbench-community-6.1.6-1.fc20.src.rpm
Build Date  : Ter 13 Mai 2014 19:11:42 BRT
Build Host  : nike06.se.oracle.com
Relocations : (not relocatable)
Vendor      : Oracle Corporation
URL         : http://wb.mysql.com
Summary     : A MySQL visual database modeling, administration, development and migration tool
Description :
MySQL Workbench is a unified visual tool for database architects, developers,
and DBAs. MySQL Workbench provides data modeling, SQL development, and
comprehensive administration tools for server configuration, user
administration, backup, and much more. MySQL Workbench is available on
Windows, Linux and Mac OS X.

[filiperosset@rosset-server ~]$ cat /etc/issue
Fedora release 21 (Rawhide)
Kernel \r on an \m (\l)

[filiperosset@rosset-server ~]$ uname -a
Linux rosset-server 3.15.0-0.rc6.git1.1.fc21.x86_64 #1 SMP Mon May 26 00:19:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[filiperosset@rosset-server ~]$ sudo yum update ctemplate -y
Plugins carregados: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * rawhide: mirror.globo.com
 * rpmfusion-free-rawhide: mirror.us.leaseweb.net
 * rpmfusion-nonfree-rawhide: mirror.us.leaseweb.net
Resolvendo dependências
--> Executando verificação da transação
---> O pacote ctemplate.x86_64 0:2.2-5.fc20 será atualizado
--> Processando dependência: libctemplate.so.2()(64bit) para o pacote: mysql-workbench-community-6.1.6-1.fc20.x86_64
---> O pacote ctemplate.x86_64 0:2.3-1.fc21 será uma atualização
--> Resolução de dependências finalizada
--> Finding unneeded leftover dependencies
Found and removing 0 unneeded dependencies
Error: Pacote: mysql-workbench-community-6.1.6-1.fc20.x86_64 (@/mysql-workbench-community-6.1.6-1.fc20.x86_64)
           Requer: libctemplate.so.2()(64bit)
           Removendo: ctemplate-2.2-5.fc20.x86_64 (@rawhide)
               libctemplate.so.2()(64bit)
           Atualizado por: ctemplate-2.3-1.fc21.x86_64 (rawhide)
              ~libctemplate.so.3()(64bit)
[9 Sep 2014 14:16] MySQL Verification Team
Please check against Development Releases 6.2.2 rc version. Thanks.
[11 Sep 2014 21:38] Jeremy Rimpo
The current fedora development version 6.2.2-1 still relies on libctemplate.so.2.
[11 Sep 2014 23:28] Jeremy Rimpo
I have the most recent source available on dev.mysql.com. Trying to build from the f20 spec file doesn't work at all. It opens a shell and then prompts for input.

Extracting from a tarball and using cmake, it seems no changes to the deprecated code have been made. If the above patch is applied, there are still some breaking issues.

It works up until you try to access the available tables in the side bar. Trying to open the tables selector doesn't work unless you click off of the window and then click back in.

There are other issues as well, but I think these are more to do with other dependencies that have been upgraded but don't break the build. These are visible in Fedora 21. The worst of which is that table data does not render at all, but there's also an incompatibility with the current gnome-keyring.
[12 Sep 2014 0:10] Jeremy Rimpo
Browsing the ctemplate updates, I think the better solution is possibly to use ReloadIfChangedLocked -- this is what the deprecated function called.

bool Template::ReloadIfChanged() LOCKS_EXCLUDED(g_template_mutex) {		
  // ReloadIfChanged() is protected by g_template_mutex so when it's		
  // called from different threads, they don't stomp on tree_ and		
  // state_.  (This is the only write-locker on g_template_mutex.)		
  WriterMutexLock ml(&g_template_mutex);		
  return ReloadIfChangedLocked();
}

I can look into testing this out later.
[12 Sep 2014 16:13] Jeremy Rimpo
Turns out ->ReloadAllIfChanged() was close to the right solution. But don't use the global ctemplate. You can simply change the existing functions to tpl->ReloadAllIfChanged() etc.

Fixes the problem with the menus.
[11 Jan 2015 21:13] Jakub Kubrynski
What's the current status of this issue? It's really annoying that workbench doesn't work on Fedora for such long time!
[20 Jan 2015 13:12] Sherzod Ruzmetov
Hi, after struggling a whole week, I finally succeeded in re-compiling workbench on Fedora 21. 

The last step was to remove all ctemplate that I had installed using fc21 repos and installing ctemplate 2.2 from source. This worked!

Here is the thread with details: http://superuser.com/questions/863315/compiling-mysql-workbench-on-fedora-21 

Should I share my binary? Or package it somehow? Sorry, I'm not well-versed at this.
[28 Aug 2015 0:09] MySQL Verification Team
@@ Sherzod Ruzmetov.
So the issue is fixed that way?. Thanks.
[28 Sep 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".