<div dir="ltr">To work with system frameworks, two parts are needed:<div><br></div><div><ul><li>The -F option (with the system framework path) must be specified for clang to find the framework header files.</li><li>The generated code should load the library with <span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;color:rgb(36,41,47)">SymbolLookup.loaderLookup("CoreFoundation.framework/CoreFoundation") </span>instead of <span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;color:rgb(36,41,47)">System.loadLibrary("xxx"); </span><span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;color:rgb(36,41,47)">SymbolLookup loaderLookup = SymbolLookup.loaderLookup();</span></li></ul><div style="orphans: 2; widows: 2;">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.<br></div></div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">Loading libraries with <span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.600000381469727px">SymbolLookup.loaderLookup()</span> would also benefit Linux and possibly Windows. I guess the best approach would be to add an alternative to the -l option of jextract.</div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">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. </div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">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:</div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">-I{platformPath}</div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">shouldn't it rather be:</div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">-I{platformPath}/usr/include<br></div><div style="orphans: 2; widows: 2;"><br></div><div style="orphans: 2; widows: 2;">That's where all the non-framework header files reside on macOS.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 6, 2022 at 5:43 AM Sundararajan Athijegannathan <<a href="mailto:sundararajan.athijegannathan@oracle.com">sundararajan.athijegannathan@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg8957686196071455813">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
PS. jextract does support compiler_options.txt file (in the current dir) to pass compiler specific options not supported by jextract. </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
-Sundar</div>
<div id="gmail-m_8957686196071455813appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_8957686196071455813divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Manuel Bleichenbacher <<a href="mailto:manuel.bleichenbacher@gmail.com" target="_blank">manuel.bleichenbacher@gmail.com</a>><br>
<b>Sent:</b> 06 September 2022 03:04<br>
<b>To:</b> Athijegannathan Sundararajan <<a href="mailto:sundar@openjdk.org" target="_blank">sundar@openjdk.org</a>><br>
<b>Cc:</b> <a href="mailto:jextract-dev@openjdk.org" target="_blank">jextract-dev@openjdk.org</a> <<a href="mailto:jextract-dev@openjdk.org" target="_blank">jextract-dev@openjdk.org</a>><br>
<b>Subject:</b> Re: RFR: 7903284: jextract should infer platform specific include path for Mac OS</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">That's a good addition. But it just stops short of a great addition.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">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.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><br>
</div>
<div>
<div dir="ltr">On Mon, Sep 5, 2022 at 6:45 PM Athijegannathan Sundararajan <<a href="mailto:sundar@openjdk.org" target="_blank">sundar@openjdk.org</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Using xcrun --show-sdk-path to find the SDK installation path<br>
<br>
-------------<br>
<br>
Commit messages:<br>
- 7903284: jextract should infer platform specific include path for Mac OS<br>
<br>
Changes: <a href="https://git.openjdk.org/jextract/pull/69/files" rel="noreferrer" target="_blank">
https://git.openjdk.org/jextract/pull/69/files</a><br>
Webrev: <a href="https://webrevs.openjdk.org/?repo=jextract&pr=69&range=00" rel="noreferrer" target="_blank">
https://webrevs.openjdk.org/?repo=jextract&pr=69&range=00</a><br>
Issue: <a href="https://bugs.openjdk.org/browse/CODETOOLS-7903284" rel="noreferrer" target="_blank">
https://bugs.openjdk.org/browse/CODETOOLS-7903284</a><br>
Stats: 29 lines in 1 file changed: 29 ins; 0 del; 0 mod<br>
Patch: <a href="https://git.openjdk.org/jextract/pull/69.diff" rel="noreferrer" target="_blank">
https://git.openjdk.org/jextract/pull/69.diff</a><br>
Fetch: git fetch <a href="https://git.openjdk.org/jextract" rel="noreferrer" target="_blank">
https://git.openjdk.org/jextract</a> pull/69/head:pull/69<br>
<br>
PR: <a href="https://git.openjdk.org/jextract/pull/69" rel="noreferrer" target="_blank">
https://git.openjdk.org/jextract/pull/69</a><br>
</blockquote>
</div>
</div>
</div>
</div>
</div></blockquote></div>