To register and login, use your Google, Twitter, Facebook, LinkedIn, or OpenID credentials.

This is allowing us to stop most spam registrations. We've deleted most of the spam accounts that got through, and we're closely watching for more.

Can't compile expr~ with XCode 4.5.2 - same project works in XCode 4.4.1

shmimpieshmimpie Posts: 29
edited November 2012 in Pd Everywhere

Hi all,

The issue I'm encountering was previously discussed and solved in this thread: http://createdigitalnoise.com/discussion/302/using-expr-in-libpd/p1

But that solution isn't working anymore.

To reiterate:

  • If you add expr to a libpd project (I'm using Peter Brinkman's Guitar Tuner project from his book as a simple test case) and try to compile it, you'll get errors complaining about the 'finite' and 'drem' methods not being included in the target architecture.
  • The solution was to add a simple C file that overrides these function calls. The following works in XCode 4.4.1, but not 4.5.2:

#include 
#include 
#include 

#if !(TARGET_IPHONE_SIMULATOR)
    int finite(double x){return isfinite(x);}
    double drem (double x, double y){return remainder(x, y);}
#endif 


XCode complains about drem and finite as if the fix were not applied.

Anyone have any theories as to why?

Answers

  • Nobody has encountered this? It seems to me that we can't use the expr~ library with the latest version of XCode. For me that's a dealbreaker. I'd love to be wrong!

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    I'm still at XCode 4.4, so I can't try this right now. Anyone...?

  • shmimpieshmimpie Posts: 29
    edited November 2012

    Hi Peter,

    You can have multiple copies of Xcode on your computer. I do. Since XCode 4.3, they've been 'Application Bundles', which means that everything for the application is contained in the .app file. You can rename those to include the version number.

    You can download XCode 4.5 here: https://developer.apple.com/downloads/index.action

    If you want, you can use the 'select' command to tell your Mac which version you intend to use: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html

    Anyway, maybe this will inspire you to try this out yourself :-)

  • reakinatorreakinator Posts: 301
    edited November 2012

    Is that block of code in the #if / #endif statements getting used on your device (you are trying to build for the device, right?)? You can check by putting a

    #warning "this is getting compiled"
    

    in-between. If it were getting compiled, you would at least get other warnings, because you are defining it there.

    Are you #including TargetConditionals.h?

  • shmimpieshmimpie Posts: 29
    edited November 2012

    I am including TargetConditionals.h. It got stripped out of the code above...

    On both XCode 4.4.1 and 4.5.2, 'this is getting compiled' shows up in the Issues Navigator.

    But on XCode 4.5.2, the build fails and we get the following messages:

    'finite' is unavailable: not available on iOS

    'drem' is unavailable: not available on iOS

    followed by...

    Apple LLVM compiler 4.1 Error: Too many errors emitted, stopping now

  • So maybe nobody cares that we can't use expr~ with the latest versions of iOS?

    Again, hopefully it's my error, but I don't think so. I just added expr~ to a working project and that project stopped working in the newest version of XCode.

    Any help would be appreciated!

  • pbrinkmannpbrinkmann Posts: 686 ✭✭
    edited November 2012

    The problem is that vexp_fun.c uses some deprecated functions that seem to have been removed from recent versions of XCode. Try these changes instead of the fix you mentioned above:

    Rewrite line 1276 like this: FUNC_DEF_UNARY(ex_finite, isfinite, (double), 0);

    Rewrite line 1291 like this: FUNC_DEF(ex_drem, remainder, (double), (double), 1);

    Please let me know whether this solves the problem. If it does, I'll submit the patch to Miller.

  • Well, that was embarrassingly easy! I got so caught up in 'it should work!' that I failed to just MAKE it work.

    Thank you. It works!

    The functions were equally deprecated in previous versions of XCode, so I'm not sure why the original fix didn't work in this version. It's not that important to me, but sometimes it's nice to know why something didn't work...

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    Glad it works. I pushed the change to GitHub and submitted the patch to Miller.

Sign In or Register to comment.