Bug 155427 - [GTK] Fails to build randomly when generating LLIntDesiredOffsets.h
Summary: [GTK] Fails to build randomly when generating LLIntDesiredOffsets.h
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-14 02:23 PDT by Alberto Garcia
Modified: 2016-04-27 04:12 PDT (History)
6 users (show)

See Also:


Attachments
Full build log (ppc64el) (33.43 KB, application/x-xz)
2016-03-14 02:23 PDT, Alberto Garcia
no flags Details
Patch (1.42 KB, patch)
2016-04-27 00:54 PDT, Alberto Garcia
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Garcia 2016-03-14 02:23:45 PDT
Created attachment 273945 [details]
Full build log (ppc64el)

This error doesn't happen often, but I've seen it a few times. The last one with webkitgtk 2.10.8:

[  4%] Generating ../../DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h
cd /«PKGBUILDDIR»/obj-powerpc64le-linux-gnu/Source/JavaScriptCore && /usr/bin/ruby /«PKGBUILDDIR»/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb -I/«PKGBUILDDIR»/obj-powerpc64le-linux-gnu/DerivedSources/JavaScriptCore/ /«PKGBUILDDIR»/Source/JavaScriptCore/llint/LowLevelInterpreter.asm /«PKGBUILDDIR»/obj-powerpc64le-linux-gnu/DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h
/«PKGBUILDDIR»/Source/JavaScriptCore/offlineasm/parser.rb:64:in `processIncludeOptions': undefined method `[]' for nil:NilClass (NoMethodError)
	from /«PKGBUILDDIR»/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb:37:in `<main>'
Source/JavaScriptCore/CMakeFiles/LLIntOffsetsExtractor.dir/build.make:86: recipe for target 'DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h' failed
make[3]: *** [DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h] Error 1
make[3]: Leaving directory '/«PKGBUILDDIR»/obj-powerpc64le-linux-gnu'
CMakeFiles/Makefile2:440: recipe for target 'Source/JavaScriptCore/CMakeFiles/LLIntOffsetsExtractor.dir/all' failed
make[2]: *** [Source/JavaScriptCore/CMakeFiles/LLIntOffsetsExtractor.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....

This was built with make -j4. I'm attaching the full build log.
Comment 1 Alberto Garcia 2016-04-27 00:51:48 PDT
I found the problem.

This is the line that fails:

/usr/bin/ruby /«PKGBUILDDIR»/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb -I/«PKGBUILDDIR»/obj-i586-kfreebsd-gnu/DerivedSources/JavaScriptCore/ /«PKGBUILDDIR»/Source/JavaScriptCore/llint/LowLevelInterpreter.asm /«PKGBUILDDIR»/obj-i586-kfreebsd-gnu/DerivedSources/JavaScriptCore/LLIntDesiredOffsets.h

This piece of code takes all -I arguments and puts them in the
includeDirs list:

    def self.processIncludeOptions()
        while ARGV[0][/-I/]
            path = ARGV.shift[2..-1]
            if not path
                path = ARGV.shift
            end
            @@includeDirs << (path + "/")
        end
    end

Since the last command-line arguments are not include directories but
paths to files, the "while ARGV[0][/-I/]" condition will return false
and the loop will exit.

However in Debian the name of the build directory is generated
randomly and it can happen to contain the "-I" string
(e.g. '/tmp/build/webkit2gtk-IKCuVo'). The above code will treat that
as an include dir and will continue looping. After all command-line
arguments are parsed, ARGV[0] will be nil and ARGV[0][/-I/] will throw
the "undefined method" error.
Comment 2 Alberto Garcia 2016-04-27 00:54:04 PDT
Created attachment 277456 [details]
Patch

And here's the patch.

I think it's simple enough but someone with better ruby-fu than me please correct me if there's a better way to do it.
Comment 3 Carlos Garcia Campos 2016-04-27 03:07:21 PDT
Comment on attachment 277456 [details]
Patch

I have no idea about ruby, but this looks simple enough.
Comment 4 Alberto Garcia 2016-04-27 04:12:12 PDT
Committed r200125: <http://trac.webkit.org/changeset/200125>