Kebechet/Maui.RevenueCat.InAppBilling

Can't build with .NET 8 RC2

Closed this issue ยท 12 comments

I am trying to upgrade my project to .NET 8, however the iOS build is always returning the following error:

1>Xamarin.Shared.Sdk.targets(1556,3): Error  : clang++ exited with code 1:
ld: warning: ignoring duplicate libraries: '-lSystem.Globalization.Native', '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmono-component-marshal-ilgen', '-lmonosgen-2.0', '-lxamarin-dotnet-debug'
ld: warning: duplicate LC_RPATH are deprecated ('@executable_path/Frameworks')
ld: warning: duplicate LC_RPATH are deprecated ('@loader_path/Frameworks')
ld: building for 'iOS-simulator', but linking in dylib (/PathToCodei/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/RevenueCat.framework/RevenueCat) built for 'iOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I couldn't really see anything in the RevenueCat project file that would cause this, however can't see anything in mine either. Anyway it just seems to be this package showing an error!

I have just tried this in a new .NET 8 project using RC2. I can confirm that just adding the Kebecht.Maui.RevenueCat.InAppBilling package throws this error during build.

Hello, thanks for report. This seems to be a problem in ios binding library:
https://github.com/Kebechet/Maui.RevenueCat.iOS

When I have some free time I will take a look. But for now .NET 8 compatibility is not a big priority for us because we plan to update our main project to .NET8 in january.

No worries. In the end I got it working by adding this line to force it to build for x64:

<RuntimeIdentifier Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">iossimulator-x64</RuntimeIdentifier>

I have updated to latest dotnet 7.0.402 with newest VS and I experience the same problem. So it seems not to be .NET8 problem
dotnet/maui#16778

I'm also experiencing this problem, I've been hesitant to update as I'm about to ship... my versions are:

โ”–[~]> dotnet --info
.NET SDK:
 Version:   7.0.401
 Commit:    eb26aacfec

โ”–[~]> dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
maui-maccatalyst           7.0.92/7.0.100         VS 17.7.34031.279
maccatalyst                16.4.7098/7.0.100      VS 17.7.34031.279
maui-windows               7.0.92/7.0.100         VS 17.7.34031.279
maui-ios                   7.0.92/7.0.100         VS 17.7.34031.279
ios                        16.4.7098/7.0.100      VS 17.7.34031.279
maui-android               7.0.92/7.0.100         VS 17.7.34031.279
android                    33.0.68/7.0.100        VS 17.7.34031.279
wasm-tools                 7.0.11/7.0.100         VS 17.7.34031.279

I was thinking it had to do with the bindings package not including something needed to support the ios simulator. I only see this issue with the simulator. I'll try the suggested workaround...

I migrated my project forward to latest and greatest of everything and got everything working on Android and Windows, but I'm not having any success with the suggested workaround for ios.

โ”–[~]> dotnet --info
.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.8d38d0cc

โ”–[~]> dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
maui                       8.0.3/8.0.100          SDK 8.0.100
maui-android               8.0.3/8.0.100          SDK 8.0.100
maui-ios                   8.0.3/8.0.100          SDK 8.0.100
wasm-tools                 8.0.0/8.0.100          VS 17.8.34316.72
maui-windows               8.0.3/8.0.100          VS 17.8.34316.72
maccatalyst                17.0.8478/8.0.100      VS 17.8.34316.72
ios                        17.0.8478/8.0.100      VS 17.8.34316.72
android                    34.0.43/8.0.100        VS 17.8.34316.72

I added this line:


	<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
		<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
	</PropertyGroup>

and still I'm getting this error:

Severity	Code	Description	Project	File	Line	Suppression State
Error		clang++ exited with code 1:
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/cameronvetter/Library/Caches/Xamarin/mtbs/builds/BoardGameCopilot/69c8f38bac73f58a258691ce73bd1414660fd9e37b9d56348cc8ce9086cf56ae/obj/Debug/net8.0-ios/iossimulator-x64/linker-cache/RevenueCat.framework/RevenueCat' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)	Board Game Copilot	C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets	1556	

@varyamereon Any advice on what I did wrong on the workaround?

@Kebechet Any progress on tracking this down?

No progress from my side, I have it running on .NET 7 and as I mentioned before, I won't have time for updating everything to .NET8 till mid-january. Sorry but until then I have many tasks with higher priority on our main product and I simply don't have time to track this down and fix it in the library itself without any workarounds.

Question: @CameronVetter do you have problem only in simulator or also on real device ? Because just lately I released our app with updated v3.0.0 of this package and it works fine.

No progress from my side, I have it running on .NET 7 and as I mentioned before, I won't have time for updating everything to .NET8 till mid-january. Sorry but until then I have many tasks with higher priority on our main product and I simply don't have time to track this down and fix it in the library itself without any workarounds.

Question: @CameronVetter do you have problem only in simulator or also on real device ? Because just lately I released our app with updated v3.0.0 of this package and it works fine.

Good catch it does build just fine on the remote device, slightly inconvenient but workable for the moment. I don't know why I didn't try that...

In the end, I had to roll back to .net 7 I could not get the right combo of versions of the Google Play Store / .net 8 / android 34 / revenuecat bindings for the Google Play Store to accept the APK. I don't see this package working with .net 8 until the bindings are updated, unfortunately.

I am sorry to hear that. In january I will update everything necessary and I will make it work on .NET8.

@CameronVetter @varyamereon please test:
https://www.nuget.org/packages/Kebechet.Maui.RevenueCat.InAppBilling/4.0.0-preview1
it is a pre-release so in VS you have to enable prerelease versions

  • I have created our own Android binding, so now we don't depend on other 3rd party bindings
  • I have created new version of iOS binding. For this to work you need everything up to date:
    • VS 17.8.5
    • .NET SDK 8.0.100
    • XCode 15.2 (theoretically 15.1 could work as well)
    • โš ๏ธBeware! For some reason iOS version doesn't work in debug with LocalDevice(iphone connected to Windows through cable) but works with RemoteDevice (Windows host with connection to MAC and to that mac is connected iPhone through cable). I will investigate this more.

If you will have time please test this and give me feedback. I am adjusting my main project and I will do some tests as well.

PS: If you are interested how those bindings are done I tried to document the whole process into READMEs:

EDIT: Tested in TestFlight and GooglePlay internal testing. Seems to be working correctly.

Resolved in #27