Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

SVGKit Library build error #19

Closed
Dino4674 opened this Issue · 43 comments

3 participants

Dino4674 adamgit Steven Fusco
Dino4674

Hi,

first question is which SVGKit to use? This one or https://github.com/SVGKit/SVGKit ?

I cloned this repository and tried to build and got this error:


Libtool build/Debug-iphoneos/libSVGKitLibrary.a normal armv7
    cd /Users/Dino4674/Development/Xcode_projects/SVGKit/XCodeProjects/SVGKit
    setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -L/Users/Dino4674/Development/Xcode_projects/SVGKit/XCodeProjects/SVGKit/build/Debug-iphoneos -filelist /Users/Dino4674/Development/Xcode_projects/SVGKit/XCodeProjects/SVGKit/build/SVGKit.build/Debug-iphoneos/SVGKitLibrary.build/Objects-normal/armv7/SVGKitLibrary.LinkFileList -ObjC -framework QuartzCore -framework CoreGraphics -framework UIKit /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libxml2.dylib -framework Foundation -o /Users/Dino4674/Development/Xcode_projects/SVGKit/XCodeProjects/SVGKit/build/Debug-iphoneos/libSVGKitLibrary.a

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libxml2.dylib (No such file or directory)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1

adamgit

Have you tried following the instructions from Apple in the output you copy/pasted?

Looks to me like your version of Xcode has new "features" (bugs) from Apple.

Dino4674

Hi Adam, I posted on yours blog. It's better here.

I googled that error and tried all suggestions (most of them from stackoverflow) and none of them worked for me.

As I see, this page (reliks page) has that README for building SVGKitLibrary. Does that mean if I manage to build it I would get SVGKit.framework and could just drag&drop it to my project?

And for further issues/questions, do you want me to post them here or on SVGKit/SVGKit?

adamgit

But ... what happens when you do what Apple tells you? Forget StackOverflow or Google - what about Apple's instrctions above - the ones you copy/pasted!

Dino4674

These 3 lines. Should I put them in .bash_profile file? I don't think I should put all of them. Sorry for acting like a noob, I only use Xcode and objectiveC for developing Titanium modules so configuring it is a bit strange for me.

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

Actually, it looks to me like you just haven't added the libxml2.dylib file - IIRC this is in the Readme on the front page

adamgit

PS: the repeat comments are because GitHub's Javascript coders write terrible code. They really need to learn to write their code properly :(.

Dino4674

It's added already in the project. Here is the image after build fails.

libxml2

Only difference in my settings is that in build phases I have:

  1. Edit your build settings and set "C/C++ Compiler Version" = "LLVM Compiler 2.0" I have Apple LLVM compiler 3.1
adamgit

Delete libxml2 and re-add it?

Dino4674

This did the trick.

After building SVGKitLibrary I got this files in my build folder:

SVGKitLibrary

and after building SVGKit I got this one also:

SVGKit

I don't see debug-universal as stated on projects README.

I wanna use this in iOS application so which files should I add?

Thank you very much for your help Adam.

adamgit

That suggests you have strange and freaky personal settings for how you run your Builds, sorry :).

Try looking at the ouptut of your build (one of the tabs in top left of xcode), and there's a build script that should be running. If you clik on the "three horizontal lines" icon to right of the main build script, it will expand and "allow" you to see the build output. Last line of build script gives the exact location on disk of the debug-universal folder.

Please: if this sounds annoying, complain to Apple! They broke the way scripts run with Xcode4, and added this stupid 3-lines-icon - and they haven't provided any alternative way around :(

Dino4674

Hi, I didn't have access to my computer last 4 days.

Are you talking about this:
build

adamgit

You appear to have a corrupted copy of the project, or a broken copy of Xcode.

There's a built-in script that runs and makes the library for you - but your machine is showing no sign of the script.

You can try looking in your Build Phases to see if there's a "Run Script Phase" in there, with a long script, and see if you've somehow disabled it.

Or maybe someone has done a bad commit and they've disabled the script? Last time I checked, the script was working fine.

I've never seen anything like this before, so I don't know what to suggest :(

Dino4674

So much complications :(

I do have one script :

script

and here is the text:

# Version 2.0 (updated for Xcode 4, with some fixes)
# Changes:
#    - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs)
#    - Faster / better: only runs lipo once, instead of once per recursion
#    - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to "true"
#    - Fixed some typos
# 4
# Purpose:
#   Create a static library for iPhone from within XCode
#   Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)
#   ...no, I don't understand why they did this!
#
# Author: Adam Martin - http://twitter.com/redglassesapps
# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)
#
# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

#################[ Tests: helps workaround any future bugs in Xcode ]########
#
DEBUG_THIS_SCRIPT="false"

if [ $DEBUG_THIS_SCRIPT = "true" ]
then
echo "########### TESTS #############"
echo "Use the following variables when debugging this script; note that they may change on recursions"
echo "BUILD_DIR = $BUILD_DIR"
echo "BUILD_ROOT = $BUILD_ROOT"
echo "CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR"
echo "BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR"
echo "CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR"
echo "TARGET_BUILD_DIR = $TARGET_BUILD_DIR"
fi

#####################[ part 1 ]##################
# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)
#    (incidental: searching for substrings in sh is a nightmare! Sob)

SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\{3\}$')

# Next, work out if we're in SIM or DEVICE

if [ ${PLATFORM_NAME} = "iphonesimulator" ]
then
OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}
else
OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}
fi

echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})"
echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}"
#
#####################[ end of part 1 ]##################

#####################[ part 2 ]##################
#
# IF this is the original invocation, invoke WHATEVER other builds are required
#
# Xcode is already building ONE target...
#
# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.
# ...we need to build ALL targets
# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)
#
#
# So: build ONLY the missing platforms/configurations.

if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: I am NOT the root invocation, so I'm NOT going to recurse"
else
# CRITICAL:
# Prevent infinite recursion (Xcode sucks)
export ALREADYINVOKED="true"

echo "RECURSION: I am the root ... recursing all missing build targets NOW..."
echo "RECURSION: ...about to invoke: xcodebuild -configuration \"${CONFIGURATION}\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO"
xcodebuild -configuration "${CONFIGURATION}" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

ACTION="build"

#Merge all platform binaries as a fat binary for each configurations.

# Calculate where the (multiple) built files are coming from:
CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos
CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator

echo "Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}"
echo "Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}"

CREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal
echo "...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}"

# ... remove the products of previous runs of this script
#      NB: this directory is ONLY created by this script - it should be safe to delete!

rm -rf "${CREATING_UNIVERSAL_DIR}"
mkdir "${CREATING_UNIVERSAL_DIR}"

#
echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}"
lipo -create -output "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}"

#########
#
# Added: StackOverflow suggestion to also copy "include" files
#    (untested, but should work OK)
#
if [ -d "${CURRENTCONFIG_DEVICE_DIR}/usr/local/include" ]
then
mkdir -p "${CREATING_UNIVERSAL_DIR}/usr/local/include"
# * needs to be outside the double quotes?
cp "${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/"* "${CREATING_UNIVERSAL_DIR}/usr/local/include"
fi
fi


Dino4674

Maybe someone changed the name from debug-universal to debug-iphoneos.

Reliks README says:

  1. Look in your output directory for a folder named "debug-universal" - this contains a library + headers for: iPhone, iPad, iOS Simulator
  2. Drag/drop the library file, and the headers folder (should be called "usr") into your iPhone/iPad project.

I do have that library .a file and headers. I drag & droped them in my project and build them successfully.

I added this sample code in appDidfinish(from reliks README):

NSString* svgFilename = @"Monkey";

NSLog( @"[%@] Loading SVG document, filename = %@", [self class], svgFilename );

/** Optional: if you're using the parser extensions, add them here [SVGDocument addSVGParserExtension:[[SVGParserConquest alloc] init]]; */

SVGDocument* svgDocument = [SVGDocument documentNamed:svgFilename];

SVGDocumentView* docView = [SVGDocumentView documentViewWithDocument:svgDocument];

[self.window.layer addSublayer:docView.rootLayer];

And now I have error:

SVGError

Does this mean that build was done wrong or something else. I cloned SVGKit/SVGKit repository again and build it and this is what happened.

Steven Fusco
Owner

git clone https://github.com/reklis/SVGKit
cd SVGKit/
git submodule init && git submodule update

All xcode projects compile just fine...

Steven Fusco reklis closed this
Dino4674

Just tried again. I was skipping git submodule init && git submodule update parts.

I have to remove libxml2.dylib from SVGKitLibrary/Linked Frameworks for build to succeed.
Then I get in Debug-iphonesimulator folder libSVGKitLibrary.a and "usr" folder with headers.
I drag&drop that usr folder and .a file in my project and while trying to parse Monkey.svg I get this error:

error

I really don't see what I am doing wrong since there are only few steps to do.

adamgit

"SVGKitTest" ? Are you sure you're running the right project?

Dino4674

That is my project where I wanted to test SVGKit. SVGPadDemo is running fine.
What else do I need to include in my project for it to build?

