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

Unable to build due to "clang++ exited with error code 1" and empty file #22235

Open
bzd3y opened this issue Feb 21, 2025 · 1 comment
Open

Comments

@bzd3y
Copy link

bzd3y commented Feb 21, 2025

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

VS 2022 17.13.1

Description

1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.2\18.2.9180\targets\Xamarin.Shared.Sdk.targets(1665,3): error : clang++ exited with code 1:
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.2\18.2.9180\targets\Xamarin.Shared.Sdk.targets(1665,3): error : ld: file is empty in '/Users/**/Library/Caches/Xamarin/mtbs/builds/**/e714b99856d2d8abeed05f03af7a2bd21b67f244c175af00f39b5193cbd8bd41/C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/9.0.2/runtimes/ios-arm64/native/libmono-component-marshal-ilgen-static.a'
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.2\18.2.9180\targets\Xamarin.Shared.Sdk.targets(1665,3): error : clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I checked that path on the Mac and it is indeed a 0 byte file. All the other files in that directory are non-zero in size.

The corresponding file on my Windows machine is 199KB.

I scp'd that file from my Windows machine to the Mac and that allowed the build process to get past that error and it seems to fully build, though it can't deploy due to an issue with the iOS version.

Steps to Reproduce

I don't know. I have had to do so many things to get to this point with a brand new Mac and an app that has never been built for iOS before.

Did you find any workaround?

Yes, I copied the file from my Windows machine to the Mac, overwriting the 0-byte file.

Build logs

No response

@bzd3y
Copy link
Author

bzd3y commented Feb 21, 2025

Actually, that deploy issue also seems to be a bug. It says it can't deploy the app because iOS 18.2 is required, but my device uses 17.6.1. I added MinimumOSVersion to my Info.plist file to try to force it to support 13.0+ and then get:

The MinimumOSVersion value in the Info.plist (13.0) does not match the SupportedOSPlatformVersion value (18.2) in the project file (if there is no SupportedOSPlatformVersion value in the project file, then a default value has been assumed). Either change the value in the Info.plist to match the SupportedOSPlatformVersion value, or remove the value in the Info.plist (and add a SupportedOSPlatformVersion value to the project file if it doesn't already exist).

But I have the following in my project file:

<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">13.0</SupportedOSPlatformVersion>

I was able to get rid of that error and deploy and run by changing the above to:

<SupportedOSPlatformVersion Condition="'$(TargetFramework)'=='net9.0-ios'">13.0</SupportedOSPlatformVersion>

Using the entire target framework string instead of the platform identifier.

I added a msbuild target to output $(TargetPlatformIdentifier) and that outputs "MacCatalyst" when I think it should be 'iOS' for an iPhone.

Actually, looking closer, if I just build the project I see both 'MacCatalyst' and 'Android' from the msbuild target output. The iOS platform appears to build, but it doesn't seem to output 'iOS' unless I build by clicking the run button to run it on the iPhone, but then I get the above error about 18.2 being required.

I'm not sure if these two issues are related. I might need to create another issue for this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant