RFR: Add support for AIX in build process [v5]
Jorn Vernee
jvernee at openjdk.org
Mon Dec 8 12:03:39 UTC 2025
On Mon, 8 Dec 2025 08:42:59 GMT, Suchismith Roy <sroy at openjdk.org> wrote:
>> Summary of the issues:
>>
>> 1. There is no support for compiling AIX dynamic .a library and the tool was compiling .so files instead.
>> 2. There is no logic to support libclang.a.
>> 3. There is no support to load shared member of .a dynamic libraries of AIX.
>>
>> JBS Issue: [CODETOOLS-7904116](https://bugs.openjdk.org/browse/CODETOOLS-7904116)
>
> Suchismith Roy has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains three new commits since the last revision:
>
> - change library lookup path:
> - Indendtation
> - Restore changes in Build files
The current approach looks good to me now, thanks. Let's clean up the patch a bit more before integrating. I've left some comment inline.
build.gradle line 210:
> 208: }
> 209:
> 210:
Please clean up the spurious white space changes in this file.
src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java line 39:
> 37: import java.util.StringTokenizer;
> 38: import static java.lang.foreign.MemoryLayout.PathElement.*;
> 39: import java.io.File;
These import changes don't look like they're needed (with dropped the dependency on `File` in the other suggestion I made).
src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java line 84:
> 82: }
> 83:
> 84: static SymbolLookup SYMBOL_LOOKUP;
This should still be `static final`
Suggestion:
static final SymbolLookup SYMBOL_LOOKUP;
src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java line 95:
> 93: libName = f.getAbsolutePath();
> 94: }
> 95: SYMBOL_LOOKUP = SymbolLookup.libraryLookup(libName + "(libclang.so.14)", Arena.global());
If we don't enter the `if` statement, the library name will end up as `null(libclang.so.14)`. `libraryLookup` throws an IAE when the library can not be loaded, so I think we can just construct the name and try to load the library.
Suggestion:
String javaHome = System.getProperty("java.home");
String libName = javaHome + "/lib/libclang.a(libclang.so.14)";
SYMBOL_LOOKUP = SymbolLookup.libraryLookup(libName, LIBRARY_ARENA);
test/test-support/CMakeLists.txt line 24:
> 22: else()
> 23: add_library(${LIB_NAME} SHARED ${TEST_LIB})
> 24: endif()
`add_library(${LIB_NAME} SHARED ${TEST_LIB})` is common here, so I think this can be:
Suggestion:
add_library(${LIB_NAME} SHARED ${TEST_LIB})
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set_target_properties(${LIB_NAME} PROPERTIES
PREFIX "lib"
SUFFIX ".a"
COMPILE_FLAGS "-q64 -qhalt=e -qcpluscmt"
LINK_FLAGS "-q64 -G -Wl,-bnoentry,-bexpall"
)
endif()
-------------
PR Review: https://git.openjdk.org/jextract/pull/297#pullrequestreview-3551615966
PR Review Comment: https://git.openjdk.org/jextract/pull/297#discussion_r2598318118
PR Review Comment: https://git.openjdk.org/jextract/pull/297#discussion_r2598316520
PR Review Comment: https://git.openjdk.org/jextract/pull/297#discussion_r2598303886
PR Review Comment: https://git.openjdk.org/jextract/pull/297#discussion_r2598299276
PR Review Comment: https://git.openjdk.org/jextract/pull/297#discussion_r2598326409
More information about the jextract-dev
mailing list