Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrambled arguments when building OpenJDK

When trying to build OpenJDK, I get a series of errors while doing make all:

/usr/bin/make: invalid option -- '8'
/usr/bin/make: invalid option -- '/'
/usr/bin/make: invalid option -- 'a'
/usr/bin/make: invalid option -- '/'
/usr/bin/make: invalid option -- 'c'

Running make all LOG=trace JOBS=1 gives

+ /usr/bin/make VERBOSE= LOG_LEVEL=trace -R -I /home/ft/openjdk8/make/common -f adlc.make -r -rRw -I/home/ft/open -j1 -dk8/make/common -I/home/ft/openjdk8/make/common -I/home/ft/openjdk8/make/common -I/home/ft/openjdk8/make/common -I/home/ft/openjdk8/make/common

as the bad argument. The relevent section is -I/home/ft/open -j1 -dk8/make/common. grep -R 'I/home/ft/open -j1 -dk8/make/common' turns up nothing more than the log. This occurs with ./configure --enable-debug and without.

I found an issue on a mailing list that seems similar, but it appears that he gave up.

Edit: Searched for -ji, make/HotspotWrapper.gmk:@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC)) is the main candidate for breaking things

like image 572
user60561 Avatar asked Jan 20 '14 23:01

user60561


2 Answers

Here's what did it for me. Apply the following patch inside the hotspot directory:

diff -r 87ee5ee27509 make/linux/makefiles/adjust-mflags.sh
--- a/make/linux/makefiles/adjust-mflags.sh Tue Mar 04 11:51:03 2014 -0800
+++ b/make/linux/makefiles/adjust-mflags.sh Wed Sep 30 16:51:55 2015 -0700
@@ -64,7 +64,6 @@
    echo "$MFLAGS" \
    | sed '
        s/^-/ -/
-       s/ -\([^    ][^     ]*\)j/ -\1 -j/
        s/ -j[0-9][0-9]*/ -j/
        s/ -j\([^   ]\)/ -j -\1/
        s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/

It looks like one of the rules is just too wide and is matching random directories if they contain a j and happen to come after a dash.

like image 52
Mark Winterrowd Avatar answered Sep 29 '22 10:09

Mark Winterrowd


This appears to be part of a documented bug (JDK-8028407). The fix for this was to downgrade my make to 3.82, which does manage to compile OpenJDK.

like image 35
user60561 Avatar answered Sep 29 '22 11:09

user60561