Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

Building intel pcm on Mac

Grischa_J_
Beginner
883 Views

Hi,

following errors when I build intel pcm 2.7 on my Mac with sdk 10.10.

In file included from /opt/pcm_neu/intel-pcm/src/MacMSRDriver/PcmMsr/PcmMsrClient.cpp:15:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLib.h:48:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLocks.h:130:64: error: expected function body after function declarator

int     IOLockSleep( IOLock * lock, void *event, UInt32 interType) __DARWIN14_ALIAS(IOLockSleep);

                                                                   ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLocks.h:133:49: error: expected function body after function declarator

                                                 AbsoluteTime deadline, UInt32 interType) __DARWIN14_ALIAS(IOLockSleepDeadline);

                                                                                          ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLocks.h:135:63: error: expected function body after function declarator

void    IOLockWakeup(IOLock * lock, void *event, bool oneThread) __DARWIN14_ALIAS(IOLockWakeup);

                                                                 ^

In file included from /opt/pcm_neu/intel-pcm/src/MacMSRDriver/PcmMsr/PcmMsrClient.cpp:15:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLib.h:327:6: error: conflicting types for 'Debugger'

void Debugger(const char * reason);

     ^

In file included from /opt/pcm_neu/intel-pcm/src/MacMSRDriver/PcmMsr/PcmMsrClient.cpp:15:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOLib.h:47:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/IOTypes.h:55:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libkern/OSTypes.h:29:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/MacTypes.h:708:1: note: previous declaration is here

Debugger(void)                                                __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);

^

/opt/pcm_neu/intel-pcm/src/MacMSRDriver/PcmMsr/PcmMsrClient.cpp:172:38: warning: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]

    uint32_t num_cores = output_size / sizeof(topologyEntry);

             ~~~~~~~~~   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

1 warning and 4 errors generated.

0 Kudos
8 Replies
Patrick_F_Intel1
Employee
883 Views

Hello Grischa,

Here are some workarounds. I'm not a Mac expert and generally quit looking for the 'right' answer after i get something that works.

For the 'expected function body' error you can try 1) commenting out the "#include <IOKit/IOKitLib.h>" line or 2) adding the following two lines before the include:

#define    __DARWIN_SUF_DARWIN14    "_darwin14"
#define    __DARWIN14_ALIAS(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_DARWIN14)


For the 'Debugger()' error you can try: A) finding the reference to /usr/include in the PcmMsr.xcodeproj settings... I hate xcode and can't find it.

or you can do B) get out of xcode and edit PcmMsr.xcodeproj/project.pbxproj and change (in two different places):

"HEADER_SEARCH_PATHS[arch=*]" = /usr/include;

to:

/*"HEADER_SEARCH_PATHS[arch=*]" = /usr/include;*/

Now it should build... at least it worked for me...
Pat

0 Kudos
Grischa_J_
Beginner
883 Views

Hello Patrick,

this worked for me. Maybe you want to change these settings to the repository? Additional I had some problems withe code signing on yosemite (10.10). This helped me out: http://stackoverflow.com/questions/26671885/codesigned-kext-but-why-not-load-in-yosemite10-10

A folder in /usr/include/ needs to be created if not existing.

cheers
Grischa

0 Kudos
Patrick_F_Intel1
Employee
883 Views

Glad it worked.

For option 1) and 2), which worked for you? Similarly for A) and B) which worked? If A) worked, where in xcode is the reference to /usr/include?

Thanks, Pat

0 Kudos
Chris_S_3
Beginner
883 Views

Building PCM will be one thing but then running it is another. OSX doesn't set the CR4.PCE bits to enable reading the PCM registers with RDPMC in user space.

0 Kudos
Patrick_F_Intel1
Employee
883 Views

I don't know about setting CR4... but PCM runs fine for me... after another couple of changes below.

I downloaded the current version (which prints a message PCM v2.8). I'm running Mac OS X 10.10.3, xcode 6.3.1, LLVM ver 6.1.0. I had to change the build settings in MacMSRDriver/PcmMsr.xcodeproj.

My system is an ivy bridge based MacBook Pro.

I also had to comment out the call to freeRMID() in the PCM::cleanup() routine in cpucounters.cpp.

If freeRMID() is not commented out then my Mac crashes when I hit control-C while running pcm.x. I believe that the next version of PCM will avoid calling freeRMID() on systems which don't have the RMID MSRs.

Pat

0 Kudos
Patrick_F_Intel1
Employee
883 Views

Sorry. I hit send too quickly. The line above in my reply "I had to change the build settings in MacMSRDriver/PcmMsr.xcodeproj" should say "I had to change the build settings in MacMSRDriver/PcmMsr.xcodeproj to say the Architectures Based SDK was OS X 10.9". The default Base SDK was 10.8 (I think) which I don't have installed (and I don't know how to get SDK 10.8).

Pat

0 Kudos
Grischa_J_
Beginner
883 Views

Hi Pat,

2) worked for me. I didn't tried 1). Is it some how possible to support Sandy Bridge?

Grischa

0 Kudos
Patrick_F_Intel1
Employee
883 Views

Hello Grischa,

I believe PCM does support Sandy bridge. Are you getting an error message? Can you redirect the output to a file and attach the file?

Pat

0 Kudos
Reply