Bug 132601 - SunStudio C++ compiler not detected in Compiler Output view.
Summary: SunStudio C++ compiler not detected in Compiler Output view.
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Output Views (show other bugs)
Version: 3.3.4
Platform: Ubuntu Packages Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-18 18:41 UTC by Paul Fee
Modified: 2007-05-15 21:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Detect SunStudio linker output (751 bytes, patch)
2007-05-15 11:27 UTC, Paul Fee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fee 2006-08-18 18:41:57 UTC
Version:           3.3.4 (using KDE KDE 3.5.4)
Installed from:    Ubuntu Packages
OS:                Linux

When building a project, compiler output is parsed in the OutputView.  In particular the lines corresponding to compiling, linking etc. are detected.

This works by means of regular expressions, the code is visible in:
parts/outputviews/makeactionfilter.cpp
MakeActionFilter::actionFormats()

Various well known compiler expressions are understood (e.g. cc, gcc, c++).  However Sun's SunStudio C++ compiler goes by the name CC, hence it is not detected.

Adding CC to the expressions allows output from the SunStudio compiler to be parsed correctly.

I've patched this method on my own system as follows.  A more generic fix would be to allow the user to enter the name of their compiler, however this simple change works for me.

==================

// returns an array of ActionFormat
MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
{
    static ActionFormat formats[] = {
        ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
        ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
        ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
        ActionFormat( i18n("compiling"), "unknown", "^compiling (.*)", 1 ),

                //moc and uic
        ActionFormat( i18n("generating"), 1, 2, "/(moc|uic)\\b.*\\s-o\\s([^\\s;]+)"),

        ActionFormat( i18n("linking"), "libtool", "/bin/sh\\s.*libtool.*--mode=link\\s.*\\s-o\\s([^\\s;]+)", 1 ),
                //can distcc link too ?
        ActionFormat( i18n("linking"), 1, 2, "(gcc|CC|cc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-o ([^\\s;]+)"),

        ActionFormat( i18n("creating"), "", "/(?:bin/sh\\s.*mkinstalldirs).*\\s([^\\s;]+)", 1 ),
        ActionFormat( i18n("installing"), "", "/(?:usr/bin/install|bin/sh\\s.*mkinstalldirs|bin/sh\\s.*libtool.*--mode=install).*\\s([^\\s;]+)", 1 ),
        ActionFormat( i18n("generating"), "dcopidl", "dcopidl .* > ([^\\s;]+)", 1 ),
        ActionFormat( i18n("compiling"), "dcopidl2cpp", "dcopidl2cpp (?:\\S* )*([^\\s;]+)", 1 ),

        ActionFormat( QString::null, QString::null, 0, 0 )
    };

    return formats;
}

======================

Can we have "CC" be added as shown above.  Or even better allow user input of their compiler name, that would be useful for users with strange compiler names.  For example someone cross compiling for an embedded system.

Thanks,
Paul
Comment 1 Jens Dagerbo 2007-01-07 21:46:08 UTC
SVN commit 620944 by dagerbo:

Add various common ld and make error strings to the output error parser
Add 'CC' among the possible compilers

BUG: 71299
BUG: 72699
BUG: 131542
BUG: 91520
BUG: 132601


 M  +8 -0      compileerrorfilter.cpp  
 M  +3 -3      makeactionfilter.cpp  


--- branches/kdevelop/3.4/parts/outputviews/compileerrorfilter.cpp #620943:620944
@@ -50,6 +50,13 @@
 		ErrorFormat( "([^: \\t]+)\\(([0-9]+)\\):([^0-9]+)", 1, 2, 3, "intel" ),
 		//libtool link
 		ErrorFormat( "(libtool):( link):( warning): ", 0, 0, 0 ),
+		// ld 
+		ErrorFormat( "undefined reference", 0, 0, 0 ),
+		ErrorFormat( "undefined symbol", 0, 0, 0 ),
+		ErrorFormat( "ld: cannot find", 0, 0, 0 ),
+		ErrorFormat( "No such file", 0, 0, 0 ),
+		// make
+ 		ErrorFormat( "No rule to make target", 0, 0, 0 ),
 		// Fortran
 		ErrorFormat( "\"(.*)\", line ([0-9]+):(.*)", 1, 2, 3 ),
 		// Jade
@@ -65,6 +72,7 @@
 	};
 
 	return formats;
+
 }
 
 void CompileErrorFilter::processLine( const QString& line )
--- branches/kdevelop/3.4/parts/outputviews/makeactionfilter.cpp #620943:620944
@@ -72,9 +72,9 @@
 MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
 {
 	static ActionFormat formats[] = {
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
 		ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
 		ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
 
Comment 2 Paul Fee 2007-04-24 00:25:12 UTC
Thank you Jens for the change which made it into KDevelop 3.4.

The "compiling" detection now works for SunStudio's "CC" compiler.

However, the "linking" detection was omitted from your change.

Looking at the source for KDevelop 3.4.0, could line 90 be changed from:
ActionFormat( i18n("linking"), 1, 2, "(gcc|cc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-o ([^\\s;]+)"),

to:
ActionFormat( i18n("linking"), 1, 2, "(gcc|CC|cc|c\\+\\+|g\\+\\+)\\
S* (?:\\S* )*-o ([^\\s;]+)"),

That is, add "CC|".

Thanks,
Paul
Comment 3 Paul Fee 2007-05-15 11:27:55 UTC
Created attachment 20572 [details]
Detect SunStudio linker output

SunStudio C++ compiler/linker is "CC".

It is already detected during compilation, this patch allows detection during
linking.  This makes the "Very Short Compiler Output" more useful.
Comment 4 Andreas Pakulat 2007-05-15 21:01:49 UTC
SVN commit 665073 by apaku:

Fix for Sun Compiler, patch from Paul Fee and finally closing the bugreport
BUG:132601


 M  +1 -1      makeactionfilter.cpp  


--- branches/KDE/3.5/kdevelop/parts/outputviews/makeactionfilter.cpp #665072:665073
@@ -87,7 +87,7 @@
 
 		ActionFormat( i18n("linking"), "libtool", "/bin/sh\\s.*libtool.*--mode=link\\s.*\\s-o\\s([^\\s;]+)", 1 ),
                 //can distcc link too ?
-		ActionFormat( i18n("linking"), 1, 2, "(gcc|cc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-o ([^\\s;]+)"),
+		ActionFormat( i18n("linking"), 1, 2, "(gcc|CC|cc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-o ([^\\s;]+)"),
 		ActionFormat( i18n("linking"), 1, 2, "^linking (.*)" ), //unsermaker
 		ActionFormat( i18n("linking"), 1, 1, "^Linking .* module (.*)" ), //cmake
 		ActionFormat( i18n("linking"), 1, 1, "^Linking (.*)" ), //cmake