Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

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

Merged
jonpryor merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-fix-xa-build-1
Aug 16, 2019
Merged

[java-interop] Xamarin.Android host compilation fixes#475
jonpryor merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-fix-xa-build-1

Conversation

@jonpryor

Copy link
Copy Markdown
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:masterAug 16, 2019
@jonpryor
jonpryor deleted the jonp-fix-xa-build-1 branch August 16, 2019 19:57
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 13, 2024
Sign up for freeto 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

@jonpryor@grendello