Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

installation errors on rake #1

Closed
malkomalko opened this Issue May 03, 2012 · 45 comments
Robert Malko

please see gist: https://gist.github.com/794aa238835b9afe7583

after installing cocoapods and following the instructions, I added a few pods

when running rake, when it's trying to install it blows up with an error in the gist

Robert Malko

what's interesting is, even after you comment out, or remove the dependency lines from app.pods, when you run a 'rake config' it still shows up in pods

Matt Green

I'm seeing something similar, but it occurs when I attempt using RestKit.

Eloy Durán
Owner
alloy commented May 04, 2012

@mattgreen Be sure to require one of the RestKit ‘subspecs’ not just ‘RestKit’. See CocoaPods/CocoaPods#160

Matt Green

Yeah I figured that out by trial and error. :)

I still get this:
ERROR! Building vendor project ./vendor/ISO8601DateFormatter' failed to create at least one.a' library.

Robert Malko

yah, same for me, it's kind've hit or miss

gonna see if I can take a look into it as well

Eloy Durán
Owner
alloy commented May 04, 2012

it's kind've hit or miss

Is it, or is it not always with the same libraries?

Robert Malko

let me do a step by step:

  • so right now for instance I have nothing in the app.pods configuration block.. in fact I just deleted it. after running rake config in my project I see that the pods configuration still looks something like this:

https://gist.github.com/42f5efdc09c6b7200a5e

so I'm not sure if that has any effect on any type of caching or if it's just a display bug

  • ok let's wipe out cached vendor folder

  • let's add back our config
    app.pods do
    dependency 'AFNetworking'
    end

  • run rake

➥ rake
Build ./build/iPhoneSimulator-5.1-Development
rake aborted!
can't convert Pathname into String

  • let's try removing the vendor dir and instead doing rake --config (this is where the wonkiness comes in)
    It works here! can't explain it. You see a lot of output lines but it properly launches app.

  • great let's run rake again.. nope same error as #4

Matt Green

I've never seen CocoaPods + Motion together install anything yet.

Is there a super-simple library I can try? Even JSONKit (as shown in the example) produces the same result. I just tried making a regular XCode project and using CocoaPods with RestKit (using all the subspecs) and it builds fine.

Dan Lucraft

There's a line in vendor.rb in the method build_static where this glob exists:

Dir.glob('*/**/*.o')

This doesn't seem to be finding all the object files in the directory tree (for ASIHTTPRequest and JSONKit at least). Replacing that glob with:

(Dir.glob('*/**/*.o') + Dir.glob("*.o") + Dir.glob("*/*.o")).uniq

made the build task find all the .o output files and build the .a library correctly.

The new problem is that the Cocoapod gem doesn't seem to be passing all of the .m files in to be built in the first place (for some reason it isn't building ASIHTTPRequest/Classes/ASIAuthenticationDialog.m in particular...)

Eloy Durán
Owner
alloy commented May 04, 2012

There's a line in vendor.rb in the method build_static where this glob exists:

Dir.glob('*/**/*.o')

This doesn't seem to be finding all the object files in the directory tree (for ASIHTTPRequest and JSONKit at least). Replacing that glob with:

(Dir.glob('*/**/*.o') + Dir.glob("*.o") + Dir.glob("*/*.o")).uniq

made the build task find all the .o output files and build the .a library correctly.

Good find! Will you submit a pull-request for that?

The new problem is that the Cocoapod gem doesn't seem to be passing all of the .m files in to be built in the first place (for some reason it isn't building ASIHTTPRequest/Classes/ASIAuthenticationDialog.m in particular...)

I think I know the problem, will look in a bit.

Dan Lucraft

Good find! Will you submit a pull-request for that?

Will do.

I think I know the problem, will look in a bit.

