Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build latest master on macOS Mojave with Xcode 10 #2574

Closed
xtmq opened this issue Dec 28, 2018 · 19 comments
Closed

Can not build latest master on macOS Mojave with Xcode 10 #2574

xtmq opened this issue Dec 28, 2018 · 19 comments

Comments

@xtmq
Copy link
Contributor

xtmq commented Dec 28, 2018

I can not build xamarin android sdk on my mac. Maybe someone has any clue whats going wrong... Thanks for any advice =)

First issue for 'make prepare'

"/Users/xtmq/xamarin-android/build-tools/ThirdPartyNotices/ThirdPartyNotices.csproj" (default target) (1) ->
"/Users/xtmq/xamarin-android/build-tools/xa-prep-tasks/xa-prep-tasks.csproj" (default target) (2:2) ->
(GetXAVersionInfo target) ->
  /Users/xtmq/xamarin-android/build-tools/scripts/XAVersionInfo.targets(53,5): error MSB6006: "git" exited with code 128. [/Users/xtmq/xamarin-android/build-tools/xa-prep-tasks/xa-prep-tasks.csproj]

"/Users/xtmq/xamarin-android/build-tools/ThirdPartyNotices/ThirdPartyNotices.csproj" (default target) (1) ->
"/Users/xtmq/xamarin-android/build-tools/xa-prep-tasks/xa-prep-tasks.csproj" (default target) (2:2) ->
  /Users/xtmq/xamarin-android/build-tools/scripts/XAVersionInfo.targets(61,5): error MSB4044: The "GitCommitsInRange" task was not given a value for the required parameter "StartCommit". [/Users/xtmq/xamarin-android/build-tools/xa-prep-tasks/xa-prep-tasks.csproj]

This happens because command git blame "/Users/xtmq/xamarin-android/Configuration.props" does not work, it tells «/Users/xtmq/xamarin-android/Configuration.props» is outside repository.

Everything works if I paths msbuild targets to pass relative (to repository root) path, in this case just git blame "Configuration.props".

Second issue for 'make jenkins'

"/Users/xtmq/xamarin-android/Xamarin.Android.sln" (default target) (1) ->
"/Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj" (default target) (2) ->
(_CreateMxeToolchains target) ->
  clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
  /Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.targets(115,5): error MSB3073: The command "make -j8 provision-mxe DISABLE_IOS=1 MXE_SRC="/Users/xtmq/xamarin-android/build-tools/android-toolchain//../../external/mxe" MXE_PREFIX_DIR="/Users/xtmq/android-toolchain"" exited with code 2. [/Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]

Make output: make: *** No rule to make target provision-mxe'.`

Version Information

Visual Studio Community 2017 for Mac
Version 7.7.2 (build 21)
Installation UUID: b216fd0f-8565-4976-93dc-e21853486a27
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

NuGet
Version: 4.8.0.5385

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.1.2
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Version: 2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Sdks

Apple Developer Tools
Xcode 10.1 (14460.46)
Build 10B61

Xamarin.Mac
Version: 5.2.1.12 (Visual Studio Community)
Hash: 65ec520f
Branch:
Build date: 2018-12-05 12:06:09-0500

Xamarin.iOS
Version: 12.2.1.12 (Visual Studio Community)
Hash: 65ec520f
Branch: d15-9
Build date: 2018-12-05 12:06:09-0500

Xamarin.Android
Version: 9.1.4.2 (Visual Studio Community)
Android SDK: Not found

Android Device Manager
Version: 7.7.1.0
Hash: 06ceaea1

Operating System
Mac OS X 10.14.2
Darwin 18.2.0 Darwin Kernel Version 18.2.0
Mon Nov 12 20:24:46 PST 2018
root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

Mono JIT compiler version 5.18.0.225 (2018-08/bac9fc1f889 Fri Dec 21 11:33:29 EST 2018)
Git version 2.20.1

@xtmq
Copy link
Contributor Author

xtmq commented Jan 5, 2019

Maybe this is the reason for the issue 2, but have no idea how to handle it:

ld : warning : The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS) [/Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
ld : warning : ignoring file /Applications/Xcode101.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode101.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd [/Users/xtmq/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
  Undefined symbols for architecture i386:
    "___error", referenced from:
        _connect in nonetwork-735944.o
    "___stderrp", referenced from:
        _print_message in nonetwork-735944.o
    "_fflush", referenced from:
        _print_message in nonetwork-735944.o
    "_fprintf", referenced from:
        _print_message in nonetwork-735944.o
  ld: symbol(s) not found for architecture i386

@jonpryor
Copy link
Member

jonpryor commented Jan 9, 2019

Regarding the make prepare issue, your git checkout is probably somewhat partially corrupt. (Why would it be corrupt? No idea. How would you fix it? No idea, short of deleting it and creating a new checkout.)

All I can say is that I have occasionally seen my own checkouts report similar errors -- e.g. by moving my checkout to a different directory -- but I don't remember all circumstances which case git to not like me anymore. See also:
#2594 (comment)

I don't know if this is something fixable. That said, we should certainly improve the error reporting aspect here; you shouldn't need to manually run git commands to see the actual error message! :-)

Back on the "corruptness" angle, I suspect that if you did git pull --rebase or git submodule update init or git log, one or all of those commands would fail with the same error.

@jonpryor
Copy link
Member

jonpryor commented Jan 9, 2019

Regarding the linker error, the "problem" is twofold:

  1. You're using make jenkins, which
  2. Builds MXE.

Building MXE is extremely fickle, and is not necessary unless you want/need Windows binaries for an updated mono. (The MXE story is also something that we need to address at some point in the future, because it is so fickle to build.)

If you don't need a Windows binaries, then don't build them:

make jenkins ALL_HOST_ABIS="`uname`" ALL_AOT_ABIS=""

This should avoid the MXE build failure.

If you do need MXE, then you should install an older Xcode version which supports generating 32-bit native binaries, presumably Xcode 9.x.

@xtmq
Copy link
Contributor Author

xtmq commented Jan 9, 2019

Thanks a lot! I will try to fix my git repo first of all!
Actually I have XCode 9.x installed along with 10.0. Probably I have to mark it as a default XCode instance.

@xtmq
Copy link
Contributor Author

xtmq commented Jan 9, 2019

So when I clone repository in the next folders make prepare works fine:

~\xamarin-android                 works
~\xamarin\xamarin-android         works  

But if I add a one (two, three, etc) more level it crashes with the error above:

~\work\xamarin\xamarin-android    does not work

Also I have removed xCode 10.0 and installed 9.4. But I still have the same linker error, but another warning:

  ld : warning : ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, 
   missing required architecture i386 in file
  /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
  [/Users/xtmq/xamarin/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]

@xtmq
Copy link
Contributor Author

xtmq commented Jan 10, 2019

make jenkins ALL_HOST_ABIS="`uname`" ALL_AOT_ABIS=""

works =)

@jonpryor
Copy link
Member

As per your warning, you're still using the SDK for macOS 10.14, which has deprecated 32-bit support, and as part of that deprecation Apple is not providing the 32-bit slices for libraries.

Please try using the macOS 10.13 SDKs, if necessary.

That said, your followup comment suggests that things are working for you now, so... :-)

@xtmq
Copy link
Contributor Author

xtmq commented Jan 10, 2019

Yes, I think you can close the issue =)
But I suggest add this magic command to the wiki. I do not think, I'm the only one with macOS 10.14...

@pjcollins
Copy link
Member

@jonpryor @grendello as for the clang linker error reported above which occurs in _CreateMxeToolchains[0], we can avoid it by bringing mxe/mxe@a063f9b into our MXE fork. After applying that patch locally and modifying https://github.com/mono/mono/blob/master/sdks/versions.mk#L4, I was able to successfully complete a full make jenkins build on macOS Mojave using Xcode 10.1.

[0]

_CreateMxeToolchains:
  /usr/bin/git rev-parse HEAD 
  make -j8 provision-mxe DISABLE_IOS=1 MXE_SRC="/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe" MXE_PREFIX_DIR="/Users/peter/android-toolchain"
  rm -rf /Users/peter/android-toolchain/mxe-b9cbb53 /Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe
  Cloning into '/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe'...
  git clone -b xamarin https://github.com/xamarin/mxe.git /Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe \
  		&& git -C /Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe checkout b9cbb53541a0e10fe4fe81f22bd586cb9cdc922a
  Note: checking out 'b9cbb53541a0e10fe4fe81f22bd586cb9cdc922a'.
  
  You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by performing another checkout.
  
  If you want to create a new branch to retain commits you create, you may
  do so (now or later) by using -b with the checkout command again. Example:
  
    git checkout -b <new-branch-name>
  
  HEAD is now at b9cbb535 [ci] Add a jenkins build script.
  /Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/peter/source/pj/xamarin-android/build-tools/android-toolchain//../../external/mxe gcc cmake zlib pthreads dlfcn-win32 mman-win32 \
  		PREFIX="/Users/peter/android-toolchain/mxe-b9cbb53" MXE_TARGETS="i686-w64-mingw32.static x86_64-w64-mingw32.static" \
  			OS_SHORT_NAME="disable-native-plugins" PATH="$PATH:/Users/peter/android-toolchain/mxe-b9cbb53/bin:/usr/local/Cellar/gettext/0.19.8.1/bin/"
  [create settings.mk]
  [download]  gmp
  [download]  googletest
  [download]  geoip-database
  [download]  googlemock
  [download]  cmake
  [download]  isl
  [download]  libltdl
  [download]  lzma
  [download]  mpfr
  [download]  mpc
  [download]  pkgconf
  [download]  protobuf
  [download]  ragel
  [download]  ucl
  [download]  zlib
  [download]  upx
  [download]  waf
  [download]  yasm
  [download]  bfd
  [download]  gendef
  [download]  gcc
  [download]  dlfcn-win32
  [download]  mman-win32
  [check requirements]
  [build nonetwork lib]
ld : warning : The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS) [/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
ld : warning : ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd [/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
  Undefined symbols for architecture i386:
    "___error", referenced from:
        _connect in nonetwork-c59b8b.o
    "___stderrp", referenced from:
        _print_message in nonetwork-c59b8b.o
    "_fflush", referenced from:
        _print_message in nonetwork-c59b8b.o
    "_fprintf", referenced from:
        _print_message in nonetwork-c59b8b.o
  ld: symbol(s) not found for architecture i386
clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj]
  make[2]: *** [/Users/peter/android-toolchain/mxe-b9cbb53/x86_64-apple-darwin18.2.0/lib/nonetwork.dylib] Error 1
  make[2]: *** Waiting for unfinished jobs....
Attempting to cancel the build...
  make[2]: *** [download-only-yasm-1.3.0.tar.gz] Interrupt: 2
  make[2]: *** [download-only-gmp-6.1.2.tar.xz] Interrupt: 2
Done Building Project "/Users/peter/source/pj/xamarin-android/Xamarin.Android.sln" (default targets) -- FAILED.
Done Building Project "/Users/peter/source/pj/xamarin-android/build-tools/android-toolchain/android-toolchain.csproj" (default targets) -- FAILED.

Build FAILED.

@pjcollins pjcollins changed the title Can not build latest master Can not build latest master on macOS Mojave with Xcode 10 Feb 7, 2019
@jonpryor
Copy link
Member

jonpryor commented Feb 8, 2019

mxe/mxe@a063f9b works by removing -arch i386, which I assume disables 32-bit support.

@alanmcgovern, @garuma: Do we need a 32-bit libono-android.debug.dll? I assume we do, as Visual Studio is a 32-bit process, but I am not certain.

@jonpryor
Copy link
Member

jonpryor commented Feb 8, 2019

@pjcollins: @grendello and I have an idea of dumping MXE in favor of using Homebrew's mingw-w64 formulae, which appears to install both 32-bit and 64-bit compilers (until the next macOS release...?).

@pjcollins
Copy link
Member

As far as I could tell win-32 versions of libmono-android.*.dll don't end up making it into the Windows installer. I could only find non arm / x86 variants in $MSBuild/Xamarin/Android, and those appear to be 64-bit. It's quite possible (probable) I'm over looking something here though as I'm getting up to speed.

@garuma
Copy link
Contributor

garuma commented Feb 8, 2019

We only use the 64bits version (it's loaded in a separate process than devenv which is indeed 32bits) so from our point of view it's fine to axe 32bits on Windows.

@xtmq
Copy link
Contributor Author

xtmq commented Mar 12, 2019

By the way I have tries to build SDK via make jenkins one more time on High Sierra and with xcode 9.4.1, but it still does not work:

/Users/xtmq/xamarin/xamarin-android/src/mono-runtimes/mono-runtimes.targets(301,5): error MSB3073: The command "make DISABLE_IOS=1 -j4 package-android-armeabi-v7a package-android-arm64-v8a package-android-x86 package-android-x86_64 package-android-host-mxe-Win64 package-android-host-mxe-Win32 package-android-host-Darwin package-android-cross-arm package-android-cross-arm64 package-android-cross-x86 package-android-cross-x86_64 package-android-cross-arm-win package-android-cross-arm64-win package-android-cross-x86-win package-android-cross-x86_64-win package-android-bcl provision-llvm-llvm32 provision-llvm-llvm64 provision-llvm-llvmwin32 provision-llvm-llvmwin64 CONFIGURATION=debug IGNORE_PROVISION_MXE=true IGNORE_PROVISION_ANDROID=true ANDROID_TOOLCHAIN_DIR="/Users/xtmq/android-toolchain" ANDROID_TOOLCHAIN_CACHE_DIR="/Users/xtmq/android-archives" ANDROID_TOOLCHAIN_PREFIX="/Users/xtmq/android-toolchain/toolchains" LLVM_SRC="/Users/xtmq/xamarin/xamarin-android/src/mono-runtimes/../../external/llvm" MXE_PREFIX_DIR="/Users/xtmq/android-toolchain" MXE_SRC="/Users/xtmq/xamarin/xamarin-android/src/mono-runtimes/../../external/mxe"" exited with code 2. [/Users/xtmq/xamarin/xamarin-android/src/mono-runtimes/mono-runtimes.csproj]

make: *** No rule to make target `package-android-armeabi-v7a'. Stop.

But there is no suspictios warning this time, maybe only:

/Users/xtmq/xamarin/xamarin-android/build-tools/download-bundle/download-bundle.targets(26,5): warning : Unable to download URL https://xamjenkinsartifact.azureedge.net/mono-jenkins/xamarin-android-debug/xamarin-android/bin/Debug/bundle-v21-h32e3b1b9-Debug-Darwin-libzip=b95cf3f,llvm=349752c,mono=5ad371d.zip to /Users/xtmq/android-archives/bundle-v21-h32e3b1b9-Debug-Darwin-libzip=b95cf3f,llvm=349752c,mono=5ad371d.zip: 404 (Not Found)

Could you provide me any hint what I do wrong? Thanks =)

@xtmq
Copy link
Contributor Author

xtmq commented Mar 13, 2019

I was managed to build SDK by removing external folder and run build from scratch one more time =)

@xtmq
Copy link
Contributor Author

xtmq commented Jul 10, 2019

So what status on the issue @pjcollins ?
It seems I still can not build 'xamarin-android-9.2.0.3' on Mojave and I still see errors like
ld: symbol(s) not found for architecture i386

@pjcollins
Copy link
Member

pjcollins commented Jul 10, 2019

@xtmq is there a particular reason you need to build XA 9.2? If you check out the latest master commit and follow these instructions you should be able to build on Mojave now. The build system fixes that enabled this will likely not be able to be applied to older branches.

You should be able to run a complete OSS master build on Mojave with the following commands:

  1. Install the few dependencies which can't be automatically provisioned.
  2. make prepare-update-mono V=1 CONFIGURATION=$(Configuration) PREPARE_AUTOPROVISION=1
  3. make jenkins V=1 CONFIGURATION=$(Configuration) PREPARE_AUTOPROVISION=1

@xtmq
Copy link
Contributor Author

xtmq commented Jul 14, 2019

Yes, I can build latest master without issues with the commands above, thanks!
When you are going to publish the next stable release from master?
And I think we can close this issue.

@pjcollins
Copy link
Member

The d16-3 branch should be available in a public preview in the coming weeks, this was branched from master about a month ago.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants