<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Jorn,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks for you email a few weeks back. That was very helpful in getting started.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Now that I've debugged my libffi build on AIX, I have been able to configure OpenJDK successfully with the options you mentioned in your previous email.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" itemscope="" itemtype="https://schemas.microsoft.com/QuotedText">
--enable-fallback-linker<br>
<div class="ContentPasted0">--with-libffi=libffi # a symbolicly linked dir containing lib and include<br>
</div>
<div class="ContentPasted0">--enable-libffi-bundling</div>
</blockquote>
<div class="ContentPasted0">I am now vexed by the following error which occurs during make images (for OpenJDK):<br>
</div>
<div class="ContentPasted0"><br>
</div>
<div class="ContentPasted0 ContentPasted1">gmake[3]: *** No rule to make target 'libffi/lib/libffi.so.8', needed by '/home/hotspot/openjdk/jdk-tyler/build/aix-ppc64-server-fastdebug/support/modules_libs/java.base/libffi.so.8'. Stop.<br>
</div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
I see java.base/Copy.gmk:238 ought to be bringing that file into the build. I can also see by the error message that it has found the location of the correct lib. Did you face any similar issue in getting your bundle to work?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
Thanks</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
Tyler<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Jorn Vernee <jorn.vernee@oracle.com><br>
<b>Sent:</b> June 9, 2023 16:27<br>
<b>To:</b> Tyler Steele <Tyler.Steele@ibm.com><br>
<b>Cc:</b> porters-dev@openjdk.org <porters-dev@openjdk.org><br>
<b>Subject:</b> [EXTERNAL] Re: Making the foreign liner a required API</font>
<div> </div>
</div>
<div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; height:0px; max-height:0px; opacity:0; overflow:hidden">
Hello Tyler, First of all, thanks for trying this out! To answer some of your questions: > Does this createLibffiBundle. sh get called programmatically during the build process (I can't seem to find where that would happen currently), or
</div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; height:0px; max-height:0px; opacity:0; overflow:hidden">
ZjQcmQRYFpfptBannerStart</div>
<div dir="ltr" lang="en" id="x_pfptBannernioxdoy" style="display:block!important; text-align:left!important; margin:16px 0px 16px 0px!important; padding:8px 16px 8px 16px!important; border-radius:4px!important; min-width:200px!important; background-color:#D0D8DC!important; background-color:#D0D8DC; border-top:4px solid #90a4ae!important; border-top:4px solid #90a4ae">
<div id="x_pfptBannernioxdoy" style="float:left!important; display:block!important; margin:0px 0px 1px 0px!important; max-width:600px!important">
<div id="x_pfptBannernioxdoy" style="display:block!important; visibility:visible!important; background-color:#D0D8DC!important; color:#000000!important; color:#000000; font-family:'Arial',sans-serif!important; font-family:'Arial',sans-serif; font-weight:bold!important; font-weight:bold; font-size:14px!important; line-height:18px!important; line-height:18px">
This Message Is From an External Sender </div>
<div id="x_pfptBannernioxdoy" style="display:block!important; visibility:visible!important; background-color:#D0D8DC!important; color:#000000!important; color:#000000; font-weight:normal; font-family:'Arial',sans-serif!important; font-family:'Arial',sans-serif; font-size:12px!important; line-height:18px!important; line-height:18px; margin-top:2px!important">
This message came from outside your organization. </div>
</div>
<div style="clear:both!important; display:block!important; visibility:hidden!important; line-height:0!important; font-size:0.01px!important; height:0px">
</div>
</div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; height:0px; max-height:0px; opacity:0; overflow:hidden">
ZjQcmQRYFpfptBannerEnd</div>
<style>
<!--
#x_pfptBannernioxdoy
{display:block!important;
visibility:visible!important;
opacity:1!important;
background-color:#D0D8DC!important;
max-width:none!important;
max-height:none!important}
-->
</style>
<p>Hello Tyler,</p>
<p><br>
</p>
<p>First of all, thanks for trying this out!</p>
<p><br>
</p>
<p>To answer some of your questions:<br>
</p>
<p><br>
> Does this createLibffiBundle.sh get called programmatically during the build process (I can't seem to find where that would happen currently), or does each platform check in a bundle with a compiled version of the library to source control (and the build
phase assumes it's present for those platforms that support it)? <br>
<br>
</p>
<p>I pointed to the createLibffiBundle.sh script as an example, so you could get a rough idea of the steps I took. The script takes a devkit as input, which is an artifact we use internally for our CI builds. These bundles (devkit and libffi) are not distributed.<br>
</p>
<p><br>
</p>
<p>The libffi library is either automatically detected by the build system if it is installed in a well-known system location, or it can be provided manually using the --with-libffi configure option (I've used the latter myself). I you'd like to know how the
build works, I suggest taking a look at the ./make/autoconf/lib-ffi.m4 file, which is responsible for pulling the contents of the --with-libffi option into the build system. It basically sets up several make variables with compiler and linker options. You
could grep through the rest of the ./make folder for some of the LIBFFI_* variables that are 'exported' at the end of the lib-ffi.m4 file using AC_SUBST. For the fallback linker you should find the relevant usages in the ./make/modules/java.base/lib.gmk file
(near the end).</p>
<p></p>
<p><br>
</p>
<p>To incorporate the library (.dll/.so/.dylib) into the JDK, it is essentially just copied into the right folder of the built JDK image. Automatic copying can be turned on using the --enable-libffi-bundling configuration flag. In practice, I'm using `--with-libffi=<path
to extracted bundle> --enable-libffi-bundling --enable-fallback-linker` to create a working JDK image.</p>
<p><br>
</p>
<p>> At present I'm getting an error at build time after enabling the fallback linker on aix.<br>
<br>
This is likely caused by an outdated version of libffi. The ffi_get_struct_offsets function was added in version 3.3, so that one or a later version should work. I've done all my testing with version 3.4.2, so I recommend going with that.</p>
<p><br>
</p>
<p>Also, note that we decided to postpone making the linker API required for now. Given the deprecation of the 32-bit Windows x86 port in JDK 21, making the linker API required after that port is removed would avoid the need of having to amend the public API
and implementation to allow selecting one of the 2 major ABIs on that platform (cdecl or stdcall).<br>
</p>
<p><br>
</p>
<p>HTH,<br>
Jorn<br>
</p>
<p><br>
</p>
<div class="x_moz-cite-prefix">On 09/06/2023 19:02, Tyler Steele wrote:<br>
</div>
<blockquote type="cite"><style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello Jorn and fellow porters,</div>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am following up with this message from Jorn from a few months ago [1]. I am generally supportive of their proposal, but I am not certain how to implement it. I have successfully built and bundled libffi on AIX, but I didn't use the createLibffiBundle.sh script
provided by the PR.</div>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
What I'm feeling confused about is how libffi will be incorporated into the jvm. Does this createLibffiBundle.sh get called programmatically during the build process (I can't seem to find where that would happen currently), or does each platform check in a
bundle with a compiled version of the library to source control (and the build phase assumes it's present for those platforms that support it)? At present I'm getting an error at build time after enabling the fallback linker on aix.</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1 x_ContentPasted2" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
src/java.base/share/native/libfallbackLinker/fallbackLinker.c:66:10: warning: implicit declaration of function 'ffi_get_struct_offsets' is invalid in C99 [-Wimplicit-function-declaration]
<div class="x_ContentPasted2"> return ffi_get_struct_offsets((ffi_abi) abi, jlong_to_ptr(type), jlong_to_ptr(offsets));</div>
<div class="x_ContentPasted2"> ^</div>
</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1 x_ContentPasted2" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Which is not totally surprising given that I haven't figured out how to link it yet.</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1 x_ContentPasted2" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1 x_ContentPasted2" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks in advance,</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1 x_ContentPasted2" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Tyler</div>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof x_ContentPasted0" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
[1] <a class="x_moz-txt-link-freetext" href="https://mail.openjdk.org/pipermail/porters-dev/2023-March/000753.html">https://mail.openjdk.org/pipermail/porters-dev/2023-March/000753.html</a><br>
</div>
</blockquote>
</div>
</body>
</html>