Binding library for google.MLKit.BarcodeScanning from cocoapod creates 13 pods but only 4 of them have .framework files - xamarin.ios

I'm creating a binding library for MLKitBarcodeScanning from it's cocoapod, to be used in Xamarin.ios project. After executing the sharpie bind command it creates the pod folder with 13 pods. But only the MLKitBarcodeScanning, MLKitVision, MLKitCommon, MLImage folders has a framework that I can add as a native reference in my binding library. GoogleDataTransport and other folders does not have any .framework file. So I'm getting errors like: Native linking failed, undefined Objective-C class: GDTCORTransport. The symbol '_OBJC_CLASS_$_GDTCORTransport' could not be found in any of the libraries or frameworks linked with your application. when building the project.
I have tried re initialising the podfile and also I have already created the ApiDefinitions and Structs from the header files. Also I have added LinkerFlags -libc++ -undefined -ObjC -lc++
And has set IsCxx true
Edit: From those folders which are not frameworks or libraries (Including GoogleDataTransport), I created a static library following this Create Static Library And linked it as a Native reference in my binding project. Still the errors are the same

CocoaPods packages can distribute as source distributions or binary distributions. The MLKitBarcodeScanning dependencies without .frameworks are source distributions and get built directly with the app.

So I'm getting errors like: Native linking failed, undefined
Objective-C class: GDTCORTransport. The symbol
'OBJC_CLASS$_GDTCORTransport' could not be found in any of the
libraries or frameworks linked with your application.
A third-party binding bound an Objective-C protocol, but did not annotate it with the [Protocol] attribute in its api definition. You need to add the missing [Protocol] attribute.

Related

References within an azure functions project not working

So I have some Azure Functions I need to publish, which I want to do via a functions project. However, those functions rely on references to class libraries within my solution, and the references do not work within a functions project, is there a way around this?
Edit: After adding the references to the other projects, when "using" the namespaces in which the classes are kept, the compiler throws an error "cannot resolve symbol", it is as if the reference does not exist. The functions project will not build because it cannot find the namespace in which the classes exist
Verify that each project targets the same version of .NET framework. I had the same problem until I noticed that the referenced project targeted 4.7.1, but my Azure function project targeted 4.6.1. Changing the referenced project to match the Azure function project resolved the issue.
There are a couple more steps to consume assemblies if they're not exposed by default in Azure Functions. If it's a custom assembly you have to make sure it's included in the bin folder. Then you have to make sure you're using the #r directive. Are you doing both of those things? Include your code header and settings if so.
This page has the list of assemblies that are visible to Azure Functions, some still requiring the #r directive:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#referencing-external-assemblies
The following assemblies are automatically added by the Azure Functions hosting environment:
mscorlib
System
System.Core
System.Xml
System.Net.Http
Microsoft.Azure.WebJobs
Microsoft.Azure.WebJobs.Host
Microsoft.Azure.WebJobs.Extensions
System.Web.Http
System.Net.Http.Formatting
The following assemblies may be referenced by simple-name (for
example, #r "AssemblyName"): Newtonsoft.Json
Microsoft.WindowsAzure.Storage Microsoft.ServiceBus
Microsoft.AspNet.WebHooks.Receivers Microsoft.AspNet.WebHooks.Common
Microsoft.Azure.NotificationHubs

How to handle 3rd-party static C library dependencies in Rust/Cargo?

There is a 3rd party C library that I'd like to link to in my Rust project. It is hosted on github and compiles only as a static library. Is there any way to have Cargo fetch this dependency for me? I'm thinking there isn't. I tried adding it as a dependency and got a "Could not find Cargo.toml in ..." error.
As an alternative, I thought of modifying my build.rs file to use the git2-rs crate to download a tag of the library, possibly specified as a tag name passed through an environment variable.
Another option would be to include the source of the C library in my project, but I was thinking if the users of my crate want to use a different (but compatible) version of the 3rd party library with my crate, they wouldn't be able to do so as easily.
So how are others in the community handling situations like this?
In general, you want to create a libfoo-sys crate. That crate will have a build script that compiles the native library and sets up the linker options.
The build script can use build-time dependencies like the cc crate to make the process of downloading and compiling the native library easier.
You can use environment variables or features to choose where the native library comes from. You could use one already installed by the user by their system package manager (or perhaps a hand-compiled version), you could download the source from somewhere, you could include the code in the repository, or you could use a git submodule to reference another git repository instead of actually copying code.
In many cases, you will also use a tool like rust-bindgen to create the "raw" Rust bindings for the C library.

Protobuf and Node.JS library error

I'm working with google protocol buffers with Node.JS on Ubuntu 14.04 LTS. I have two different (A and B) Node.JS addons (c++) using the same protocol buffers and protobuf library. When I create a new instance of module B with require() after module A had been required before, the server stops with error message:
[libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: Anam.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1157] CHECK failed: generated_database_->Add(encoded_file_descriptor, size): terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: generated_database_->Add(encoded_file_descriptor, size)
I've googled the error and found that others experience this error only on Linux. I've also installed the latest version of protobuf library from github, but it didn't helped. The part of binding.gyp, where I include libprotobuf looks like this:
"libraries": ["/usr/lib/libpq.so",
"/usr/local/lib/libprotobuf.so",
"/usr/local/lib/libboost_system.so",
"/usr/local/lib/libboost_thread.so",
"/usr/local/lib/libboost_signals.so"]
If I make more instances of the same module (for example require addon A 2 times), it works. Does anybody have any suggestion how to fix this problem?
The problem is probably that both of these C++ modules contain separate compiled copies of the same .proto file(s), but are sharing the same copy of libprotobuf.so. Each one tries to register its protobuf descriptor types with the global type descriptor table, and then a conflict is seen.
There are two ways to correct the problem:
Move the shared .proto files into a shared library which both modules link against (so that they end up sharing one copy of the complied protos).
Make each module statically link against libprotobuf, so that they don't share libprotobuf. This way each will get its own descriptor table. Note that this approach won't work if one module ever receives protobuf objects created by the other (if they only exchange serialized messages, not objects, that's fine).
Note that this problem affects all platforms, but it's possible that people aren't seeing it on Windows because statically linking libprotobuf is more common there.

Win8 app CLI library integration issue

I have a Win8 app that is purely native (c++) and I've already used a library that is written using managed code AFAIK. No issues there, I created objects and addressed them using C++/CX with ref counted pointers etc.
I need to add a new library, I referenced it as I did previously, but when I declare and object and try to address it I get:
error C3624: 'System::Object': use of this type requires a reference to assembly 'mscorlib'
Using #using <mscorlib.dll> is not a solution obviously, because WinRT does not support #using of a managed assembly.
When I look up the definition of the class I'm using in Object Browser I see that it's inherited from System::Object. The previous library had a class that was inherited from Platform::Object which is valid for C++/CX.
I already contacted the developers of current library I'm trying to use, but it takes a lot of time for them to respond.
Can I work around this issue? What are the possible courses of action?
UPD: Can I ask the developers to rebuild a library for C++/CX?
I do not believe this is going to work in the general case, unless the C# library is a PCL (portable class library). If it leverages anything that is not in the WinRT .NET client profile, it simply will not work.
If it is a PCL, what you can do is write a C# Windows Runtime Component that itself has a reference to this third-party library and wraps the necessary functionality. Then you reference that C# Windows Runtime Component from your C++/Cx application.

How to prevent 'missing library' error linux

I am working on a cross platform, building on PC running on ARM.
I have several targets with different sets of shared libraries.
I am building a single executable which is linked with all the shared libraries.
I can't run it on targets that some shared libraries missing on. I get loader error.
Is there a way to 'tell' the loader to ignore the missing shared libs?
I will deal the the missing functions in run-time, I really need one executable..
No. You cannot tell the dynamic loader to ignore missing libraries.
What you can do is load the libraries dynamically using functions like dlopen and dlsym.

Resources