Old build problem: unpack200 failure when setting OTHER_CXXFLAGS in environment (original) (raw)

David Holmes david.holmes at oracle.com
Mon Mar 12 23:21:02 UTC 2012


On 13/03/2012 9:03 AM, Kelly O'Hair wrote:

Just seems like a very poorly written Makefile to me.

Where is the actual webrev or patch, I could not see it.

http://mail.openjdk.java.net/pipermail/build-dev/attachments/20070511/62a3961e/attachment.bin

Mangled by the mail servers. Here's my own patch:

iff --git a/make/com/sun/java/pack/Makefile b/make/com/sun/java/pack/Makefile --- a/make/com/sun/java/pack/Makefile +++ b/make/com/sun/java/pack/Makefile @@ -72,14 +72,14 @@ (ZIPOBJDIR)/inffast.(ZIPOBJDIR)/inffast.(ZIPOBJDIR)/inffast.(OBJECT_SUFFIX)

ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)

This has now been flagged as part of 7153072.

David

-kto

On Mar 11, 2012, at 9:48 PM, David Holmes wrote:

This is a blast from the past:

http://mail.openjdk.java.net/pipermail/build-dev/2007-May/000026.html but the above issue and patch seem to have been ignored. I just ran into this myself. /export/users/dh198349/jdk8/builds/b01/se8-linux-i586-ea/tmp/sun/com.sun.java.util.jar.pack/unpack-cmd/obj/main.o: In function unpacker::run(int, char**)':_ _main.cpp:(.text+0xe0b): undefined reference to gunzip::init(unpacker*)' main.cpp:(.text+0xe1d): undefined reference to `gunzip::start(int)' collect2: ld returned 1 exit status make[7]: *** [/export/users/dh198349/jdk8/builds/b01/se8-linux-i586-ea/bin/unpack200] Error 1 The basic issue is one of recursive makes, with conditionally set variables that might also be set externally in the environment. Here's an example Makefile: build: unpack ifdef STANDALONE FLAGS+=-XstandAlone else FLAGS+=-Xcombined endif unpack: @make STANDALONE=true unpackexe build: @echo build FLAGS = $(FLAGS) unpackexe: @echo unpackexe FLAGS = $(FLAGS) .phony: build unpack unpackexe --- Here's a normal run:

make build make[1]: Entering directory /scratch/dh198349'_ _unpackexe FLAGS = -XstandAlone_ _make[1]: Leaving directory /scratch/dh198349' build FLAGS = -Xcombined which is what we would expect. But if you now give FLAGS an initial external value: FLAGS=external make build make[1]: Entering directory /scratch/dh198349'_ _unpackexe FLAGS = external -Xcombined -XstandAlone_ _make[1]: Leaving directory /scratch/dh198349' build FLAGS = external -Xcombined Yikes! Now unpackexe sees both the STANDALONE and non-STANDALONE value of FLAGS. This is because make re-exports any variable that came in from the environment. So when the top-level make is called, FLAGS==external, and to that the Makefile adds -Xcombined, so the sub-make effectively becomes: make FLAGS="external -Xcombined" STANDALONE=true unpackexe Here's one way to fix this: # save original incoming FLGS ORIGFLAGS := $(FLAGS) # hide any locally modified value of FLAGS unexport FLAGS build: unpack ifdef STANDALONE # override to allow sub-make to add to FLAGS override FLAGS+=-XstandAlone else FLAGS+=-Xcombined endif unpack: # Send in ORIGFLAGS as FLAGS @make FLAGS=$(ORIGFLAGS) STANDALONE=true unpackexe build: @echo build FLAGS = $(FLAGS) unpackexe: @echo unpackexe FLAGS = $(FLAGS) .phony: build unpack unpackexe ---- Or as per the original Patch, use a different variable in the Makefile to that set in the environment. David -----



More information about the build-dev mailing list