iOS Question SVGKit 3.x

Semen Matusovskiy

Well-Known Member
Licensed User
Hi, guys --

Due to some problems with SVGKit 1.2 ( https://www.b4x.com/android/forum/threads/isvg-scalable-vectors-graphics.60863/#content ), I decided to try new release https://github.com/SVGKit/SVGKit.

SVGKit-IOS.xcodeproj, Demo-IOS.xcodeproj work perfect. But when I try to use libSVGKit-IOS.2.1.0a inside B4i project, I receive a message " ignoring file ../../Libs/libSVGKit-iOS.2.1.0.a, missing required architecture arm64 in file ../../Libs/libSVGKit-iOS.2.1.0.a (2 slices). Undefined symbols for architecture arm64 : ..." etc.
Approximately the same as in https://github.com/SVGKit/SVGKit/issues/495

I tried all advices, which I found, but nothing helps. Any ideas ?
 

JordiCP

Expert
Licensed User
Longtime User
Not sure if you already did it, but just in case:
  • Check that the lib was built for a Generic iOS device.
  • Also, both in project and Target build settings, check which build architectures were selected (should be arm64 only, or STANDARD_ARCHITECTURES including arm64).
If you want to, I can check the XCode project (had a bad time with a lib not much ago and also tried 'almost' everything)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
JordiCP --
  • Check that the lib was built for a Generic iOS device. -- Yes
  • Also, both in project and Target build settings, check which build architectures were selected (should be arm64 only, or STANDARD_ARCHITECTURES including arm64). -- The project SVGKit-IOS uses "STANDARD_ARCHITECTURES". I even reduced to arm64 only. No effect.
Erel --
lipo talks "Architectures in the fat file: libSVGKit-IOS.2.1.0.a are: armv7 arm64"

In B4I i created a new project and corrected dependson in xml (2.1.0 instead of 1.2.0) Nothing more.
So B4I should simply link with new library release.
Result:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_DDASLLogger", referenced from:
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGKit.o)
"_OBJC_CLASS_$_DDLog", referenced from:
objc-class-ref in libSVGKit-iOS.2.1.0.a(Document.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGDocument.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGRadialGradientElement.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGLength.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGKSourceLocalFile.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGElement.o)
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGPathElement.o)
...
"_OBJC_CLASS_$_DDTTYLogger", referenced from:
objc-class-ref in libSVGKit-iOS.2.1.0.a(SVGKit.o)
ld: symbol(s) not found for architecture arm64

Probably, something wrong in SVGKit as it is (unlike first release, static library is not preferable variant now)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I am almost sure that a reason in CocoaLumberjack. I saw similar errors in discussions about CocoaLumberjack as it is (not relative SVGKit).
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Today I made attempt #2.
Because I did not understand how to embed a framework to a static library, I decided to exclude CocoaLumberjack at all. Anyway this is a logger only, for all really important messages SVGKit uses NSLog.
So after commenting some statements I got libSVGKit-iOS.2.1.0.a, which is valid for all platforms.
Then I corrected one line in iSvg.xml and ran Erel's example on iPhone. Works.

But there is a problem with simulator. libiSVG.a does not support x86_64.

Erel --
Can you recompile libiSVG.a or to post the source (B4i ?) class code ?
Current B4I creates libraries for x86_64 instead of i386.
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I compiled for all platforms. Now works (at least, Erel's sample) in simulator and on iPhone.
For whom is interesting ...


I replaced the name SVG to SVG3x (corresponding to Branch 3.x on https://github.com/SVGKit/SVGKit)

Some comments about how I made files.

Step 1. libSVGKit-iOS.2.1.0.a (takes 5-10 minutes only)
a) Download and unzip https://github.com/SVGKit/SVGKit/archive/3.x.zip. Open SVGKit-iOS.xcodeproject.
b) Remove CocoaLumberjack from 3d party frameworks. 'Find in project' by CocoaLumberjack and comment #import "CocoaLumberjack/..." statements. Search by LOG_MAYBE and add // before LOG_MAYBE.
c) Select SVGKit-IOS target, edit schemes (set release mode) and try to compile. It will be some errors (because we removed CocoaLumberjack). Comment corresponding statements and try to compile again. After some attempts, a library will be compiled.
d) Goto libSVGKit-IOS-2.1.0.a line in Products, right click, 'Show in Finder". You will find a library in Release-universal subfolder. Copy it to Libs.

Step 2. Switch to SVGKitFramework-IOS target, select for example Generic IOS Device and run. Then using 'Products' find SVGKit.framework folder and copy it to Libs.
As I understand, we need headers only for next step.

Step 3. libiSVG3x.a
I made a project from Erel's .m and .h. Unzip iSVG3x into the same subfolder as B4I (B4iBuildServer/UploadedProjects). Compile twice - for generic IOS device and for any simulator. Then combine .a files using lipo -create.
 

Attachments

  • iSVG3x.zip
    51.6 KB · Views: 305
Last edited:
Upvote 0
Top