RFR: 7903284: jextract should infer platform specific include path for Mac OS

Manuel Bleichenbacher manuel.bleichenbacher at gmail.com
Tue Sep 6 05:36:20 UTC 2022


To work with system frameworks, two parts are needed:


   - The -F option (with the system framework path) must be specified for
   clang to find the framework header files.
   - The generated code should load the library with
   SymbolLookup.loaderLookup("CoreFoundation.framework/CoreFoundation") instead
   of System.loadLibrary("xxx"); SymbolLookup loaderLookup =
   SymbolLookup.loaderLookup();

The -F option already gets us very far. Only a minor change in the
generated files is needed. So I think this is valuable addition on its own.

Loading libraries with SymbolLookup.loaderLookup() would also benefit Linux
and possibly Windows. I guess the best approach would be to add an
alternative to the -l option of jextract.

And yes, I'm aware of the compile_flags.txt options. I luckily found the
example as the description was quite misleading. It pointed at clang
documentation showing a JSON file.

Revisiting your pull request, I just note that the path added with -I might
not be as useful. It won't help with includes like "time.h" or
"sys/ioctl.h". Instead of:

-I{platformPath}

shouldn't it rather be:

-I{platformPath}/usr/include

That's where all the non-framework header files reside on macOS.

On Tue, Sep 6, 2022 at 5:43 AM Sundararajan Athijegannathan <
sundararajan.athijegannathan at oracle.com> wrote:

> With -F, we still need to specify framework to be used by another option,
> right? Do you have a simple command line example usage of frameworks?
>
> PS. jextract does support compiler_options.txt file (in the current dir)
> to pass compiler specific options not supported by jextract.
>
> Thanks,
> -Sundar
> ------------------------------
> *From:* Manuel Bleichenbacher <manuel.bleichenbacher at gmail.com>
> *Sent:* 06 September 2022 03:04
> *To:* Athijegannathan Sundararajan <sundar at openjdk.org>
> *Cc:* jextract-dev at openjdk.org <jextract-dev at openjdk.org>
> *Subject:* Re: RFR: 7903284: jextract should infer platform specific
> include path for Mac OS
>
> That's a good addition. But it just stops short of a great addition.
>
> Instead of just adding "-I/Applications/Xcode.app/..../MacOSX.sdk" to the
> clang command line, it would be much better to also add
>  "-F/Applications/Xcode.app/..../MacOSX.sdk/System/Library/Frameworks".
> That way, jextract would gain the ability to find header files of
> frameworks, a core feature of macOS development.
>
>
> On Mon, Sep 5, 2022 at 6:45 PM Athijegannathan Sundararajan <
> sundar at openjdk.org> wrote:
>
> Using xcrun --show-sdk-path to find the SDK installation path
>
> -------------
>
> Commit messages:
>  - 7903284: jextract should infer platform specific include path for Mac OS
>
> Changes: https://git.openjdk.org/jextract/pull/69/files
>  Webrev: https://webrevs.openjdk.org/?repo=jextract&pr=69&range=00
>   Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903284
>   Stats: 29 lines in 1 file changed: 29 ins; 0 del; 0 mod
>   Patch: https://git.openjdk.org/jextract/pull/69.diff
>   Fetch: git fetch https://git.openjdk.org/jextract pull/69/head:pull/69
>
> PR: https://git.openjdk.org/jextract/pull/69
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20220906/c0242b64/attachment.htm>


More information about the jextract-dev mailing list