[Openmcl-devel] IOKit

R. Matthew Emerson rme at clozure.com
Mon Aug 1 12:30:36 PDT 2016


Without having investigated at all, I suggest that you make sure that your ffigen is built from the Subversion branch at http://svn.clozure.com/publicsvn/ffigen4/branches/ffigen-apple-gcc-5646/ffigen4.

If you try that and it still doesn't work, please let me know and I'll see if can build interfaces for you when I get a moment.

Depending on how much of IOKit you need to use, you might be able to get by without IOKit interfaces by using external call and foreign-symbol-address, e.g.,

(open-shared-library "/System/Library/Frameworks/IOKit.framework/IOKit")

(external-call "somefunction" :int some-int :void)  ; :void is the return type
(foreign-symbol-address "kIOMasterPortDefault")

In fact, I build some (partial) IOKit interfaces from a client project.  I'll mail them to you in a separate message.  They don't include any of the USB headers, though.




> On Aug 1, 2016, at 2:42 PM, Ron Garret <ron at flownet.com> wrote:
> 
> I want to talk to a USB device from CCL, and to do that I need to invoke IOKit.  Unfortunately, the IOKit headers are not included in the standard distribution so I tried to build them myself.  To do that, I needed to build ffigen, which I tried to do by following the instructions here:
> 
> http://trac.clozure.com/ccl/wiki/BuildFFIGEN
> 
> Unfortunately, that failed thusly:
> 
> gcc -c   -g -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition    -DHAVE_CONFIG_H -I/usr/local/include   -I. -I. -I../../gcc-4.0.0/gcc -I../../gcc-4.0.0/gcc/. -I../../gcc-4.0.0/gcc/../include -I../../gcc-4.0.0/gcc/../libcpp/include  ../../gcc-4.0.0/gcc/timevar.c -o timevar.o
> gcc   -g -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition    -DHAVE_CONFIG_H -I/usr/local/include   -I. -I. -I../../gcc-4.0.0/gcc -I../../gcc-4.0.0/gcc/. -I../../gcc-4.0.0/gcc/../include -I../../gcc-4.0.0/gcc/../libcpp/include  \
> 	  -DTARGET_NAME=\"powerpc-apple-darwin8\" \

I must say powerpc-apple-darwin8 looks rather suspicious.


> 	  -c ../../gcc-4.0.0/gcc/toplev.c -o toplev.o
> In file included from ../../gcc-4.0.0/gcc/toplev.c:55:
> ../../gcc-4.0.0/gcc/output.h:122:6: warning: '__format__' attribute argument not
>      supported: asm_fprintf [-Wignored-attributes]
>     ATTRIBUTE_ASM_FPRINTF(2, 3);
>     ^
> ../../gcc-4.0.0/gcc/output.h:112:53: note: expanded from macro
>      'ATTRIBUTE_ASM_FPRINTF'
> #define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fp...
>                                                    ^
> ../../gcc-4.0.0/gcc/toplev.c:547:1: error: redefinition of a 'extern inline'
>      function 'floor_log2' is not supported in C99 mode
> floor_log2 (unsigned HOST_WIDE_INT x)
> ^
> ../../gcc-4.0.0/gcc/toplev.h:180:1: note: previous definition is here
> floor_log2 (unsigned HOST_WIDE_INT x)
> ^
> ../../gcc-4.0.0/gcc/toplev.c:582:1: error: redefinition of a 'extern inline'
>      function 'exact_log2' is not supported in C99 mode
> exact_log2 (unsigned HOST_WIDE_INT x)
> ^
> ../../gcc-4.0.0/gcc/toplev.h:186:1: note: previous definition is here
> exact_log2 (unsigned HOST_WIDE_INT x)
> ^
> ../../gcc-4.0.0/gcc/toplev.c:994:5: warning: implicit declaration of function
>      'ffi_init' is invalid in C99 [-Wimplicit-function-declaration]
>    ffi_init (asm_out_file, main_input_filename);
>    ^
> ../../gcc-4.0.0/gcc/toplev.c:1261:5: warning: implicit declaration of function
>      'print_ffi_version' is invalid in C99 [-Wimplicit-function-declaration]
>    print_ffi_version (file, indent);
>    ^
> ../../gcc-4.0.0/gcc/toplev.c:2007:5: warning: implicit declaration of function
>      'ffi_early_init' is invalid in C99 [-Wimplicit-function-declaration]
>    ffi_early_init ();
>    ^
> 4 warnings and 2 errors generated.
> make[1]: *** [toplev.o] Error 1
> make: *** [compile] Error 2
> 
> So now I’m stuck.  Suggestions on how to proceed, or even better, if someone who has a working ffigen could produce a CDB database for IOKit on Mavericks that would be much appreciated.
> 
> rg
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list