Open jfversluis opened 2 years ago
Issue moved from dotnet/maui#10344
From @PureWeen on Tuesday, September 27, 2022 6:12:04 PM
@rolfbjarne thoughts?
Issue moved from dotnet/maui#10344
From @wzh425 on Wednesday, September 28, 2022 4:04:30 AM
Hope to get your response
Issue moved from dotnet/maui#10344
From @rolfbjarne on Wednesday, September 28, 2022 5:21:26 AM
The problem is that the libWeChatSDK.a
file doesn't contain the classes you're trying to bind.
For exampe HBReq
, it's in your binding:
git grep HBReq
IOS.WeChat/ApiDefinition.cs: // @interface HBReq : BaseReq
IOS.WeChat/ApiDefinition.cs: interface HBReq
but it's not in libWeChatSDK.a
:
$ nm ./IOS.WeChat/libWeChatSDK.a | grep HBReq
<no output>
thus the build fails, because it tries to find the native HBReq
class when it doesn't exist.
Issue moved from dotnet/maui#10344
From @wzh425 on Wednesday, September 28, 2022 5:36:54 AM
@rolfbjarne I have handled this error and successfully compiled, but new problems have arisen。
The project successfully generated the assembly of the binding library, but I couldn't call it, and I couldn't find the class and namespace
Issue moved from dotnet/maui#10344
From @rolfbjarne on Wednesday, September 28, 2022 6:18:27 AM
That's a known problem for intellisense. It should work once you actually build the project.
A workaround is to reference the binding assembly, not the binding project, from the main project.
Issue moved from dotnet/maui#10344
From @wzh425 on Wednesday, September 28, 2022 6:55:07 AM
@rolfbjarne Thank you very much for your reply。 I'm sorry to have a new problem。 An error occurred when I connected to the local IOS mobile phone for debugging:ould not load the framework 'DVTITunesSoftwareServiceFoundation'
Issue moved from dotnet/maui#10344
From @mattleibow on Wednesday, September 28, 2022 6:12:24 PM
May be related to https://github.com/dotnet/maui/issues/10377
@wzh425 what version of Xcode do you have installed? If you have Xcode14 installed, you will need to be using xamarin.ios 16.0.*. A more stable option would be to make sure you are using Xcode 13.4.1 instead.
Hi @jfversluis. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@tj-devel709 Yes, I installed Xcode14
I'm running into this issue as well in a Maui project when adding a native reference to a static library (libveldrid-spirv from https://github.com/mellinoe/veldrid-spirv).
The issue exists using either xcode 13 or 14.
@wzh425:
@rolfbjarne Thank you very much for your reply。 I'm sorry to have a new problem。 An error occurred when I connected to the local IOS mobile phone for debugging:ould not load the framework 'DVTITunesSoftwareServiceFoundation'
That's described here: https://github.com/xamarin/xamarin-macios/issues/16164
I'm running into this issue as well in a Maui project when adding a native reference to a static library (libveldrid-spirv from mellinoe/veldrid-spirv).
The issue exists using either xcode 13 or 14.
Please create a new issue (since it might be a different problem than the one described here), and attach a test project we can use to reproduce the problem.
Hello, the same happens in Xamarin.Forms.
The binding library is referenced in the project (as Project Reference), but it is totally empty in the Class View. The iOS project do not compile.
If the same binding library is referenced from a local .nuget package there are no problems.
Thanks, Mdm
@wzh425:
@rolfbjarne Thank you very much for your reply。 I'm sorry to have a new problem。 An error occurred when I connected to the local IOS mobile phone for debugging:ould not load the framework 'DVTITunesSoftwareServiceFoundation'
That's described here: #16164
I had this problem before and the way to fix it is install Command_Line_Tools_for_Xcode_14.dmg. Please check if this installation fix your problem.
Hello, the same happens in Xamarin.Forms.
The binding library is referenced in the project (as Project Reference), but it is totally empty in the Class View. The iOS project do not compile.
If the same binding library is referenced from a local .nuget package there are no problems.
Thanks, Mdm
Please create a new issue for this problem as the reason could be different than this one. Also please attach a test project so that we can reproduce the issue.
@wzh425 Please let us know if Rolf's suggestion fixed the issue for you.
Hi @jfversluis. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hello, the same happens in Xamarin.Forms. The binding library is referenced in the project (as Project Reference), but it is totally empty in the Class View. The iOS project do not compile. If the same binding library is referenced from a local .nuget package there are no problems. Thanks, Mdm
Please create a new issue for this problem as the reason could be different than this one. Also please attach a test project so that we can reproduce the issue.
I created this issue: https://github.com/xamarin/xamarin-macios/issues/16299
Thanks, Mdm
Hello, I hit the same issue on another project, this time based on MAUI. In this new project the error is:
4>ld: file not found: /Users/michele/Library/Caches/Xamarin/mtbs/builds/DemoAppNET6/0ff5c9bcf3f669801e840ff76bd0407cf894b0e3e3c5ff0e8e3e3d6783cbbaa8/obj/Debug/net6.0-ios/ios-arm64/linker-cache/libLibHealthCombine_4.1.a
The problem does not solve adding the binding library to the project nor the binding project.
I can provide more documentation if needed.
Thanks, Mdm
@mdima does it work if you build using Visual Studio on the Mac?
@mdima does it work if you build using Visual Studio on the Mac?
Hi @rolfbjarne , unfortunately no, it doesn't compile on Visual Studio on Mac.
The error is the same:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.0.523/targets/Xamarin.Shared.Sdk.targets(1222,3): error : ld: file not found: /Users/michele/Desktop/LinkTopLibrary NET6/Demo App NET6/obj/Debug/net6.0-ios/ios-arm64/linker-cache/libLibHealthCombine_4.1.a
Few lines before I read (both on Windows than on Mac, anyway this log is from the Mac):
ILLINK : warning MT1302: Could not extract the native library 'libLibHealthCombine_4.1.a' from '/Users/michele/Desktop/LinkTopLibrary NET6/Demo App NET6/obj/Debug/net6.0-ios/ios-arm64/linker-cache/libLibHealthCombine_4.1.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary').
so I invented to add manually in the project file:
<ItemGroup>
<ObjcBindingNativeLibrary Include="Platforms\iOS\libLibHealthCombine_4.1.a">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Bind></Bind>
<Pack></Pack>
</ObjcBindingNativeLibrary>
</ItemGroup>
But when I compile the error is the same.
Thanks, Michele
@mdima could you get a binlog of the failing build?
@rolfbjarne Here you are.
@mdima that binlog shows a different error:
Errors
C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\App.xaml.cs(5,26): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'LinkTopLibrary' (are you missing an assembly reference?) [C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Demo App NET6.csproj]
C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\MainPage.xaml.cs(5,26): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'LinkTopLibrary' (are you missing an assembly reference?) [C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Demo App NET6.csproj]
C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\MauiProgram.cs(7,26): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'LinkTopLibrary' (are you missing an assembly reference?) [C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Demo App NET6.csproj]
C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Pages\BodyTemperature.xaml.cs(5,26): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'LinkTopLibrary' (are you missing an assembly reference?) [C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Demo App NET6.csproj]
C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Pages\Welcome.xaml.cs(5,26): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'LinkTopLibrary' (are you missing an assembly reference?) [C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\Demo App NET6\Demo App NET6.csproj]
and not the one you mention here: https://github.com/xamarin/xamarin-macios/issues/16192#issuecomment-1293208994
@rolfbjarne yes... the problem is before, in the cross-platform library I realized that contains a common interface for both platforms.
The library compiles without errors (even if IntelliSense shows as errors the references to the native library objects). Unfortunately it seems that all what is inside the libLibHealthCombine_4.1.a library is not considered at all. Inside that library I added a direct reference to the native library, but did not help.
@mdima I'm not sure I understand what's going on.
In order to figure out what's causing this error:
error : ld: file not found: ...
I need a binlog that shows that error.
@rolfbjarne it seems like a "chicken in the egg" situation, because I can't arrive to that point, it seems that if fails before.
Maybe what I can do is to provide the binlogs of: 1) The native library (LinkTopSDK.iOS.binlog) 2) The cross platform library (LinkTopLibrary.binlog)
The native library is in the file libLibHealthCombine_4.1.a . Do you have any evidence of the reason why the objects and functions inside the native library are not available in the Maui App (which references the cross platform library project)?
Thanks, Michele
@mdima you must connect to a Mac in order to build a binding project from Windows.
mmmhhh... it was... to double check I rebuilt the native library. Below the build log and the binlog.
1>------ Rebuild All started: Project: LinkTopSDK.iOS, Configuration: Debug Any CPU ------
1>Executing SayHello Task to establish a connection to a Remote Server.
1> Properties:
1> SessionId=ae8bd6c03c291cffebd2662248aad7c62dfc630a8dc9fae97cde8edd7052d671,
1> Addresss=192.168.234.128,
1> SshPort=22,
1> TcpPort=59225,
1> User=michele,
1> AppName=LinkTopSDK.iOS,
1> VisualStudioProcessId=4700,
1> ContinueOnDisconnected=False
1>/Users/michele/Library/Caches/Xamarin/XMA/SDKs/dotnet/dotnet /Users/michele/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.iOS.Sdk/16.0.517/tools/lib/bgen/bgen.dll @/Users/michele/Library/Caches/Xamarin/mtbs/builds/LinkTopSDK.iOS/ae8bd6c03c291cffebd2662248aad7c62dfc630a8dc9fae97cde8edd7052d671/obj/Debug/net6.0-ios/response-file.rsp
1>LinkTopSDK.iOS -> C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\LinkTopSDK.iOS\bin\Debug\net6.0-ios\LinkTopSDK.iOS.dll
1>Successfully created package 'C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\LinkTopSDK.iOS\bin\Debug\LinkTopSDK.iOS.1.0.0.nupkg'.
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
If in the binlog there's no track of the connection to the Mac probably there's a problem above all...
Thanks, Michele
PS: the same library compiles OK as native library using Xamarin Forms. The problem is with the NET6 version of the package.
This is from the binlog:
>Target "_SayHello: (TargetId:26)" in file "C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.0.517\tools\msbuild\iOS\Xamarin.Messaging.Build.targets" from project "C:\Users\Michele DM\source\repos\LinkTopLibrary NET6\LinkTopSDK.iOS\LinkTopSDK.iOS.csproj" (target "Build" depends on it):
Set Property: ServerSshPort=22
Set Property: GenerateCache=false
Set Property: ContinueOnDisconnected=true
Task "Warning" skipped, due to false condition; ('$(ServerPort)' != '') was evaluated as ('' != '').
Task "Message" skipped, due to false condition; ('$(ServerAddress)' != '') was evaluated as ('' != '').
Task "SayHello" skipped, due to false condition; ('$(ServerAddress)' != '') was evaluated as ('' != '').
are you posting a binlog from a different build?
Hi @rolfbjarne , yes, two different builds just made one right after the other to show the difference between compiling from the interface and compiling from the development powershell...
@mdima can you get a binlog from a failing build from Visual Studio for Mac (that way we avoid any issues related to being connected to the Mac from Windows)?
@rolfbjarne I was trying to sort out this problem since this morning, but I did not get to any reasonable result.
In Visual Studio for Mac the Native Library project compiles successfully, but I encountered issues compiling the "cross platform library".
In the while in Visual Studio per Windows I was able to get a significant size of the Nuget Package including in the Native Library project the
What do you think if I send you in pvt the project I am working on?
Thanks, Michele
@mdima yes, please, file a new issue and attach your project so that we can look at it.
https://github.com/xamarin/xamarin-macios/issues/16953
hope this will help you
Issue moved from dotnet/maui#10344
From @wzh425 on Tuesday, September 27, 2022 1:34:05 PM
Description
Steps to Reproduce
IOS.WeChat.csproj
Link to public reproduction project repository
https://github.com/wzh425/MauiBlazorDemo
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
ios15.4
Did you find any workaround?
No response
Relevant log output