Page 1 of 1

Updated MacOS X SDK?

Posted: May 11th, 2011, 11:52 pm
by ged
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?

Re: Updated MacOS X SDK?

Posted: May 13th, 2011, 7:55 am
by Peewee1963
Let the compiler produce 32bit binaries...

Re: Updated MacOS X SDK?

Posted: May 19th, 2011, 1:27 pm
by ged
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.

Re: Updated MacOS X SDK?

Posted: May 24th, 2011, 11:24 pm
by haboustak
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.

Re: Updated MacOS X SDK?

Posted: June 2nd, 2011, 5:38 pm
by ged
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!

Re: Updated MacOS X SDK?

Posted: January 10th, 2012, 6:07 am
by zaf
Does anyone know where I can locate the test.c file (or any example) so I can play with the code?

Re: Updated MacOS X SDK?

Posted: February 1st, 2012, 2:52 pm
by ged
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;
}