Latest Tip fails to build CTRunGetAdvances not declared


#1

Hi Jules,
Just got the latest tip from GIT and i get an error in juce_mac_Fonts.mm, CTRunGetAdvances is not declared.


#2

No errors here. What SDK/target version are you using?


#3

It’s set to current Mac Os and that’s 10.5


#4

Well, I can build with the 10.5 SDK no problems. (I don’t actually have a 10.5 machine though, but it shouldn’t make any difference)


#5

I believe you, but just a few minutes before my post i got the latest tip and it does not compile, i haven’t changed anything…
It fails with ‘CTRunGetAdvances’ was not declared in this scope.
CTRunGetAdvances is declared in the Applicationservices framework and it don’t see any reference to this framework in Juce…
http://developer.apple.com/library/mac/#documentation/Carbon/Reference/CTRunRef/Reference/reference.html


#6

Well, I really don’t know. I’ve tested the 10.5 and 10.6 SDKs, building for 10.4, 10.5 and 10.6 deployment targets, and can’t really do any more than that.


#7

Are you using the library build, has the library and your project the same base sdk?


#8

This is what i found:

Reference: http://developer.apple.com/library/mac/#documentation/Carbon/Reference/CTRunRef/Reference/reference.html

So CTRunGetAdvances is only available in 10.6, so not sure how this works in your case but as my machine is also 10.5 this might cause a problem.
On this page i found a solution that works for me:
http://www.opensource.apple.com/source/WebCore/WebCore-737.5/platform/graphics/mac/ComplexTextControllerCoreText.cpp

extern "C" {
	void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]);
	const CGSize* CTRunGetAdvancesPtr(CTRunRef run);
	extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel;
}

#9

I’ve already gone to a lot of effort to make sure that it builds correctly with the 10.5 SDK, so you shouldn’t need any workarounds like that.

Since you’re stuck on an old version of the OS, perhaps you’re also not using the latest XCode? (Should be at least 3.2.5)


#10

I got the exact same build error here (using tip, with the new modules code).

I added this code at the top of juce_mac_Fonts.mm to fix it:

#if defined(MAC_OS_X_VERSION_10_5) // The following symbols are SPI in 10.5. extern "C" { void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); const CGSize* CTRunGetAdvancesPtr(CTRunRef run); extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; } #endif


#11

The Apple-approved way to build stuff for 10.5 is actually to use the latest 10.7 SDK, and select 10.5 as your the compatibility target. If you do that, this isn’t necessary.

BTW…

…will always be true, even if you’re using a later SDK. You need to use all the MAC_OS_X_VERSION_MAX_ALLOWED flags to find out what the actual SDK is.


#12

[quote=“jules”]The Apple-approved way to build stuff for 10.5 is actually to use the latest 10.7 SDK, and select 10.5 as your the compatibility target. If you do that, this isn’t necessary.

BTW…

…will always be true, even if you’re using a later SDK. You need to use all the MAC_OS_X_VERSION_MAX_ALLOWED flags to find out what the actual SDK is.[/quote]

oh, good to know. I’m a noob when it comes to Mac, still learning my way in there…
afaik, I can’t install the 10.7 SDK on a 10.5 system (incompatible binaries last time I tried, wasted a lot of time downloading it…)

what macros can be used for someone still on 10.5? (10.5.8 to be exact)


#13

I think you want something like:

#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
#endif

They are defined in AvailabilityMacros.h. There is some documentation on SDK building/configuration at developer.apple.com.

EDIT: Not sure the above is quite right. If you are on SDK 10.4, MAC_OS_X_VERSION_10_5 won’t exist. I think that ends up equating to 0, which would be wrong.

The MAC_OS_X_VERSION_10_x defines are not singular. You get all defines up to, so it might be better to do ‘if not defined’ for the first version that doesn’t require the declarations.

Sorry, I fired off the above without thinking this morning!