Updated MacOS X SDK?

Post questions and issues with Concept2 PM3 SDK
Post Reply
ged
Paddler
Posts: 4
Joined: April 16th, 2011, 2:58 am

Updated MacOS X SDK?

Post by ged » May 11th, 2011, 11:52 pm

The current SDK's libraries were compiled as ppc/i386 binaries, so I can't use them under MacOS 10.6:

Code: Select all

gcc -I. -o test.o -c test.c
gcc -o test test.o libPM3CsafeCP.a
ld: warning: ignoring file libPM3CsafeCP.a, missing required architecture x86_64 in file
Undefined symbols for architecture x86_64:
  "_tkcmdsetCSAFE_get_dll_version", referenced from:
      _main in test.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Are there any plans to update them for the current MacOS?

Peewee1963
Paddler
Posts: 5
Joined: May 8th, 2007, 5:03 am

Re: Updated MacOS X SDK?

Post by Peewee1963 » May 13th, 2011, 7:55 am

Let the compiler produce 32bit binaries...

ged
Paddler
Posts: 4
Joined: April 16th, 2011, 2:58 am

Re: Updated MacOS X SDK?

Post by ged » May 19th, 2011, 1:27 pm

If only...

Code: Select all

gcc -arch i386 -I. -o test.o -c test.c
gcc -arch i386 -o test test.o libPM3CsafeCP.a
Undefined symbols for architecture i386:
  "_tkcmdsetCSAFE_get_dll_version", referenced from:
      _main in test.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I think it has something to do with the table of contents, but frankly, I'm out of my depth. It looks to me like the referenced symbol *is* in the library:

Code: Select all

$ otool -Sv libPM3CSafeCP.a | grep tkcmdsetCSAFE_get_dll_version
PM3CsafeCP.o     __Z29tkcmdsetCSAFE_get_dll_versionv
PM3CsafeCP.o     __Z29tkcmdsetCSAFE_get_dll_versionv.eh
PM3CsafeCP.o     __Z29tkcmdsetCSAFE_get_dll_versionv
PM3CsafeCP.o     __Z29tkcmdsetCSAFE_get_dll_versionv.eh
...but I don't know enough about the Mach-O library format to say for sure. A further complication is that I don't know if the other libraries I'm linking against, which are all i386/x86_64 universal, will be cool with linking against a library that's ppc/i386.

Any advice would be appreciated.

haboustak
500m Poster
Posts: 77
Joined: March 17th, 2006, 3:02 pm
Location: Cincinnati

Re: Updated MacOS X SDK?

Post by haboustak » May 24th, 2011, 11:24 pm

The symbol table you've included indicates that the library was compiled with C++ name mangling, but you're using GCC with a .c extension. If you switch GCC to C++ mode it should link successfully. In other words, it's a compiler problem not an arch problem.

ged
Paddler
Posts: 4
Joined: April 16th, 2011, 2:58 am

Re: Updated MacOS X SDK?

Post by ged » June 2nd, 2011, 5:38 pm

haboustak wrote:The symbol table you've included indicates that the library was compiled with C++ name mangling, but you're using GCC with a .c extension. If you switch GCC to C++ mode it should link successfully. In other words, it's a compiler problem not an arch problem.
Oh, very good. I modified the build to use g++, and got:

Code: Select all

g++ -arch i386 -I. -o test.o -c test.c
g++ -arch i386 -o test test.o libLCPM3USB.a libPM3CSafeCP.a libPM3DDICP.a
Undefined symbols for architecture i386:
  "___CFConstantStringClassReference", referenced from:
      CFString in libLCPM3USB.a(tk_usb_macos.o)
      CFString in libLCPM3USB.a(tk_usb_macos.o)
      CFString in libLCPM3USB.a(tk_usb_macos.o)
      CFString in libLCPM3USB.a(tk_usb_macos.o)
      CFString in libLCPM3USB.a(tk_usb_macos_device.o)
      CFString in libLCPM3USB.a(tk_usb_macos_device.o)
      CFString in libLCPM3USB.a(tk_usb_macos_device.o)
      ...
This happened because I didn't include the necessary frameworks, so after adding:

Code: Select all

-framework CoreFoundation -framework CoreServices -framework IOKit
to the link command, my test program compiled fine.

Thanks for your help!

zaf
Paddler
Posts: 12
Joined: January 10th, 2012, 5:57 am

Re: Updated MacOS X SDK?

Post by zaf » January 10th, 2012, 6:07 am

Does anyone know where I can locate the test.c file (or any example) so I can play with the code?

ged
Paddler
Posts: 4
Joined: April 16th, 2011, 2:58 am

Re: Updated MacOS X SDK?

Post by ged » February 1st, 2012, 2:52 pm

There's not much to play with; what I was testing with was:

Code: Select all

#include <stdio.h>
#include <sys/types.h>
#include <stdint.h>

#include "PM3CsafeCP.h"

#define hibyte(x) (unsigned char)(x>>8)
#define lobyte(x) (unsigned char)(x & 0xFF)

int main( void )
{
	uint16_t ver;
	ver = tkcmdsetCSAFE_get_dll_version();

	fprintf( stdout, "Version is: %d.%d", hibyte(ver), lobyte(ver) );

	return 0;
}

Post Reply