Bug 35213 - [chromium] hardcoded gcc path breaks solaris build
Summary: [chromium] hardcoded gcc path breaks solaris build
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 11:01 PST by electricmonopole
Modified: 2010-02-25 09:21 PST (History)
5 users (show)

See Also:


Attachments
patches to fix path on solaris (2.97 KB, patch)
2010-02-21 11:01 PST, electricmonopole
no flags Details | Formatted Diff | Diff
revised patch (3.52 KB, patch)
2010-02-21 11:53 PST, electricmonopole
no flags Details | Formatted Diff | Diff
revised patch with reedited ChangeLog (1.62 KB, patch)
2010-02-21 12:04 PST, electricmonopole
evan: review-
Details | Formatted Diff | Diff
reuploading patch (3.58 KB, patch)
2010-02-22 05:38 PST, electricmonopole
no flags Details | Formatted Diff | Diff
fix formatting (3.59 KB, application/octet-stream)
2010-02-22 05:47 PST, electricmonopole
no flags Details
formatting fix again (3.59 KB, patch)
2010-02-22 05:49 PST, electricmonopole
no flags Details | Formatted Diff | Diff
fix changelog formatting, again (3.59 KB, patch)
2010-02-22 18:51 PST, electricmonopole
levin: review-
Details | Formatted Diff | Diff
seperate into new variable, reformatting again (3.58 KB, patch)
2010-02-24 11:34 PST, electricmonopole
levin: review-
levin: commit-queue-
Details | Formatted Diff | Diff
even more formatting edits (3.56 KB, patch)
2010-02-25 08:11 PST, electricmonopole
levin: review+
levin: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description electricmonopole 2010-02-21 11:01:10 PST
Created attachment 49152 [details]
patches to fix path on solaris

http://codereview.chromium.org/650016

There is no /usr/bin/gcc in Solaris and SXCE (Opensolaris has a symlink). Referring here.

These patches fix the issue, but a long-term solution is to fix the preprocessor FIXME, as commented in the code.
Comment 1 electricmonopole 2010-02-21 11:53:55 PST
Created attachment 49158 [details]
revised patch

patch made with svn-create-patch script
Comment 2 electricmonopole 2010-02-21 12:04:31 PST
Created attachment 49162 [details]
revised patch with reedited ChangeLog

fixed and edited flags
Comment 3 Darin Adler 2010-02-21 13:02:20 PST
Comment on attachment 49162 [details]
revised patch with reedited ChangeLog

Can't land this because there are tabs in the change log.

This bug title says "hardcoded gcc path breaks solaris build", but tis patch has nothing to do with that.
Comment 4 Evan Martin 2010-02-22 00:02:36 PST
Comment on attachment 49162 [details]
revised patch with reedited ChangeLog

r- based on Darin's comments.  It looks like patch #3 has different changes than patch #2.

-    open FILE, "-|", "/usr/bin/gcc", "-E", "-P", "-x", "objective-c", 
-        (map { "-D$_" } split(/ +/, $defines)), "-DOBJC_CODE_GENERATION", $fileName or die "Could not open $fileName";
+    if (($Config::Config{'osname'})=~/solaris/i){
+        open FILE, "-|", "/usr/sfw/bin/gcc", "-E", "-P", "-x", "objective-c", 
+            (map { "-D$_" } split(/ +/, $defines)), "-DOBJC_CODE_GENERATION", $fileName or die "Could not open $fileName";
+    } else {
+        open FILE, "-|", "/usr/bin/gcc", "-E", "-P", "-x", "objective-c", 
+            (map { "-D$_" } split(/ +/, $defines)), "-DOBJC_CODE_GENERATION", $fileName or die "Could not open $fileName";
+    }

Rather than duplicate code, why not factor out the gcc path into a variable?
Comment 5 electricmonopole 2010-02-22 05:38:24 PST
Created attachment 49206 [details]
reuploading patch

For some reason the wrong patch was uploaded. Just great,
Comment 6 electricmonopole 2010-02-22 05:44:25 PST
The previous patch was actually https://bugs.webkit.org/show_bug.cgi?id=35214 which made its way onto here for some reason. 

@Evan There was a FIXME describing that exact thing. Based on the fact that it's from 2007 and nobody has done it, I figured there was some complicated reason why, hence why I'm leaving it someone more familiar with WebKit, instead of risking something breaking. (I don't have access to a linux machine where I can build WebKit).
Comment 7 electricmonopole 2010-02-22 05:47:29 PST
Created attachment 49208 [details]
fix formatting

fix formatting in ChangeLog
Comment 8 electricmonopole 2010-02-22 05:49:35 PST
Created attachment 49209 [details]
formatting fix again

clicked the checkbox with "patch" written inside. Great.

Is there a command line alternative to the web interface? My browser is being exciting.
Comment 9 Eric Seidel (no email) 2010-02-22 14:38:43 PST
This patch fails to apply (as you can see by the purple bubbles below the patch).  Click on any one of the bubbles to see why.
Comment 10 electricmonopole 2010-02-22 18:51:36 PST
Created attachment 49255 [details]
fix changelog formatting, again

Previous patch to changelog was against my local copy, which had other changes I've made but haven't been committed. Updated to newest svn, triple checked the patch content again. Hope it works this time...
Comment 11 electricmonopole 2010-02-24 09:59:22 PST
anyone?
Comment 12 David Levin 2010-02-24 11:04:54 PST
Comment on attachment 49255 [details]
fix changelog formatting, again

> Index: ChangeLog
> +2010-02-22  James Choi  <jchoi42@pha.jhu.edu>
> +
> +        Change hardcoded gcc paths to be Solaris friendly
> +        https://bugs.webkit.org/show_bug.cgi?id=35214
> +
> +        * WebCore/bindings/scripts/CodeGeneratorObjC.pm, WebCore/bindings/scripts/IDLParser.pm, WebCore/css/make-css-file-arrays.pl, WebCore/dom/make_names.pl

Each file typically has its own line with a * before it. I imaging that is how prepare-ChangeLog generated it but this looks odd to me.


> Index: WebCore/bindings/scripts/CodeGeneratorObjC.pm

In each of these changes, the line containing gcc has been duplicated completely. It would be better if the change was only about the gcc location. For example,

    my $gccLocation = "";
    if (($Config::Config{'osname'}) =~ /solaris/i) {
        $gccLocation = "/usr/sfw/bin/gcc";
    } else {
        $gccLocation = "/usr/sfw/bin/gcc";
    }
    open FILE, "-|", $gccLocation, "-E", "-P", "-x", "objective-c", 
        (map { "-D$_" } split(/ +/, $defines)), "-DOBJC_CODE_GENERATION", $fileName or die "Could not open $fileName";


Also please note the spaces around the =~ and before the {.
Comment 13 David Levin 2010-02-24 11:07:27 PST
(In reply to comment #4)
> Rather than duplicate code, why not factor out the gcc path into a variable?

I should have just said (again) r- for what Mr. Martin said. :)
Comment 14 electricmonopole 2010-02-24 11:34:29 PST
Created attachment 49416 [details]
seperate into new variable, reformatting again
Comment 15 David Levin 2010-02-24 11:59:40 PST
Comment on attachment 49416 [details]
seperate into new variable, reformatting again

> Index: WebCore/bindings/scripts/CodeGeneratorObjC.pm
> ===================================================================
> --- WebCore/bindings/scripts/CodeGeneratorObjC.pm	(revision 55194)
> +++ WebCore/bindings/scripts/CodeGeneratorObjC.pm	(working copy)
> @@ -222,7 +222,13 @@ sub ReadPublicInterfaces
>      %publicInterfaces = ();
>  
>      my $fileName = "WebCore/bindings/objc/PublicDOMInterfaces.h";
> -    open FILE, "-|", "/usr/bin/gcc", "-E", "-P", "-x", "objective-c", 
> +    my $gcclocation

Should be gccLocation (since it is two separate words). This should be done throughout the change.
Also add = ""; so it should look like this:

my $gccLocation = "";

> +    if (($Config::Config{'osname'})=~/solaris/i){

You need a space before the {
This should be done in several other places too.

> +      $gcclocation = "/usr/sfw/bin/gcc";

4 space indent.

> +    } else {
> +      $gcclocation = "/usr/bin/gcc";

4 space indent.


> ===================================================================
> --- WebCore/bindings/scripts/IDLParser.pm	(revision 55194)
> +++ WebCore/bindings/scripts/IDLParser.pm	(working copy)
> @@ -64,7 +64,15 @@ sub Parse
>      $parentsOnly = shift;
>  
>      if (!$preprocessor) {
> -        $preprocessor = "/usr/bin/gcc -E -P -x c++";
> +        # Detect OS. If Solaris, use /usr/sfw/bin/gcc.
> +        require Config;
> +        my $gccLocation = "";
> +        if (($Config::Config{'osname'})=~/solaris/i){
> +            $gcclocation = "/usr/sfw/bin/gcc";

$gccLocation (throughout)

> +        } else {
> +            $gcclocation = "/usr/bin/gcc";
> +        }
> +        $preprocessor = $gcclocation . " -E -P -x c++";
>      }
>  
>      if (!$defines) {
> Index: WebCore/css/make-css-file-arrays.pl
> ===================================================================
> --- WebCore/css/make-css-file-arrays.pl	(revision 55194)
> +++ WebCore/css/make-css-file-arrays.pl	(working copy)
> @@ -28,7 +28,15 @@ my $preprocessor;
>  GetOptions('preprocessor=s' => \$preprocessor);
>  
>  if (!$preprocessor) {
> -    $preprocessor = "/usr/bin/gcc -E -P -x c++";
> +    # Detect OS. If Solaris, use /usr/sfw/bin/gcc.
> +    require Config;
> +    my $gccLocation = "";
> +    if (($Config::Config{'osname'})=~/solaris/i){
> +        $gcclocation = "/usr/sfw/bin/gcc";
> +    } else {
> +        $gcclocation = "/usr/bin/gcc";
> +    }
> +    $preprocessor = $gcclocation . " -E -P -x c++";
>  }
>  
>  my $header = $ARGV[0];
> Index: WebCore/dom/make_names.pl
> ===================================================================
> --- WebCore/dom/make_names.pl	(revision 55194)
> +++ WebCore/dom/make_names.pl	(working copy)
> @@ -47,7 +47,16 @@ my %tags = ();
>  my %attrs = ();
>  my %parameters = ();
>  my $extraDefines = 0;
> -my $preprocessor = "/usr/bin/gcc -E -P -x c++";
> +my $preprocessor = "";

Get rid of this line and make the line where you initialize $preprocessor do the "my".

> +# Detect OS. If Solaris, use /usr/sfw/bin/gcc.
> +require Config;
> +my $gccLocation = "";
> +if (($Config::Config{'osname'})=~/solaris/i){
> +    $gcclocation = "/usr/sfw/bin/gcc";
> +} else {
> +    $gcclocation = "/usr/bin/gcc";
> +}
> +$preprocessor = $gcclocation . " -E -P -x c++";
>  
>  GetOptions(
>      'tags=s' => \$tagsFile,
Comment 16 electricmonopole 2010-02-25 08:11:38 PST
Created attachment 49488 [details]
even more formatting edits

More formatting things.

> Get rid of this line and make the line where you initialize $preprocessor do
the "my".

Could you explain? :)
Comment 17 David Levin 2010-02-25 08:34:39 PST
Comment on attachment 49488 [details]
even more formatting edits

I'll do these fixes and land it.


There should be spaces around the ~= as noted previously but I missed this in the last review :(.

> Index: WebCore/dom/make_names.pl

This could be slightly simpler my moving where preprocessor is declared.

> +require Config;
> +my $gccLocation = "";
> +if (($Config::Config{'osname'})=~/solaris/i) {
> +    $gccLocation = "/usr/sfw/bin/gcc";
> +} else {
> +    $gccLocation = "/usr/bin/gcc";
> +}
> +my $preprocessor = $gcclocation . " -E -P -x c++";

Something I didn't mention before: I think the comment "Detect OS. ..." is redundant with the code (-- It is a translation of the code into English so it doesn't seem useful), so it should be removed.
Comment 18 WebKit Review Bot 2010-02-25 08:39:02 PST
Attachment 49488 [details] did not build on chromium:
Build output: http://webkit-commit-queue.appspot.com/results/308746
Comment 19 David Levin 2010-02-25 08:44:50 PST
Two more things I noticed. 

1. gccLocation wasn't done consistently which resulted in the busted build noted above. (It is gcclocation in places still.)
2. The ChangeLog entry was in ./ChangeLog instead of WebCore/ChangeLog which is rather odd.  In the future use prepare-ChangeLog to create this and it will do the right thing (I just tried it to verify that).

I'll fix both of these while landing too.
Comment 20 electricmonopole 2010-02-25 08:57:50 PST
All good points. Thank you for your help :)
Comment 21 David Levin 2010-02-25 09:21:16 PST
Committed as http://trac.webkit.org/changeset/55240