I just copied .a file and usr folder and the problem is as shown above.

adamgit

Well, as per instructions, you need to use Universal for starters

Second, it sounds like your "usr" folder doesn't contain the header file that's listed. Check the usr folder - both on disk and in xcode

Everything is working "out of the box" for the rest of us, so it's hard to guess what's gone wrong for you

Dino4674

Hi Adam,

as I said, I don't get debug-universal folder, I get Debug-iphonesimulator.
usr folder does not contain that header file.

My steps were:

git clone https://github.com/reklis/SVGKit
cd SVGKit/
git submodule init && git submodule update

Then I got in build Debug-iphonesimulator fodler .a file and usr folder with headers.
I copied them in my project (SVGKitTest) and it fails at the very beginning while importing that not existing header.

This is really frustrating that it works for everybody else and I don't think I am doing anything wrong.

adamgit

If you don't have universal folder, nothing else matters.

What are you building to generate SVGKit? If it's iOS, should be SVGKitLibrary (off the top of my head). Screenshot of successful build of SVGKitLibrary?

Dino4674

I did again now all steps above:

  1. git clone https://github.com/reklis/SVGKit
  2. cd SVGKit/
  3. git submodule init
  4. git submodule update

  5. Open SVGKit/XCodeProjects/SVGKit/SVGKit.xcodeproj

  6. In targets I select SVGKitLibrary>iPhone 5.1 Simluator
  7. Cmd + B -> Build fails
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libxml2.dylib (No such file or directory)

  1. In Xcode project under SVGKit/SVGKitLibrary/Linked Frameworks I delete libxml2 (It still stays in Build phases)
  2. Cmd + B -> Build success and now I have Debug-iphonesimulator fodler with "usr" folder and .a file

Why I can't get that iphone-universal folder? :S:S:S:S

adamgit

Try building for iOS Device. There are bugs in Xcode that sometimes it doesn't build correctly if you use simulator only.

Dino4674

I tried and now I get Debug-iphoneos folder with same contents?

Steven Fusco
Owner

I see the apparent problem we have with hard linking to a 5.0 library now, I will do a little searching. I believe there is a way to reference the default sdk folder as a variable instead of a hard coded path to 5.0. That way whatever your default is, be it 4, 5, 6 or what have you, it ought to "just work" so long as some libxml exists

Steven Fusco
Owner
Steven Fusco reklis reopened this
Dino4674

Hi reklis,

when will this be implemented?

Steven Fusco
Owner

It's in

Steven Fusco reklis closed this
Dino4674

Hi reklis,

I tried with your latest commit and still I am getting only Debug-iphonesimulator and Debug-iphoneos folders.
And again there is that header missing (SVGStyleCatcher.h)

Dino4674

Can someone clone this repository and do steps:

  1. git clone https://github.com/reklis/SVGKit
  2. cd SVGKit/
  3. git submodule init
  4. git submodule update
  5. Build SVGKitLibrary

because I am not getting Debug-universal folder, just Debug-iphonesimulator and Debug-iphoneos. As for the result, I get usr folder and .a library file. I c/p those two in my project I am getting errors like above (SVGStyleCatcher.h).

Steven Fusco
Owner

I just tried from scratch, with Xcode 4.3.3 iOS 6. Newer versions of XCode place this stuff in the derived data folder. Sorry for the confusion mate. The README file is a bit out of date.

http://imgur.com/KWx56

Steven Fusco
Owner

You do NOT need a Universal library if you are only doing iOS work. If all you want is iOS, just drag and drop. I'll update the README today, it's not really nice to mislead people with bad info and force them to read debug build logs.

adamgit

Without the universal, you have a library that will run on either a Simulator ... or a phone ... but not both.

It's "universal" in that it supports simulator + device ... not "device + OS X".

adamgit

@Dino I think some files have got "removed' from Xcode's internal list of which files it is supposed to include.

For each .h file that is "missing", if you find the .m file with same name (in the SVGKit project), and enable the right-hand-side bar, and look for the tickbox with the name "SVGKitLibrary" .... it MUST be ticked (for every .m file, it should be ticked for EVERY .m file, unless that file is for OS X only (I don't know if we have any of those any more?))

I found a build just now that was missing some of the ticks.

Dino4674

@adamgit I checked all files, and they're all ticked for SVGKitLibrary. Could it be something else?

adamgit

I suggest you open separate tickets for the different problems, because this is getting too confusing. I don't know what problems you still have (three different problems have been uncovered in this thread, and fixed as far as I can tell).

Steven Fusco
Owner

Agreed. This issue is closed, I've addressed the README in both my project, and upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.