Handle an NSPR configure script generated with autoconf 2.68

RESOLVED FIXED in mozilla31

Status

defect
P2
normal
RESOLVED FIXED
5 years ago
Last year

People

(Reporter: wtc, Assigned: wtc)

Tracking

unspecified
mozilla31
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

2.35 KB, patch
glandium
: review+
Details | Diff | Splinter Review
Posted patch Patch (obsolete) — Splinter Review
To work with an NSPR configure script generated with autoconf 2.68 or
autoconf 2.69, some changes are needed in configure.in.

1. The cache.config file cannot be shared because NSPR's configure
script will exit with errors like these:

================================================================
configuring in nsprpub
running /bin/sh /builds/slave/try-and-x86-000000000000000000/build/nsprpub/configure  --enable-crashreporter --enable-release --enable-elf-hack --enable-application=mobile/android --target=arm-linux-androideabi --with-android-ndk=/builds/slave/try-and-x86-000000000000000000/build/android-ndk --with-android-sdk=/builds/slave/try-and-x86-000000000000000000/build/android-sdk-linux/platforms/android-16 --with-android-gnu-compiler-version=4.7 --with-android-version=9 --with-system-zlib --enable-update-channel= --enable-warnings-as-errors '--with-compiler-wrapper=python2.7 /builds/slave/try-and-x86-000000000000000000/build/sccache/sccache.py' --enable-stdcxx-compat --target=i386-linux-android --enable-profiling --disable-elf-hack --with-branding=mobile/android/branding/nightly --with-dist-prefix=/builds/slave/try-and-x86-000000000000000000/build/obj-firefox/dist --with-mozilla --disable-debug --enable-optimize --with-android-toolchain=/builds/slave/try-and-x86-000000000000000000/build/android-ndk/toolchains/x86-4.7/prebuilt/linux-x86_64 --with-android-version=9 --cache-file=.././config.cache --srcdir=/builds/slave/try-and-x86-000000000000000000/build/nsprpub
configure: WARNING: unrecognized options: --enable-crashreporter, --enable-release, --enable-elf-hack, --enable-application, --with-android-sdk, --with-android-gnu-compiler-version, --with-system-zlib, --enable-update-channel, --enable-warnings-as-errors, --with-compiler-wrapper, --enable-stdcxx-compat, --enable-profiling, --disable-elf-hack, --with-branding
configure: loading cache .././config.cache
configure: error: `host_alias' was set to `i386-linux-android' in the previous run
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  `-Wall -Wpointer-arith -Wdeclaration-after-statement -Werror=return-type -Werror=int-to-pointer-cast -Wtype-limits -Wempty-body -Wsign-compare -Wno-unused -Wcast-align -Wno-error=uninitialized -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -mandroid -fno-short-enums -fno-exceptions -std=gnu99 -fgnu89-inline -fno-strict-aliasing -ffunction-sections -fdata-sections -fno-math-errno -pipe -g -std=c99'
configure:   current value: ` -fno-omit-frame-pointer -funwind-tables'
configure: error: `LDFLAGS' has changed since the previous run:
configure:   former value:  ` -mandroid -L/builds/slave/try-and-x86-000000000000000000/build/android-ndk/platforms/android-9/arch-x86/usr/lib -Wl,-rpath-link=/builds/slave/try-and-x86-000000000000000000/build/android-ndk/platforms/android-9/arch-x86/usr/lib --sysroot=/builds/slave/try-and-x86-000000000000000000/build/android-ndk/platforms/android-9/arch-x86 -llog -Wl,--allow-shlib-undefined  -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id -Wl,--icf=safe '
configure:   current value: `  -Wl,-z,text -Wl,--build-id'
configure: error: `CPPFLAGS' has changed since the previous run:
configure:   former value:  `-idirafter /builds/slave/try-and-x86-000000000000000000/build/android-ndk/platforms/android-9/arch-x86/usr/include  -g'
configure:   current value: `'
configure: error: in `/builds/slave/try-and-x86-000000000000000000/build/obj-firefox/nsprpub':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm .././config.cache' and start over
configure: error: /builds/slave/try-and-x86-000000000000000000/build/nsprpub/configure failed for nsprpub
================================================================

As a result, the top-level configure script and NSPR's configure
script cannot share a config.cache file. I copied some of the
changes from the arguments for libffi's configure script in
build/autoconf/ffi.m4.

2. If --host= is set but --build= isn't, NSPR's configure script
emits this warning message:

configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used

The patch fixes these problems.

Note: the error about "host_alias" in #1 seems to be caused by passing
--host=i386-linux-android to build/modules/freetype2/configure and
build/modules/freetype2/builds/unix/configure, which recorded host_alias
in the shared config.cache file. If so, it is a separate bug. Also note
that in that try build, we seem to pass two conflicting --target= options:

================================================================
cp /builds/slave/try-and-x86-000000000000000000/build/.mozconfig obj-firefox/.mozconfig
cd obj-firefox
/builds/slave/try-and-x86-000000000000000000/build/configure
Adding configure options from /builds/slave/try-and-x86-000000000000000000/build/.mozconfig:
  --enable-crashreporter
  --enable-release
  --enable-elf-hack
  --enable-application=mobile/android
  --target=arm-linux-androideabi
  --with-android-ndk=/builds/slave/try-and-x86-000000000000000000/build/android-ndk
  --with-android-sdk=/builds/slave/try-and-x86-000000000000000000/build/android-sdk-linux/platforms/android-16
  --with-android-gnu-compiler-version=4.7
  --with-android-version=9
  --with-system-zlib
  --enable-update-channel=
  --enable-warnings-as-errors
  --with-compiler-wrapper=python2.7 /builds/slave/try-and-x86-000000000000000000/build/sccache/sccache.py
  --enable-stdcxx-compat
  --target=i386-linux-android
  --enable-profiling
  --disable-elf-hack
  --with-branding=mobile/android/branding/nightly
================================================================

See https://tbpl.mozilla.org/php/getParsedLog.php?id=36034260&tree=Try&full=1#error0
for the full build log.
Attachment #8391665 - Flags: review?(mh+mozilla)
Comment on attachment 8391665 [details] [diff] [review]
Patch

Review of attachment 8391665 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the following addressed.

::: configure.in
@@ +9012,5 @@
>      export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
>      export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
>  
> +    # Use a separate cache file for NSPR since it uses autoconf 2.68.
> +    mkdir -p $_objdir/nsprpub

You shouldn't need to create the directory.

@@ +9013,5 @@
>      export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
>  
> +    # Use a separate cache file for NSPR since it uses autoconf 2.68.
> +    mkdir -p $_objdir/nsprpub
> +    old_cache_file=$cache_file

_save_cache_file

@@ +9016,5 @@
> +    mkdir -p $_objdir/nsprpub
> +    old_cache_file=$cache_file
> +    cache_file=$_objdir/nsprpub/config.cache
> +    old_config_files=$CONFIG_FILES
> +    unset CONFIG_FILES

we already unset earlier.
Attachment #8391665 - Flags: review?(mh+mozilla) → review+
Note this is going, sadly, to make configure even slower than it already is on windows...
(which makes me wonder if we should really do it, gps, what do you think?)
Flags: needinfo?(gps)
More build slowness in configure saddens me. But if it's necessary to avoid bugs, then I suppose our hands are bound.

I do wonder if we can eventually have Python orchestrate configure invocations. We might be able to perform some interesting caching. e.g. maintain hashes of all files in the source tree and don't run configure unless things have changed. This would also help with ICU. But that's for another day.
Flags: needinfo?(gps)
Posted patch Patch v2Splinter Review
Mike:

Thank you for the review. I made the changes you
suggested. I found you wrote similar glue code for
jemalloc's configure script, so I also added quotes
to $cache_file and $_save_cache_file as you did.

Patch pushed to mozilla-inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1bb7e442dfbb
Attachment #8391665 - Attachment is obsolete: true
Attachment #8397057 - Flags: review?(mh+mozilla)
Attachment #8397057 - Flags: checkin+
Comment on attachment 8397057 [details] [diff] [review]
Patch v2

Review of attachment 8397057 [details] [diff] [review]:
-----------------------------------------------------------------

::: configure.in
@@ +9165,5 @@
>      fi
>      export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
>      export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
>  
> +    # Use a separate cache file for NSPR since it uses autoconf 2.68.

Mike: the changes in patch v2 start here. So you just need to check from this line to the end of the patch.
https://hg.mozilla.org/mozilla-central/rev/1bb7e442dfbb
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Depends on: 988733
Attachment #8397057 - Flags: review?(mh+mozilla) → review+
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.