I wanted to document a build issue that I ran into -

Problem Summary: If you build Android with POSIXLY_CORRECT environment
variable set, the build fails (non fast) with an obtuse error message.
Developer workaround: Don't build with POSIXLY_CORRECT set!
-- In the Bash shell this means, 'unset POSIXLY_CORRECT '
As a new Android builder this one bit me the first time I tried to
compile Android.

I suggest a simple Build Fix: Prepend the following to build/core/
main.mk so that the build fails-fast with a more useful error message:

# Check that POSIXLY_CORRECT is not defined. Otherwise apriori tool
chokes on '--output' argument
ifdef POSIXLY_CORRECT
$(warning
********************************************************************************)
$(warning *  unset POSIXLY_CORRECT environment variable to build
Android!)
$(warning
********************************************************************************)
$(error stopping)
endif

I also suggest adding a sentence to the introductory build instructions
(http://source.android.com/download). e.g. Although POSIXLY_CORRECT is
required to install the build environment on a MAC OSX, the build
system currently requires POSIXLY_CORRECT to be undefined when make-
ing Android.
This would be useful for new developers checking non-current branches
(e.g. cupcake)
--

Here's the original cryptic build error ... (well it was cryptic for
me because this was my first Android build attempt ... So there were
many potential causes)

target Prelink: libdl (out/target/product/generic/symbols/system/lib/
libdl.so)
build/tools/apriori/apriori.c(2100): Could not find [--output] in the
current directory or in any of the search paths!
make: *** [out/target/product/generic/symbols/system/lib/libdl.so]
Error 1

My guess at the root cause: apriori tool uses getopt_long  in build/
tools/apriori/cmdline.c. getopt_long changes its behavior if the
aforementioned env. variable is set (see man page). Perhaps the
calling code does not check for this?
man getopt_long extract:
     POSIXLY_CORRECT  If set, option processing stops when the first
non-option is found and a leading `-' or `+' in the optstring is
ignored.

Perhaps someone wants to 'fix' apriori to work correctly. Though I'm
not sure that's a good use of anyone's time!
Hope this note is useful.

Regards,
EHermit (Lawrence)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to