Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

NuGet package linker issues #1

Closed
SuperCorks opened this issue Dec 18, 2020 · 12 comments
Closed

NuGet package linker issues #1

SuperCorks opened this issue Dec 18, 2020 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@SuperCorks
Copy link

SuperCorks commented Dec 18, 2020

Hey guys,

First of all, thank you for this. It saved me a lot of time! 🙏

I've been using the older NuGet (the one that started with Xamarin) without any issue. Today I changed to the new NuGet package (the one that starts with Laerdal), but when I build I get linker issues (see logs below).

The package is wrapped in an iOS library project, so it's imported in there.
I've also imported it in the iOS app project (not sure if I had to do that).
Tried to build with linker behaviors: Link All, and Don't Link

Is there anything I'm missing?

Using:
Xamarin 4.8.0.1821
Laerdal.Xamarin.Dfu.iOS 4.9.0.6
Visual Studio Community 2019 16.8.3

Build logs:

17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): warning MT0127: Incremental builds have been disabled because this version of Xamarin.iOS does not support incremental builds in projects that include more than one third-party binding libraries.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error : linker command failed with exit code 1 (use -v to see invocation)
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUFirmware. The symbol '_OBJC_CLASS_$_DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUFirmwareSize. The symbol '_OBJC_CLASS_$_DFUFirmwareSize' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUPeripheralSelector. The symbol '_OBJC_CLASS_$_DFUPeripheralSelector' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUServiceController. The symbol '_OBJC_CLASS_$_DFUServiceController' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUServiceInitiator. The symbol '_OBJC_CLASS_$_DFUServiceInitiator' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUUuid. The symbol '_OBJC_CLASS_$_DFUUuid' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUUuidHelper. The symbol '_OBJC_CLASS_$_DFUUuidHelper' could not be found in any of the libraries or frameworks linked with your application.

I can send you a minimal replication project if you ask for it.

@framinosona framinosona self-assigned this Dec 22, 2020
@framinosona framinosona added the bug Something isn't working label Dec 22, 2020
@framinosona
Copy link
Member

Hi @SuperCorks,

Thank you for testing it and for the Log 👍. I see where it comes from and reproduced it. I'll release an updated version with this fixed soon.

@SuperCorks
Copy link
Author

Epic François, thanks a lot!

@framinosona
Copy link
Member

Okay just pushed v4.9.0.7. Let me know :)

@Moret84
Copy link

Moret84 commented Dec 23, 2020

Hello @framinosona , many thanks for your package.
I have followed the issue and saw the update but unfortunately I am facing similar errors as @SuperCorks with 4.9.0.7 version.

@SuperCorks
Copy link
Author

Sorry to say that 4.9.0.7 has indeed not fixed it.

17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUFirmware. The symbol '_OBJC_CLASS_$_DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUFirmwareSize. The symbol '_OBJC_CLASS_$_DFUFirmwareSize' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUPeripheralSelector. The symbol '_OBJC_CLASS_$_DFUPeripheralSelector' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUServiceController. The symbol '_OBJC_CLASS_$_DFUServiceController' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUServiceInitiator. The symbol '_OBJC_CLASS_$_DFUServiceInitiator' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUUuid. The symbol '_OBJC_CLASS_$_DFUUuid' could not be found in any of the libraries or frameworks linked with your application.
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(711,3): error MT5211: Native linking failed, undefined Objective-C class: DFUUuidHelper. The symbol '_OBJC_CLASS_$_DFUUuidHelper' could not be found in any of the libraries or frameworks linked with your application.

@framinosona
Copy link
Member

Yep, investigating still :/ Sorry about that. First, I know that I was missing [Protocol] on those classes, but now that this is fixed when trying to use them, I get "ObjCRuntime.RuntimeException: Can't register the class Laerdal.Xamarin.Dfu.iOS.DFUFirmware when the dynamic registrar has been linked away." so I'm trying to fix that now.

@SuperCorks
Copy link
Author

SuperCorks commented Dec 23, 2020

No worries, let us know if you need any help. I haven't worked with binding libraries much, but I know there's a [PreserveAll] tag that could maybe help avoid things getting linked out.

Also, maybe adding the following mtouch argument: --optimize=-remove-dynamic-registrar (notice the - before remove)

@framinosona
Copy link
Member

Yep tried the Preserve all and it didn't change that, the --optimize=-remove-dynamic-registrar could work but it would require people who use that nuget to have to add it to their project, I'm trying to prevent that.
It worked before and I think it has to do with my "objective sharpie" operation. On previous versions my classes had generated names like "TtP13iOSDFULibrary29DFUPeripheralSelectorDelegate" and now my Objective sharpie doesn't generate them ... I remember that a year ago I had come up with a couple of convenient regex to change the iOS Framework .h file before sharpifying them... I'm digging through archives :)

@framinosona
Copy link
Member

framinosona commented Dec 23, 2020

Found it! Before building the iOS (xcode) project I need to run:

  • From:
    @objc (public|internal|open) (class|enum|protocol) ([A-Za-z0-9]*)
  • To:
    @objc($3) $1 $2 $3
  • In :
    iOSDFULibrary/*

https://regex101.com/r/li9ll8/1

Okay I'll try that and send a new package if it works :)

@framinosona
Copy link
Member

OKAY ! This one should be the right one :)

https://www.nuget.org/packages/Laerdal.Xamarin.Dfu.iOS/4.9.0.11

I've tested without adding --optimize=-remove-dynamic-registrar or anything, just the Nuget and it worked. Let me know :) @SuperCorks and @Moret84

@SuperCorks
Copy link
Author

Works on my side. Thanks a lot François! Cheers!

@yogeshk25
Copy link
Contributor

This is back again in 4.9.0.14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants