Skip to content

[java-interop] Xamarin.Android host compilation fixes #475

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 16, 2019

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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants