Skip to content

Commit

Permalink
[android-toolchain] Provide path to autopoint (#1026)
Browse files Browse the repository at this point in the history
Context: https://devdiv.visualstudio.com/DevDiv/Default/_build/index?buildId=1138882&_a=summary
Context: #606 (comment)

We [discovered 6 months ago][0] that a mono bump was failing to build
because:

[0]: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/966

 1. The Jenkins machine building the PR has Homebrew 1.2.1 installed.

 2. The Jenkins machine attempting to build the PR has never built
    MXE before, as MXE is only required for *full* builds in which the
    mono runtime has changed.

 3. The MXE build failed, because `autopoint` wasn't in `$PATH`:

        Executing: make MXE_TARGETS="i686-w64-mingw32.static" gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX="/Users/builder/android-toolchain /mxe"
        Missing requirement: autopoint

The result is a very sad panda.

This *could* be fixed by force-linking the `gettext` package:

	$ brew link --force gettext

However, this is considered to be overkill, as there may be multiple
other `autopoint`s in `$PATH`. (Presumably there's *some* reason why
Brew 1.2 doesn't install `autopoint` into `$PATH`...)

This same issue also reappeared while attempting to build
xamarin-android within VSTS, as the VSTS bots similarly haven't run
`brew link --force gettext` either.

Fix this issue by overriding `$PATH` when building MXE so that it
contains the path to `autopoint`, as returned by:

	dirname $(brew list gettext | grep autopoint$)
  • Loading branch information
jonpryor authored Nov 15, 2017
1 parent fd83462 commit 20c722a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions build-tools/android-toolchain/android-toolchain.targets
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,18 @@
Condition=" !$(AndroidMxeFullPath.EndsWith ($(_MxeHash))) "
Text="%24(AndroidMxeFullPath) value of `$(AndroidMxeFullPath)` MUST end with `$(_MxeHash)`!"
/>
<PropertyGroup>
<_AutopointPath Condition=" '$(HostOS)' == 'Darwin' ">:%24(dirname %24(brew list gettext | grep autopoint%24))</_AutopointPath>
<_Path>$PATH$(_AutopointPath)</_Path>
</PropertyGroup>
<Exec
Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:'))"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix32)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
Command="PATH=$(_Path) make MXE_TARGETS=&quot;$(MingwCommandPrefix32)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
WorkingDirectory="..\..\external\mxe"
/>
<Exec
Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:'))"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix64)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
Command="PATH=$(_Path) make MXE_TARGETS=&quot;$(MingwCommandPrefix64)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
WorkingDirectory="..\..\external\mxe"
/>
<Touch Files="@(_AndroidMxeOutput)" />
Expand Down

0 comments on commit 20c722a

Please sign in to comment.