Hacked in a different source file finder (*.m and */*.m) just to get this working, and it all built and I'm using JSONKit and ASIHTTPRequest happily now :)

Eloy Durán alloy referenced this issue from a commit May 04, 2012
Eloy Durán Need to assign the `podfile` as the `rootspec` of the config for `con…
…fig.ios?` to work properly. Part of #1.
72e5ef6
Eloy Durán
Owner
alloy commented May 04, 2012

@danlucraft

Good find! Will you submit a pull-request for that?

Will do.

Actually, I mistook the file that the problem is in for a file in this repo. vendor.rb is part of RubyMotion itself and thus needs to be fixed by @lrz who is going to do that as soon as possible.

Eloy Durán
Owner
alloy commented May 04, 2012

@danlucraft I’ve just pushed a fix for the other issue you found, thanks for the report!

Robert Malko

@danlucraft what vendor.rb file did you make changes to.. what is the file loc?

Eloy Durán
Owner
alloy commented May 04, 2012
John Wright

Where are we on this, has the fix been applied or should I manually put in a fix? @danlucraft I changed the line vendor.rb and JSONKit is building now but is there another line I should change somewhere?

Elias Klughammer
eliaskg commented May 05, 2012

+1

Got the same problem with RestKit.

Nate Todd
ntodd commented May 05, 2012

Same problem with GMGridView and AFNetworking. Oddly enough, rake --trace builds fine without the path error, but seems to fail to link the libraries properly.

Lee Adkins

I'm seeing a similar issue as ntodd. A simple rake (using only AFNetworking) produces the same error as the original post:

Build ./build/iPhoneSimulator-5.1-Development
rake aborted!
can't convert Pathname into String

However, a rake --trace completes without error, loads the simulator, and AFNetworking works fine.

Marin Usalj

+1 , with rake --trace works for me as well

Steve Kellock

To fix the "Pathname into String" issue temporarily, try this:

/Library/RubyMotion/lib/motion/project/vendor.rb

Change line 22 from:

  App.info 'Build', @path

To:

  App.info 'Build', @path.to_s
Marin Usalj

Thanks! that worked

Christian Schulze

I was getting the same Pathname error whilst using JSONKit pod (RVM 1.13.0 and Ruby 1.9.3p125). Using system ruby (1.8.7) via a .rvmc file silenced the Pathname error. Hope this helps.

Dylan Markow
dmarkow commented May 06, 2012

In vendor.rb, just using Dir.glob('**/*.o') fixed the problem for me.

Matt Brewer

Filed a support ticket via the motion support on this one as well, I'm not having any luck with the suggested fix of:

line 22: App.info 'Build', @path.to_s and then on line 77: Dir.glob('**/*.o') fixes.

Running RVM 1.8.6 & Ruby 1.9.2p290

Alistair Holt

I'm on 10.6.8 running rbenv and Ruby 1.9.3-p194 and also had these issues. Fixed for me with the changes to vendor.rb already mentioned:

Line 22: App.info 'Build', @path.to_s
Line 77: objs = Dir.glob('**/*.o')

Matt Brewer

@alistairholt Did you do anything other than just open the file, make those changes, save the file & then re-run rake from within your RubyMotion project dir?

Alistair Holt

@macfanatic nope, that was all I did to get it working. I have since made some other changes to vendor.rb due to and unrelated problem I encountered with --no-64-bit flags on Snow Leopard.

Dylan Markow
dmarkow commented May 06, 2012

@macfanatic after making those changes, what error do you get?

Matt Brewer

I want RestKit installed, but for the time being I'm working with just JSONKit.

So, after making those changes to vendor.rb & running rake, I get:

rake aborted!
No such file or directory - ./vendor/JSONKit

In which case, I go in and manually create ./vendor/JSONKit in my project & rerun rake, resulting in:

     Build ./build/iPhoneSimulator-5.0-Development
     Build ./vendor/JSONKit
    ERROR! Building vendor project `./vendor/JSONKit' failed to create at least one `.a' library.

My current Rakefile contains:

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'

Motion::Project::App.setup do |app|

  # Use `rake config' to see complete project settings.
  app.name = 'xxxx'
  app.identifier = 'xxxxx'
  app.deployment_target = '5.0'
  app.device_family = :ipad
  app.frameworks += %w(CoreData CFNetwork Security MobileCoreServices SystemConfiguration QuartzCore)
  # app.libs << '/usr/lib/libxml2.dylib'
  app.interface_orientations = [:landscape_left, :landscape_right]

  app.pods do
    # dependency 'Reachability',      '~> 2.0.4'
    # dependency 'RestKit/Network'
    # dependency 'RestKit/UI'
    # dependency 'RestKit/ObjectMapping'
    # dependency 'RestKit/ObjectMapping/JSON'
    dependency 'JSONKit'
  end

end

I'm in the process up updating RVM to HEAD & upgrading to ruby 1.9.3-p125 this evening as well (just started after all this).

Laurent Sansonetti
Owner
lrz commented May 06, 2012

I merged the changes in vendor.rb and they will appear in the next build (in a few hours hopefully). Thanks a lot guys for the detective work!

Matt Brewer

And looking in ./vendor/JSONKit is interesting, as there isn't a single file in that directory.

Fabio Pelosin

If you create the dir manually CocoaPods thinks that the pod is already installed and skips it (not final behavior, just a stopgap solution).

Matt Brewer

@irrationalfab Maybe just permission issues on the ./vendor directory then? I've tried opening it up to 0777 to no effect.

Currently I'm trying to get RestKit to install by placing the source in the ./vendor/RestKit directory & using the vendor_project command, as in:

  app.vendor_project('vendor/RestKit', :xcode, target: 'RestKit')

Appears that everything compiles just fine & the application launches, however when I go to use the class I get failed Objc stub errors:

Objective-C stub for message `post:params:delegate:' type `@@:@@@' not precompiled. Make sure you properly link with the framework or library that defines this message.

Seems like something isn't quite right in the linking phase, am I right?

Fabio Pelosin

Seems like something isn't quite right in the linking phase, am I right?

@macfanatic I can't comment on RubyMotion side as I haven't played enough with it... yet.

Regarding CocoaPods, I'm not aware of any issue that could result in not creating a Pod folder without raising an error. So my bet is in something like the permissions issues. When I have the chances to test the integration better I'll report back.

Matt Brewer

@irrationalfab Does appear it was a permissions issue, as I tried setting all this up on my other Mac & had no issues getting the code downloaded when I ran rake. Now I'm fighting with FileMD5Hash compiler errors that RubyMotion doesn't appear to know how to handle.

Ie:

     Build ./build/iPhoneSimulator-5.1-Development
     Build ./vendor/FileMD5Hash
   Compile ./vendor/FileMD5Hash/Common/FileMD5Hash.c
In file included from Common/FileMD5Hash.c:26:
/Users/matt/Desktop/Projects/xxx/vendor/FileMD5Hash/Common/FileMD5Hash.h:44:1: error: unknown type name 'FILEMD5HASH_EXTERN'
FILEMD5HASH_EXTERN CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath, 
^
/Users/matt/Desktop/Projects/xxx/vendor/FileMD5Hash/Common/FileMD5Hash.h:44:31: error: expected ';' after top level declarator
FILEMD5HASH_EXTERN CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath, 
                              ^
                              ;
Common/FileMD5Hash.c:43:1: error: unknown type name 'CFStringRef'
CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath,
^
Common/FileMD5Hash.c:43:39: error: unknown type name 'CFStringRef'
CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath,
                                      ^
Common/FileMD5Hash.c:106:5: error: use of undeclared identifier 'result'
    result = CFStringCreateWithCString(kCFAllocatorDefault,
    ^
Common/FileMD5Hash.c:119:12: error: use of undeclared identifier 'result'
    return result;
           ^
6 errors generated.
zigphroid

@macfanatic working on this as well.. FILEMD5HASH_EXTERN is defined in FileMD5Hash_Prefix.pch

Looks like for some reason thats not being included while building? I was able to work around it by manually including it.
I added:
#include "FileMD5Hash_Prefix.pch"

to FileMD5Hash.h:30

Which successfully builds FileMD5Hash.

But then.. get ready to run into build errors in RestKit land..

Matt Brewer

Yep, I get the following errors after making that suggested change:

     Build ./build/iPhoneSimulator-5.1-Development
     Build ./vendor/FileMD5Hash
   Compile ./vendor/FileMD5Hash/Common/FileMD5Hash.c
     Build ./vendor/LibComponentLogging-Core
   Compile ./vendor/LibComponentLogging-Core/lcl.m
     Build ./vendor/LibComponentLogging-NSLog
   Compile ./vendor/LibComponentLogging-NSLog/LCLNSLog.m
/Applications/Xcode.app/Contents/Developer/usr/bin/ranlib: file: libLibComponentLogging-NSLog.a(LCLNSLog.m.o) has no symbols
     Build ./vendor/NSData+Base64
   Compile ./vendor/NSData+Base64/NSData+Base64.m
     Build ./vendor/RestKit
   Compile ./vendor/RestKit/Code/Network/NSData+RKAdditions.m
   Compile ./vendor/RestKit/Code/Network/NSDictionary+RKRequestSerialization.m
   Compile ./vendor/RestKit/Code/Network/NSObject+URLEncoding.m
   Compile ./vendor/RestKit/Code/Network/RKClient.m
In file included from Code/Network/RKClient.m:21:
In file included from /Users/matt/Desktop/Projects/xxx/vendor/RestKit/Code/Network/RKClient.h:22:
In file included from /Users/matt/Desktop/Projects/xxx/vendor/RestKit/Code/Network/RKRequest.h:26:
/Users/matt/Desktop/Projects/xxx/vendor/RestKit/Code/CoreData/CoreData.h:22:9: fatal error: 'ObjectMapping.h' file not found
#import "ObjectMapping.h"
        ^
1 error generated.
rake aborted!

Looks like prefix.pch files aren't being considered in the build process?

Eloy Durán
Owner
alloy commented May 07, 2012

@macfanatic That’s correct, currently they aren't. In the next release (not the upcoming one) we're going to change the way motion-cocoapods uses CocoaPods to make it work exactly like CocoaPods normally does, which will fix these issues.

Matt Brewer

@alloy Out of curiosity, when do you expect the release that fixes these issues to be available? We're evaluating RubyMotion to use at the start of an iPad project and this appears to be the last big issue preventing us from going down this path.

If it's going to be awhile out, not going to fit in our deadline :)

Thanks!

Eloy Durán
Owner
alloy commented May 07, 2012

All of the original issues described in this ticket are fixed in RubyMotion 1.2 and the just released motion-cocoapods 1.0.1 gem. I will create a new ticket regarding the other issue.

Eloy Durán alloy closed this May 07, 2012
Eloy Durán
Owner
alloy commented May 07, 2012

@macfanatic We will work on it on Friday. It will most likely be easy enough, but I can’t promise anything yet.

Having said that, you should be probably be able to use CocoaPods as normal (i.e. add a Podfile), but without integrating it into App.xcodeproj (by omitting it from pod install) and add the resulting Pods.xcodeproj as a normal ‘Xcode vendor’. This is essentially what the next version will do :)

HTH.

Matt Brewer

@alloy - Here's what I tried, per your previous suggestion:

  • mate Podfile (contents below)
  • pod install
  • edited the Rakefile to vendor the Pods.xcodeproj project (contents below)

Podfile

platform :ios
dependency 'RestKit/Network'
dependency 'RestKit/UI'
dependency 'RestKit/ObjectMapping/CoreData'
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'

Motion::Project::App.setup do |app|

  # Use `rake config' to see complete project settings.
  app.name = 'xxx'
  app.deployment_target = '5.1'
  app.device_family = :ipad
  app.frameworks += %w(CoreData CFNetwork Security MobileCoreServices SystemConfiguration QuartzCore)
  app.interface_orientations = [:landscape_left, :landscape_right]

  app.vendor_project('Pods', :xcode, target: 'Pods')

  app.pods do
    # dependency 'RestKit/Network'
    # dependency 'RestKit/UI'
    # dependency 'RestKit/ObjectMapping'
    # dependency 'RestKit/ObjectMapping/JSON'
  end

end

Everything builds, but I end up with the following error:

** BUILD SUCCEEDED **

   Compile ./app/app_delegate.rb
   Compile ./app/authentication_center.rb
   Compile ./app/consignment_navigation_view_controller.rb
   Compile ./app/consignors_view_controller.rb
   Compile ./app/login_view_controller.rb
   Compile ./app/infographic_view_controller.rb
   Compile ./app/main_navigation_view_controller.rb
    Create ./build/iPhoneSimulator-5.1-Development/xxx.app
      Link ./build/iPhoneSimulator-5.1-Development/xxx.app/xxx
    Create ./build/iPhoneSimulator-5.1-Development/xxx.app/Info.plist
    Create ./build/iPhoneSimulator-5.1-Development/xxx.app/PkgInfo
      Copy ./resources/infographic.png
    Create ./build/iPhoneSimulator-5.1-Development/xxx.dSYM
  Simulate ./build/iPhoneSimulator-5.1-Development/xxx.app
(main)>> 2012-05-07 14:21:01.568 xxx[31991:fb03] Splitview controller <UISplitViewController: 0x8e5bd30> is expected to have a master view controller before its used!
(main)>> Objective-C stub for message `post:params:delegate:' type `@@:@@@' not precompiled. Make sure you properly link with the framework or library that defines this message.
((null))>> rake aborted!

This appears to the same error if I just download the RestKit source project & slap that in the ./vendor directory & let motion-cocoapods have at it.

Matt Brewer

@alloy The strange this is I can play around in the IRB-ish prompt via RubyMotion to my heart's content if I just use the RestKit classes & methods myself. However, the moment I access some code that was compiled using RestKit it fails with the Objective-C stub for message 'xxxx' type@@:@@@' not precompiled` error.

Nate Todd
ntodd commented May 07, 2012

FWIW, I also have gotten the ... not precompiled. message on AFNetworking (on the UIImage category) and even several times on UIKit calls...

Considering we're completely on a different problem from the original path error, this might belong in a new issue.

Marc Ignacio padi referenced this issue in yestoall/PaperFold-pod-DEMO October 22, 2012
Closed

rake simulator fails #1

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.