Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2950467&view=results

Commit 5fe28cd didn't go far enough. While the xamarin-android build
is no longer trying to include <mono/metadata/assembly.h>, we get a
new set of compilation errors:

/Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-gc-bridge-mono.cc(34,2): error GF2D19E48: unknown type name 'MonoClass'; did you mean 'xamarin::android::MonoClass'?
          MonoClass          *klass;
          ^~~~~~~~~
          xamarin::android::MonoClass
  ../../../jni/dylib-mono.h:101:31: note: 'xamarin::android::MonoClass' declared here
          typedef struct _MonoClass {} MonoClass;
                                       ^

This is because the using namespace xamarin::android on
java-interop-gc-bridge-mono.cc line 30 isn't evaluated, as ANDROID
isn't defined during host builds of xamarin-android/src/monodroid
(which builds e.g. libmono-android.debug.* for macOS & Windows).

Add XAMARIN_ANDROID_DYLIB_MONO to the #if list, so that the
using namespace statement is used on host builds.

Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2950467&view=results

Commit 5fe28cd didn't go far enough.  While the xamarin-android build
is no longer trying to include `<mono/metadata/assembly.h>`, we get a
new set of compilation errors:

	/Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-gc-bridge-mono.cc(34,2): error GF2D19E48: unknown type name 'MonoClass'; did you mean 'xamarin::android::MonoClass'?
	          MonoClass          *klass;
	          ^~~~~~~~~
	          xamarin::android::MonoClass
	  ../../../jni/dylib-mono.h:101:31: note: 'xamarin::android::MonoClass' declared here
	          typedef struct _MonoClass {} MonoClass;
	                                       ^

This is because the `using namespace xamarin::android` on
`java-interop-gc-bridge-mono.cc` line 30 isn't evaluated, as `ANDROID`
isn't defined during *host* builds of xamarin-android/src/monodroid
(which builds e.g. `libmono-android.debug.*` for macOS & Windows).

Add `XAMARIN_ANDROID_DYLIB_MONO` to the `#if` list, so that the
`using namespace` statement is used on host builds.
@jonpryor jonpryor merged commit 6dd1cf4 into dotnet:master Aug 16, 2019
@jonpryor jonpryor deleted the jonp-fix-xa-build-1 branch August 16, 2019 19:57
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants