@robnotyou, I am sorry that you felt I was being rude, that was not my intention. I can already create the stamp in swift, that's not a problem - its using it to create a continuous "line" of stamps. @OOPer, my question stated that I am using swift a couple of times and I gave the equivalent code in java to illustrate my need - thought that was sufficient info.
Post
Replies
Boosts
Views
Activity
So I searched further and found that, during the process of conversion, I could obtain the spec object spec = model.get_spec(). I then dumped this out to a file and saw specificationVersion: 6. So, is this a bug in the version 5.0b5 of CoreML tools ?
Ah sorry, I forgot to add the script I mentioned, but, when trying to include it here, it ended up as a mess. I simply used the same python script commands as described in the aforementioned article.
To answer my own question - Yes, I was missing something ! :-(
One of those stupid bugs that you go over being persuaded that there is nothing wrong.
I was trying to do a to_string on a pointer to an int without dereferencing it - as I said, stupid.
Sorry for the bother.
Hi Scott,
Thanks for your reply.
I have tried both creating a C++ file and an Objective-C++ file as you proposed.
In both of these, XCode complains that it cannot find the class stringor even the header (obj-c++) <string>.
Just for to remind you, I am having to use XCode 12.2 and not 14.5 due to system constraints.
Any ideas ?
This is not an issue any more, sorry for the unnecessary question.
When I refresh the preview, all compiles ok and the libraries are ignored.
Shame that I cannot delete this question ...
Ok, I have got a bit further.
The define is indeed present and the preprocessor skips over the 64bit calls I want to avoid for the simulator/preview.
It is now falling over the inclusion of 64bit static libraries which need to be linked with the application, but are not needed when previewing the UI from within Xcode and SwiftUI.
Is it possible to have "conditional" linking ?
By that I mean, if we are building for arm64, link the libraries in, otherwise ignore them.
Hi Quinn,
Thank you for all your (painfull) efforts ;-)
I have managed to write the wrapper and catch exceptions correctly.
Great work, thanks
Hi Quinn,
Thank you for your, expanded, explanation.
As I have never done any objective-c or objective-c++, are you able to point me to some examples which will help me write this wrapper, please ?
Super, thank you Scott.
That's just what I needed.
Have a great day.
Hi Quinn,
Good news for today.
After having thought that I could at last load the dylib - the app crashes without warning = no exception or error message.
So ... I wrote a really simple dylib with one really simple function and compiled it.
I then signed it with the same bundle identifier as the application
I created a framework for it and slotted it in.
The application then copies the framework into the applications Library directory
I then load the dylib directly from C++ code using dlopen
I can then obtain a pointer to the simple function and execute it successfully
So, all I need to do now is find what library initialisations are causing the crash.
Thank you for all your help.
Hi Quinn,
Thanks for your reply.
In fact, there is only one instance of my dylib, the one inside the Frameworks directory.
I have managed to fix the double problem of LC_ID_DYLIB and bit code complaints - it builds all correctly now.
However, when loading on the iPad, I am getting an error of code signature invalid - which indicates that the system is trying to load the correct stuff, at least.
Both the application and the framework are signed with the same team identifier.
However, they obviously do not have the same bundle identifier -
fr.teamexpression.irisa.normaliser-fr
fr.teamexpression.irisa.SeptemberDemo
Both projects are set to do automatic signing, ie XCode manages the generation
If I query the system for the signing certificates, I get:
$ /usr/bin/env xcrun security find-identity -v -p codesigning
	1) 7E5412AB42D2F6DC955FF8809079E33AAF3ADB8B "Apple Development: team-email@email.com (9KFL2H38SM)" (CSSMERR_TP_CERT_REVOKED)
	2) 78037F819B5AA1522177B06DA8E7C5343DDBC0CF "Apple Development: team-email@email.com (9KFL2H38SM)"
		 2 valid identities found
Note : email address changed by security
So, logically speaking, only the second certificate would be used for both the application and the dylib.
Might you have any idea what is causing the security to choke on the dylib ?
You are right, I am indeed calling it with dlopen, but it wasn't clear to me if I should call the dylib directly or via the frameworks executable.
Taking into account the framework structure :
drwxr-xr-x	3 simon	staff		 96	4 fév 15:41 Frameworks	<-- contains libnormaliser_fr.dylib
drwxr-xr-x	3 simon	staff		 96	4 fév 15:41 Headersrw-r--r--	1 simon	staff		763	4 fév 15:41 Info.plist
drwxr-xr-x	3 simon	staff		 96	4 fév 15:41 Modules
drwxr-xr-x	3 simon	staff		 96	4 fév 15:41 _CodeSignaturerwxr-xr-x@ 1 simon	staff	69296	4 fév 15:41 normaliser_fr
I was calling :
dlopen(<app id path>/Library/normaliser_fr.framework/normaliser_fr);
Which was giving the error :
dependent dylib '/Users/simon/DevProjects/speech-recognition/ios/lib/libnormaliser_fr.dylib' not found
Perhaps you can clarify, please, if this correct, or should I call the dylib directly ?
Here are the steps I was taking :
Build the dylib
Copy it to the XCode framework project
Build the framework, which handles the signing
It was between steps 1 & 2 that I tried to change the LC_ID_DYLIB entry - so before rebuilding and resigning.
It was at stage 3 that XCode complained.
Without doing the change, everything compiled correctly, having said that.
Some progress made.
I have found that I can successfully copy the framework to the apps Library directory, ensuring that file permissions stay the same (ie: read/write/execute permissions).
However, when trying to load the framework, I have discovered that my dylib has stored the build directory in the LC_ID_DYLIB entry.
Before :
Load command 4
					cmd LC_ID_DYLIB
			cmdsize 104
				 name /Users/simon/DevProjects/speech-recognition/ios/lib/libnormaliser_fr.dylib (offset 24)
	 time stamp 1 Thu Jan	1 01:00:01 1970
			current version 0.0.0
compatibility version 0.0.0
So, I proceeded to update it with :
install_name_tool -id "@loader_path/Frameworks/libnormaliser_fr.dylib" libnormaliser_fr.dylib
After :
Load command 4
					cmd LC_ID_DYLIB
			cmdsize 72
				 name @loader_path/Frameworks/libnormaliser_fr.dylib (offset 24)
	 time stamp 1 Thu Jan	1 01:00:01 1970
			current version 0.0.0
compatibility version 0.0.0
Now, here is the strange effect - where XCode would generate the framework without any problem before, it now complains saying that the library does not contain bitcode !
I ran KDiff3 on the library before installnametool and after to see if it would remove anything.
I just changes what I requested.
What am I doing wrong ?
Hi,
Ok, I have managed to create the iOS Framework project and find where I should add the reference to my dylib.
I can do the build to create the framework structure you showed below.
My project is entitled, with a lot of originality ... test !
So the output structure is as follows :
drwxr-xr-x	3 simon	staff		 96	1 fév 14:03 Frameworks
drwxr-xr-x	3 simon	staff		 96	1 fév 13:50 Headers
drwxr-xr-x	3 simon	staff		 96	1 fév 13:50 Modules
drwxr-xr-x	3 simon	staff		 96	1 fév 14:03 _CodeSignaturerw-r--r--@ 1 simon	staff		738	1 fév 14:03 Info.plist
rwxr-xr-x	1 simon	staff	68688	1 fév 14:03 test
Can you confirm that I call manually put the executable image test onto the iPad, point to it in the app and load it with dylib ?