Bug 350729

Summary: Qalculate backend fails to build
Product: [Applications] cantor Reporter: Antonio Rojas <arojas>
Component: qualculate-backendAssignee: Alexander Rieder <alexanderrieder>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, demm, filipe, heiko.becker, lucashnegri
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: build log
Build log cantor 15.08rc
build log with suggested fix

Description Antonio Rojas 2015-07-29 06:38:07 UTC
The qalculate backend doesn't build in 15.08 beta, using GCC 5.2 & Qt 5.5.
First, there is a syntax error in qalculateexpression.cpp, line 779 (missing closing parenthesis). But even after fixing this error, the build still fails, see attached build log

Reproducible: Always
Comment 1 Antonio Rojas 2015-07-29 06:38:55 UTC
Created attachment 93786 [details]
build log
Comment 2 Albert Astals Cid 2015-08-06 21:02:12 UTC
Filipe? Lucas?
Comment 3 demm 2015-08-06 21:06:26 UTC
Created attachment 93921 [details]
Build log cantor 15.08rc

Same fail with 15.08rc
Comment 4 Filipe Saraiva 2015-08-07 16:02:29 UTC
Hi Antonio, looks like this problem is related with gcc or Qt version. I can not to reproduce this bug using gcc 4.9.2 and Qt 5.4.2 here.

The problem is related with == operator comparing a C++ string and a QLatin1String. Please, use the follow codes in respective lines in src/backends/qalculate/qalculateexpression.cpp file:

Line 776:
QLatin1String(plotParameters.filename.substr(p-4,4)) == QLatin1String(".eps")) ||

Line 778:
QLatin1String(plotParameters.filename.substr(p-3,3)) == QLatin1String(".ps")))

Let me know if it fixes the problems.
Comment 5 Antonio Rojas 2015-08-08 06:53:11 UTC
I'm on vacation and won't be able to test before 15.08 tagging, it would be great if someone else using gcc5/qt5.5 could do it.
Comment 6 Heiko Becker 2015-08-08 10:27:41 UTC
> Let me know if it fixes the problems.

Unfortunately it doesn't, see attached log. Isn't QLatin1String intended to be used with string literals?
Comment 7 Heiko Becker 2015-08-08 10:28:39 UTC
Created attachment 93946 [details]
build log with suggested fix
Comment 8 Albert Astals Cid 2015-08-08 15:46:16 UTC
compiles fine for me in ubuntu wily (gcc5.1 and qt 5.4) and archlinux gcc5.2 and qt 5.5).
Comment 9 Christoph Feck 2015-08-19 19:35:29 UTC
A std::string can be compared to a char array, i.e. substr() == ".eps". No need to convert both to a QString.
Comment 10 Heiko Becker 2015-08-23 13:51:30 UTC
Git commit ceadbd453cfb4263755931635cb9b02d7aa29efa by Heiko Becker.
Committed on 23/08/2015 at 13:49.
Pushed by heikobecker into branch 'Applications/15.08'.

Fix building the qalculate backend

Thanks to Christoph Feck who suggested the fix.
REVIEW: 124829

M  +3    -3    src/backends/qalculate/qalculateexpression.cpp

http://commits.kde.org/cantor/ceadbd453cfb4263755931635cb9b02d7aa29efa