TooTallNate / node-iOS

Native node bindings to iOS functionality (vibrate, acceleromoter, geoservices, etc.)
https://tootallnate.net/nodejs-on-ios
MIT License
267 stars 18 forks source link

Failing to compile on with recent XCode headers #14

Open TooTallNate opened 13 years ago

TooTallNate commented 13 years ago

I can't figure out why this is happening, but it's been preventing me from making on progress on this module. Both my iPhone 4 and iPad 2 are on 4.3.3 and jailbroken with jailbreakme.com. When my iPhone was on 4.3.1 things worked as expected.

Here's the dump:

Nathan-Rajlichs-iPhone:~/node-iOS root# node-waf clean configure build
'clean' finished successfully (0.103s)
Setting srcdir to                        : /private/var/root/node-iOS 
Setting blddir to                        : /private/var/root/node-iOS/build 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr 
'configure' finished successfully (0.555s)
Waf: Entering directory `/private/var/root/node-iOS/build'
[1/6] cxx: src/binding.cc -> build/default/src/binding_1.o
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:8,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:15,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:9,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9,
                 from ../src/binding.cc:4:
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:282: error: format string argument follows the args to be formatted
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:284: error: format string argument follows the args to be formatted
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:25,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:9,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9,
                 from ../src/binding.cc:4:
/System/Library/Frameworks/Foundation.framework/Headers/NSException.h:62: error: format string argument follows the args to be formatted
In file included from /System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:13,
                 from /System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
                 from ../src/binding.cc:4:
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:250: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:250: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:250: error: expected `;' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252: error: expected `;' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:254: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:254: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:254: error: expected `;' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:256: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:256: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:256: error: expected `;' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:258: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:258: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:258: error: expected `;' before '(' token
In file included from /System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:13,
                 from ../src/binding.cc:4:
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:193: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:193: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:193: error: expected `;' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:196: error: expected `)' before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:196: error: expected identifier before '(' token
/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:196: error: expected `;' before '(' token
In file included from /System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:52,
                 from ../src/binding.cc:4:
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:16: error: expected unqualified-id before '^' token
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:16: error: expected `)' before '^' token
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:30: error: expected `;' before '_completionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:54: error: expected type-specifier before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:54: error: expected `)' before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:54: error: expected `;' before ')' token
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:55: error: expected type-specifier before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:55: error: expected `)' before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:55: error: expected `;' before ')' token
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:56: error: expected type-specifier before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:56: error: expected `)' before 'UIPrintInteractionCompletionHandler'
/System/Library/Frameworks/UIKit.framework/Headers/UIPrintInteractionController.h:56: error: expected `;' before ')' token
Waf: Leaving directory `/private/var/root/node-iOS/build'
Build failed:  -> task failed (err #1): 
    {task: cxx binding.cc -> binding_1.o}

This is the first error, but googling it doesn't bring up anything useful:

/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:282: error: format string argument follows the args to be formatted

Thinking about downgrading my iPhone, but I'd rather... not...

/cc @larryhe

larryhe commented 13 years ago

what will be printed out if you run echo $NODE_PATH. It seemed that NODE_PATH is missing. Here on my box, " /var/mobile/node_modules" will be printed.

TooTallNate commented 13 years ago

No I don't think it's related to node. For instance, a simple "hello world" example like below is failing for me (this is still happening even though I just did a fresh re-install of iOS):

#import <Foundation/Foundation.h>

int main() {
  return 0;
}

and then trying to compile:

root# gcc -ObjC -framework Foundation -o test test.m
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:8,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:15,
                 from test.m:1:
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:282: error: format string argument follows the args to be formatted
/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:284: error: format string argument follows the args to be formatted
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:25,
                 from test.m:1:
/System/Library/Frameworks/Foundation.framework/Headers/NSException.h:62: error: format string argument follows the args to be formatted

If I remove the #import statement, then it compiles, so there's something up with the header files. I just haven't figured out what exactly.

larryhe commented 13 years ago

OK. have you upgraded your Mac OS X? Lion was just released. if you did that, the header files may be different

TooTallNate commented 13 years ago

I have indeed upgraded to Lion, however I've been experiencing this since before, when I was on Snow Leopard. I was hoping upgrading to Lion and reinstalling to a fresh iPhone OS would do the trick, but sigh...

On Sun, Aug 7, 2011 at 11:32 PM, larryhe < reply@reply.github.com>wrote:

OK. have you upgraded your Mac OS X? Lion was just released. if you did that, the header files may be different

Reply to this email directly or view it on GitHub: https://github.com/TooTallNate/node-iOS/issues/14#issuecomment-1751932

bored-engineer commented 13 years ago

Same issue on iOS 4.3.3 iPad 2 + Lion.

bored-engineer commented 13 years ago

Same issue on armv6 4.2.1 iPod2,1 + Snow Leopard.

bored-engineer commented 13 years ago

Same issue on iPod3,1 5.0 beta 4 and 5. + Lion. Obviously this is not a firmware issue. As it was stated before, it may be a headers issue. Do you remember when the last time you had it working? I don't think it's Lion since it was not working with my Snow Leopard headers either.

larryhe commented 13 years ago

I just tried to clean configure and build on my iPad 2( 4.3.3) yesterday. It worked quite well. OK. Let me build it on Mac and see if it works. Will update you

bored-engineer commented 13 years ago

What OS did you copy your header files from?

On Aug 8, 2011, at 11:30 PM, larryhe wrote:

I just tried to clean configure and build on my iPad 2( 4.3.3) yesterday. It worked quite well. OK. Let me build it on Mac and see if it works. Will update you

Reply to this email directly or view it on GitHub: https://github.com/TooTallNate/node-iOS/issues/14#issuecomment-1760693

TooTallNate commented 13 years ago

@larryhe You also would have needed to copy over some private header files. Where did you get those from?

larryhe commented 13 years ago

Snow leopard 10.6

larryhe commented 13 years ago

do you have a yahoo or msn. i'd like to add you so that we can communite easily

larryhe commented 13 years ago

I copied all those files from my Mac OS X 10.6

TooTallNate commented 13 years ago

@innoying @larryhe A point update from Snow Leopard might have changed the header files then. What full version are you guys on? 10.6.x?

TooTallNate commented 13 years ago

@larryhe Easiest place to chat with me is on #node.js on freenode IRC. I'm on there a lot.

larryhe commented 13 years ago

10.6.7. OK.

bored-engineer commented 13 years ago

I believe after poking around it has something to do with apples transition to clang...

TooTallNate commented 13 years ago

That's definitely possible. But doesn't really explain how @larryhe's got it working...

On Mon, Aug 8, 2011 at 10:26 PM, innoying < reply@reply.github.com>wrote:

I believe after poking around it has something to do with apples transition to clang...

Reply to this email directly or view it on GitHub: https://github.com/TooTallNate/node-iOS/issues/14#issuecomment-1760900

treason commented 13 years ago

What headers are you all using? I'm using headers from 3.0... are you all using 5.0?

Honestly I'm nervous to upgrade from leopard, let alone compile against iOS 5.

TooTallNate commented 13 years ago

I sorta have a feeling that using older headers would do the trick, the problem is now I can't get my hand on them!

treason commented 13 years ago

Here ya go: https://github.com/nst/iOS-Runtime-Headers