From be134becdef50ae1828f06d67701ec0ca5a9fc2f Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Mon, 17 Nov 2025 10:22:26 -0500 Subject: [PATCH 01/10] jextract: Enable loading of dynamic archives for AIX --- build.gradle | 85 ++++++++++++++----- gradlew | 2 +- make/Build.gmk | 12 ++- make/Common.gmk | 60 ++++++++----- make/NativeCompilation.gmk | 13 +++ .../jextract/clang/libclang/Index_h.java | 68 +++++++++++++-- 6 files changed, 188 insertions(+), 52 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index 9ce544a2..4e4473ac 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ if (clang_versions.length == 0) { " Make sure a ${llvm_home}/lib/clang/ directory exists") } def clang_version = clang_versions[0] - +println ">> clang_version = $clang_version" def buildDir = layout.buildDirectory.get() def jextract_version = "23" def jmods_dir = "$buildDir/jmods" @@ -52,7 +52,7 @@ checkPath(clang_include_dir) def os_lib_dir = Os.isFamily(Os.FAMILY_WINDOWS)? "bin" : "lib" def os_script_extension = Os.isFamily(Os.FAMILY_WINDOWS)? ".bat" : "" def os_exe_suffix = Os.isFamily(Os.FAMILY_WINDOWS)? ".exe" : "" // needed for some, but not all shells -def libclang_dir = "${llvm_home}/${os_lib_dir}" +def libclang_dir = "${llvm_home}/lib" checkPath(libclang_dir) repositories { @@ -73,24 +73,35 @@ jar { task copyLibClang(type: Sync) { into("$buildDir/jmod_inputs") - // make sure we only pick up the "real" shared library file from LLVM installation - // (e.g. exclude symlinks on Linux) - def clang_path_include = (Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC)) ? - "libclang.so.${clang_version}" : "*clang*" - - from("${libclang_dir}") { - include(clang_path_include) - include("libLLVM.*") - exclude("clang.exe") - into("libs") - // make sure we drop shared library version name (Linux only) - rename("libclang.so.${clang_version}", "libclang.so") + // make sure we only pick up the "real" shared library file from LLVM installation + // (e.g. exclude symlinks on Linux) + def clang_path_include = (Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC)) ? + "libclang.a" : "*clang*" + + println ">> clang_path_include = $clang_path_include" + println ">> libclang_dir = $libclang_dir" + from("${libclang_dir}") { + include(clang_path_include) + include("libLLVM.*") + exclude("clang.exe") + into("libs") + + // make sure we drop shared library version name (Linux only) + //rename("libclang.so.*", "libclang.so") + + eachFile { + println ">> Copying ${it.name} from ${it.file}" + } + } + from("${libclang_dir}") { + include("libclang.a") + into("$buildDir/test-libs") } - - from("$clang_include_dir") { + from("$clang_include_dir") { include("*.h") into("conf/jextract") - } + } + } task createJextractJmod(type: Exec) { @@ -190,19 +201,30 @@ task createRuntimeImageForTest(type: Exec) { "--add-modules=ALL-MODULE-PATH", "--output=$out_dir", ] + doLast { + println "=== [DEBUG] After creating runtime image ===" + def libDir = file("$out_dir/lib") + println "Contents of $libDir:" + libDir.listFiles()?.each { println it.name } + println "Contents of $out_dir:" + file(out_dir).listFiles()?.each { println it.name } + } } task cmakeConfigure(type: Exec) { executable = "cmake" + environment "CC", "/opt/IBM/xlC/13.1.3/bin/xlc" + environment "CXX", "/opt/IBM/xlC/13.1.3/bin/xlC" args = [ "-B", "$buildDir/testlib-build", "-S", "$projectDir/test/test-support", "-DTEST_SOURCE_ROOT:FILEPATH=$projectDir/test", "-DCMAKE_BUILD_TYPE:STRING=Release", - "-DCMAKE_INSTALL_PREFIX:FILEPATH=$buildDir/testlib-install" + "-DCMAKE_INSTALL_PREFIX:FILEPATH=$buildDir/testlib-install", ] } + task cmakeBuild(type: Exec) { dependsOn cmakeConfigure @@ -238,7 +260,7 @@ void createJtregTask(String name, String jacocoAgent, String os_lib_dir) { "-javacoption:--add-exports=org.openjdk.jextract/org.openjdk.jextract.json.parser=ALL-UNNAMED", "-javaoption:--add-exports=org.openjdk.jextract/org.openjdk.jextract.json.parser=ALL-UNNAMED", "-avm", "-conc:auto", "-verbose:summary,fail,error", - "-retain:fail,error", + "-retain:fail,error" ] if (jacocoAgent != null) { @@ -258,6 +280,31 @@ if (jacocoAgent != null) { createJtregTask("jtregWithCoverage", jacocoAgent, os_lib_dir) } + +tasks.register("copyLibClangToTestLib", Copy) { + def srcFile = file("${project.buildDir}/jmod_inputs/libs/libclang.a") + def destDir = file("${project.buildDir}/test-lib/libs") + dependsOn(copyLibClang) + from(srcFile) + into(destDir) + + doFirst { + println "[DEBUG] Copying libclang.a from: ${srcFile}" + println "[DEBUG] Destination directory: ${destDir}" + } + + doLast { + println "[DEBUG] Successfully copied libclang.a to test-lib/libs" + } +} + +// Make jtreg depend on it +tasks.named("jtreg") { + dependsOn("copyLibClangToTestLib") +} + + + tasks.register("coverage", JavaExec) { dependsOn jtregWithCoverage diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index f5feea6d..54e65396 --- a/gradlew +++ b/gradlew @@ -203,7 +203,7 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='"-Xmx1024m" "-Xms512m" "-Xss8m"' # Collect all arguments for the java command: # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, diff --git a/make/Build.gmk b/make/Build.gmk index 1dafbec9..a8e1bab7 100644 --- a/make/Build.gmk +++ b/make/Build.gmk @@ -12,12 +12,16 @@ else JPACKAGE_ARGS := endif + ifeq ($(PLATFORM_OS), macosx) TAR_SUPPORTS_TRANSFORM := false +else ifeq ($(PLATFORM_OS), aix) + TAR_SUPPORTS_TRANSFORM := false else TAR_SUPPORTS_TRANSFORM := true endif + LIBCLANG_LIB_DIR := $(LIBCLANG_HOME)/$(OS_LIB_DIR) LIBCLANG_INCLUDE_DIR := $(LIBCLANG_HOME)/lib/clang/$(LIBCLANG_VERSION)/include @@ -29,6 +33,8 @@ JEXTRACT_JMOD_CONF_DIR := $(BUILD_DIR)/jextract_jmod_conf ifeq ($(PLATFORM_OS), macosx) BUNDLE_PLATFORM := macos-$(PLATFORM_CPU) +else ifeq ($(PLATFORM_OS), aix) + BUNDLE_PLATFORM := aix-$(PLATFORM_CPU) else BUNDLE_PLATFORM := $(PLATFORM) endif @@ -55,6 +61,8 @@ $(BUILD_CLASSES_DIR): ifeq ($(PLATFORM_OS), linux) LIBCLANG_COPY_PATH := "libclang.so.$(LIBCLANG_VERSION)" +else ifeq ($(PLATFORM_OS), aix) + LIBCLANG_COPY_PATH := "libclang.a" else LIBCLANG_COPY_PATH := "*clang.*" endif @@ -68,8 +76,8 @@ $(BUILD_MODULES_DIR): $(BUILD_CLASSES_DIR) $(CP) "$(LIBCLANG_LIB_DIR)/$(LIBCLANG_COPY_PATH)" "$(JEXTRACT_JMOD_LIBS_DIR)" $(MKDIR) -p "$(JEXTRACT_JMOD_CONF_DIR)/jextract" $(CP) "$(LIBCLANG_INCLUDE_DIR)/"*.h "$(JEXTRACT_JMOD_CONF_DIR)/jextract/" - [ ! -f $(JEXTRACT_JMOD_LIBS_DIR)/libclang.so.$(LIBCLANG_VERSION) ] || \ - $(MV) "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.so.$(LIBCLANG_VERSION)" "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.so" + [ ! -f $(JEXTRACT_JMOD_LIBS_DIR)/libclang.a ] || \ + $(MV) "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.a)" "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.a" # create jextract jmod file $(FIXPATH) $(PANAMA_JAVA_HOME)/bin/jmod \ diff --git a/make/Common.gmk b/make/Common.gmk index a87c9feb..08a8fae2 100644 --- a/make/Common.gmk +++ b/make/Common.gmk @@ -68,39 +68,53 @@ endef X := SPACE:=$(X) $(X) - +UNAME_P := $(shell uname -p) UNAME_M := $(shell uname -m) + +# CPU detection ifeq ($(UNAME_M),x86_64) - DEVKIT_VS_CPU_VAR_NAME := x86_64 - PLATFORM_CPU := x64 -else ifeq ($(UNAME_M),arm64) - DEVKIT_VS_CPU_VAR_NAME := aarch64 - PLATFORM_CPU := aarch64 -else ifeq ($(UNAME_M),aarch64) - DEVKIT_VS_CPU_VAR_NAME := aarch64 - PLATFORM_CPU := aarch64 + DEVKIT_VS_CPU_VAR_NAME := x86_64 + PLATFORM_CPU := x64 else - $(error "Unknown CPU: $(UNAME_M)") + ifeq ($(UNAME_M),arm64) + DEVKIT_VS_CPU_VAR_NAME := aarch64 + PLATFORM_CPU := aarch64 + else + ifeq ($(UNAME_M),aarch64) + DEVKIT_VS_CPU_VAR_NAME := aarch64 + PLATFORM_CPU := aarch64 + else + ifeq ($(UNAME_P),powerpc) + DEVKIT_VS_CPU_VAR_NAME := ppc64 + PLATFORM_CPU := ppc64 + else + $(error "Unknown CPU: $(UNAME_M)") + endif + endif + endif endif +# OS detection ifeq ($(OS),Windows_NT) - PLATFORM_OS := windows - FIXPATH := bash $(TOPDIR)/make/scripts/fixpath.sh exec + PLATFORM_OS := windows + FIXPATH := bash $(TOPDIR)/make/scripts/fixpath.sh exec else - FIXPATH := - - UNAME_S := $(shell uname -s) - ifeq ($(UNAME_S), Darwin) - PLATFORM_OS := macosx - else - ifeq ($(UNAME_S), Linux) - PLATFORM_OS := linux + FIXPATH := + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + PLATFORM_OS := macosx else - $(error "Unknown OS: $(UNAME_S)") + ifeq ($(UNAME_S),Linux) + PLATFORM_OS := linux + else + ifeq ($(UNAME_S),AIX) + PLATFORM_OS := aix + else + $(error "Unknown OS: $(UNAME_S)") + endif + endif endif - endif endif - PLATFORM := $(PLATFORM_OS)-$(PLATFORM_CPU) ECHO := echo diff --git a/make/NativeCompilation.gmk b/make/NativeCompilation.gmk index daf9e9a5..38da31cc 100644 --- a/make/NativeCompilation.gmk +++ b/make/NativeCompilation.gmk @@ -86,6 +86,19 @@ else CFLAGS += --sysroot=$(SYSROOT) endif endif + ifeq ($(PLATFORM_OS), aix) + SHARED_LIB_SUFFIX := .a + CC_NAME := xlc + LINK_NAME := xlc + + # xlc typically requires -q64 for 64-bit builds + CFLAGS += -q64 -bexpall -qhalt=e -qalign=power -sysroot=$(SYSROOT) -m64 + LDFLAGS += -q64 -G -Wl,-bnoentry -Wl,-bexpall, -malign-power -m64 + CPPFLAGS += -D_AIX + + # AIX-specific export file handling can be added here if needed + endif + endif CC := $(call FindTool,$(CC_NAME),$(TOOL_SEARCH_PATH)) diff --git a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java index 531b1b06..38347c3f 100644 --- a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java +++ b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java @@ -33,9 +33,11 @@ import java.util.*; import java.util.function.*; import java.util.stream.*; - +import java.io.File; import static java.lang.foreign.ValueLayout.*; +import java.util.StringTokenizer; import static java.lang.foreign.MemoryLayout.PathElement.*; +import static java.lang.foreign.ValueLayout.ADDRESS; public class Index_h { @@ -81,14 +83,66 @@ static MemoryLayout align(MemoryLayout layout, long align) { } - static { - String libName = System.getProperty("os.name").startsWith("Windows") ? "libclang" : "clang"; - System.loadLibrary(libName); - } + + static SymbolLookup SYMBOL_LOOKUP; + + static { + String osName = System.getProperty("os.name"); + String libName = ""; + if (osName.startsWith("AIX")) { + + + + + List pathsToCheck = new ArrayList<>(Arrays.asList( + System.getProperty("java.library.path").split(File.pathSeparator) + )); +System.out.println(pathsToCheck); + // 2. Add alternate calculated paths + String currentDir = System.getProperty("user.dir"); // wherever JVM was launched + pathsToCheck.add(currentDir + "/build/jextract-jdk-test-image/lib"); + pathsToCheck.add(currentDir + "/../../../jextract-jdk-test-image/lib"); // in case running from subdir + pathsToCheck.add(currentDir + "..//../.."); // optional fallback + + // 3. Try to find the library + for (String path : pathsToCheck) { + File f = new File(path, "libclang.a"); // AIX uses .a, Linux .so + System.out.println("[DEBUG] Checking path: " + f.getAbsolutePath()); + if (f.exists() && !f.isDirectory()) { + libName = f.getAbsolutePath(); + System.out.println("found"+libName); + break; + } + } + + + + + - static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() - .or(Linker.nativeLinker().defaultLookup()); + + + + + + + + + + + + + + + SYMBOL_LOOKUP = SymbolLookup.libraryLookup(libName + "(libclang.so.14)", Arena.global()); + } else { + libName = osName.startsWith("Windows") ? "libclang" : "clang"; + System.loadLibrary(libName); + SYMBOL_LOOKUP = SymbolLookup.loaderLookup().or(Linker.nativeLinker().defaultLookup()); + } + } + public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; From 34d19fb5f6fa099498eff3c9282e8261f6c991f7 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Mon, 17 Nov 2025 10:22:32 -0500 Subject: [PATCH 02/10] cmake support --- build.gradle | 3 +-- test/test-support/CMakeLists.txt | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 4e4473ac..f266c18e 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,6 @@ if (clang_versions.length == 0) { " Make sure a ${llvm_home}/lib/clang/ directory exists") } def clang_version = clang_versions[0] -println ">> clang_version = $clang_version" def buildDir = layout.buildDirectory.get() def jextract_version = "23" def jmods_dir = "$buildDir/jmods" @@ -52,7 +51,7 @@ checkPath(clang_include_dir) def os_lib_dir = Os.isFamily(Os.FAMILY_WINDOWS)? "bin" : "lib" def os_script_extension = Os.isFamily(Os.FAMILY_WINDOWS)? ".bat" : "" def os_exe_suffix = Os.isFamily(Os.FAMILY_WINDOWS)? ".exe" : "" // needed for some, but not all shells -def libclang_dir = "${llvm_home}/lib" +def libclang_dir = "${llvm_home}/${os_lib_dir}"" checkPath(libclang_dir) repositories { diff --git a/test/test-support/CMakeLists.txt b/test/test-support/CMakeLists.txt index e823d6d6..389d6695 100644 --- a/test/test-support/CMakeLists.txt +++ b/test/test-support/CMakeLists.txt @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.14) project(TestSupportLibs) option(TEST_SOURCE_ROOT "src directory with test files") - +# Force XL C on AIX +if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") + set(CMAKE_C_COMPILER /opt/IBM/xlC/13.1.3/bin/xlc) + set(CMAKE_CXX_COMPILER /opt/IBM/xlC/13.1.3/bin/xlC) +endif() file(GLOB_RECURSE TEST_LIBS ${TEST_SOURCE_ROOT}/*lib*.c) foreach(TEST_LIB ${TEST_LIBS}) @@ -11,13 +15,27 @@ foreach(TEST_LIB ${TEST_LIBS}) string(REGEX REPLACE ".*lib([A-Za-z0-9_]+)\.c(pp)?" "\\1" LIB_NAME ${TEST_LIB}) string(REGEX REPLACE "(.*)/lib[A-Za-z0-9_]+\.c(pp)?" "\\1" PARENT_DIR ${TEST_LIB}) message(STATUS "Lib name: ${LIB_NAME}") + if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") + add_library(${LIB_NAME} SHARED ${TEST_LIB}) + set_target_properties(${LIB_NAME} PROPERTIES + PREFIX "lib" + SUFFIX ".a" + COMPILE_FLAGS "-q64 -qhalt=e" + LINK_FLAGS "-q64 -G -Wl,-bnoentry,-bexpall" + ) + else() + add_library(${LIB_NAME} SHARED ${TEST_LIB}) + endif() + - add_library(${LIB_NAME} SHARED ${TEST_LIB}) target_include_directories(${LIB_NAME} PRIVATE ${PARENT_DIR} ) + # Link against libm to resolve sqrt() and other math symbols + target_link_libraries(${LIB_NAME} m) + install( TARGETS ${LIB_NAME} From 75d1168cdd18a8d5113e5a53d78d7820682e6bfb Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Mon, 17 Nov 2025 10:18:31 -0500 Subject: [PATCH 03/10] jextract: Cleanup of Index_h --- build.gradle | 5 --- .../jextract/clang/libclang/Index_h.java | 42 ++----------------- test/test-support/CMakeLists.txt | 15 ++++--- 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/build.gradle b/build.gradle index f266c18e..fa48a00c 100644 --- a/build.gradle +++ b/build.gradle @@ -287,11 +287,6 @@ tasks.register("copyLibClangToTestLib", Copy) { from(srcFile) into(destDir) - doFirst { - println "[DEBUG] Copying libclang.a from: ${srcFile}" - println "[DEBUG] Destination directory: ${destDir}" - } - doLast { println "[DEBUG] Successfully copied libclang.a to test-lib/libs" } diff --git a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java index 38347c3f..825867cf 100644 --- a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java +++ b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java @@ -33,11 +33,9 @@ import java.util.*; import java.util.function.*; import java.util.stream.*; -import java.io.File; import static java.lang.foreign.ValueLayout.*; import java.util.StringTokenizer; import static java.lang.foreign.MemoryLayout.PathElement.*; -import static java.lang.foreign.ValueLayout.ADDRESS; public class Index_h { @@ -82,66 +80,34 @@ static MemoryLayout align(MemoryLayout layout, long align) { }; } - - static SymbolLookup SYMBOL_LOOKUP; - static { + static { String osName = System.getProperty("os.name"); String libName = ""; if (osName.startsWith("AIX")) { - - - - - List pathsToCheck = new ArrayList<>(Arrays.asList( + List pathsToCheck = new ArrayList<>(Arrays.asList( System.getProperty("java.library.path").split(File.pathSeparator) )); -System.out.println(pathsToCheck); // 2. Add alternate calculated paths String currentDir = System.getProperty("user.dir"); // wherever JVM was launched pathsToCheck.add(currentDir + "/build/jextract-jdk-test-image/lib"); pathsToCheck.add(currentDir + "/../../../jextract-jdk-test-image/lib"); // in case running from subdir - pathsToCheck.add(currentDir + "..//../.."); // optional fallback - // 3. Try to find the library for (String path : pathsToCheck) { File f = new File(path, "libclang.a"); // AIX uses .a, Linux .so - System.out.println("[DEBUG] Checking path: " + f.getAbsolutePath()); if (f.exists() && !f.isDirectory()) { libName = f.getAbsolutePath(); - System.out.println("found"+libName); break; } } - - - - - - - - - - - - - - - - - - - - - - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(libName + "(libclang.so.14)", Arena.global()); + SYMBOL_LOOKUP = SymbolLookup.libraryLookup(libName + "(libclang.so.14)", Arena.global()); } else { libName = osName.startsWith("Windows") ? "libclang" : "clang"; System.loadLibrary(libName); SYMBOL_LOOKUP = SymbolLookup.loaderLookup().or(Linker.nativeLinker().defaultLookup()); } - } + } public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; diff --git a/test/test-support/CMakeLists.txt b/test/test-support/CMakeLists.txt index 389d6695..4f09f324 100644 --- a/test/test-support/CMakeLists.txt +++ b/test/test-support/CMakeLists.txt @@ -16,17 +16,16 @@ foreach(TEST_LIB ${TEST_LIBS}) string(REGEX REPLACE "(.*)/lib[A-Za-z0-9_]+\.c(pp)?" "\\1" PARENT_DIR ${TEST_LIB}) message(STATUS "Lib name: ${LIB_NAME}") if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - add_library(${LIB_NAME} SHARED ${TEST_LIB}) - set_target_properties(${LIB_NAME} PROPERTIES - PREFIX "lib" - SUFFIX ".a" - COMPILE_FLAGS "-q64 -qhalt=e" - LINK_FLAGS "-q64 -G -Wl,-bnoentry,-bexpall" + add_library(${LIB_NAME} SHARED ${TEST_LIB}) + set_target_properties(${LIB_NAME} PROPERTIES + PREFIX "lib" + SUFFIX ".a" + COMPILE_FLAGS "-q64 -qhalt=e" + LINK_FLAGS "-q64 -G -Wl,-bnoentry,-bexpall" ) else() - add_library(${LIB_NAME} SHARED ${TEST_LIB}) + add_library(${LIB_NAME} SHARED ${TEST_LIB}) endif() - target_include_directories(${LIB_NAME} PRIVATE From dbd4f3486170e997f3ec20f8f15dea86288338f4 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Mon, 17 Nov 2025 10:26:35 -0500 Subject: [PATCH 04/10] gradle fixes --- build.gradle | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index fa48a00c..e2b9241b 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ checkPath(clang_include_dir) def os_lib_dir = Os.isFamily(Os.FAMILY_WINDOWS)? "bin" : "lib" def os_script_extension = Os.isFamily(Os.FAMILY_WINDOWS)? ".bat" : "" def os_exe_suffix = Os.isFamily(Os.FAMILY_WINDOWS)? ".exe" : "" // needed for some, but not all shells -def libclang_dir = "${llvm_home}/${os_lib_dir}"" +def libclang_dir = "${llvm_home}/${os_lib_dir}" checkPath(libclang_dir) repositories { @@ -200,14 +200,6 @@ task createRuntimeImageForTest(type: Exec) { "--add-modules=ALL-MODULE-PATH", "--output=$out_dir", ] - doLast { - println "=== [DEBUG] After creating runtime image ===" - def libDir = file("$out_dir/lib") - println "Contents of $libDir:" - libDir.listFiles()?.each { println it.name } - println "Contents of $out_dir:" - file(out_dir).listFiles()?.each { println it.name } - } } task cmakeConfigure(type: Exec) { @@ -219,7 +211,7 @@ task cmakeConfigure(type: Exec) { "-S", "$projectDir/test/test-support", "-DTEST_SOURCE_ROOT:FILEPATH=$projectDir/test", "-DCMAKE_BUILD_TYPE:STRING=Release", - "-DCMAKE_INSTALL_PREFIX:FILEPATH=$buildDir/testlib-install", + "-DCMAKE_INSTALL_PREFIX:FILEPATH=$buildDir/testlib-install" ] } From 6a3c0c842d19a56ce9e41dc607699d0b170b260e Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Tue, 18 Nov 2025 09:50:25 -0500 Subject: [PATCH 05/10] build file changes --- make/Build.gmk | 5 ++--- .../java/org/openjdk/jextract/clang/libclang/Index_h.java | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/make/Build.gmk b/make/Build.gmk index a8e1bab7..0222d89a 100644 --- a/make/Build.gmk +++ b/make/Build.gmk @@ -76,9 +76,8 @@ $(BUILD_MODULES_DIR): $(BUILD_CLASSES_DIR) $(CP) "$(LIBCLANG_LIB_DIR)/$(LIBCLANG_COPY_PATH)" "$(JEXTRACT_JMOD_LIBS_DIR)" $(MKDIR) -p "$(JEXTRACT_JMOD_CONF_DIR)/jextract" $(CP) "$(LIBCLANG_INCLUDE_DIR)/"*.h "$(JEXTRACT_JMOD_CONF_DIR)/jextract/" - [ ! -f $(JEXTRACT_JMOD_LIBS_DIR)/libclang.a ] || \ - $(MV) "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.a)" "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.a" - + [ ! -f $(JEXTRACT_JMOD_LIBS_DIR)/libclang.so.$(LIBCLANG_VERSION) ] || \ + $(MV) "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.so.$(LIBCLANG_VERSION)" "$(JEXTRACT_JMOD_LIBS_DIR)/libclang.so" # create jextract jmod file $(FIXPATH) $(PANAMA_JAVA_HOME)/bin/jmod \ create \ diff --git a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java index 825867cf..399ed342 100644 --- a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java +++ b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java @@ -36,6 +36,7 @@ import static java.lang.foreign.ValueLayout.*; import java.util.StringTokenizer; import static java.lang.foreign.MemoryLayout.PathElement.*; +import java.io.File; public class Index_h { From d54c2693cad7720f2098c8fc006bcf8ffb1058e2 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Thu, 20 Nov 2025 08:33:26 -0500 Subject: [PATCH 06/10] library loading logic --- build.gradle | 23 ++++++++++------------- make/Build.gmk | 2 -- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index e2b9241b..33db45e7 100644 --- a/build.gradle +++ b/build.gradle @@ -74,28 +74,25 @@ task copyLibClang(type: Sync) { // make sure we only pick up the "real" shared library file from LLVM installation // (e.g. exclude symlinks on Linux) - def clang_path_include = (Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC)) ? - "libclang.a" : "*clang*" - - println ">> clang_path_include = $clang_path_include" - println ">> libclang_dir = $libclang_dir" + def isAix = Os.isName("AIX") || Os.isName("aix") + def isUnixNotMac = Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC) + def clang_path_include = + isAix ? "libclang.a" : + isUnixNotMac ? "libclang.so.${clang_version}" : + "*clang*" from("${libclang_dir}") { include(clang_path_include) include("libLLVM.*") exclude("clang.exe") into("libs") - // make sure we drop shared library version name (Linux only) - //rename("libclang.so.*", "libclang.so") + rename("libclang.so.*", "libclang.so") - eachFile { - println ">> Copying ${it.name} from ${it.file}" - } } from("${libclang_dir}") { include("libclang.a") into("$buildDir/test-libs") - } + } from("$clang_include_dir") { include("*.h") into("conf/jextract") @@ -275,8 +272,8 @@ if (jacocoAgent != null) { tasks.register("copyLibClangToTestLib", Copy) { def srcFile = file("${project.buildDir}/jmod_inputs/libs/libclang.a") def destDir = file("${project.buildDir}/test-lib/libs") - dependsOn(copyLibClang) - from(srcFile) + dependsOn(copyLibClang) + from(srcFile) into(destDir) doLast { diff --git a/make/Build.gmk b/make/Build.gmk index 0222d89a..cc6baebc 100644 --- a/make/Build.gmk +++ b/make/Build.gmk @@ -12,7 +12,6 @@ else JPACKAGE_ARGS := endif - ifeq ($(PLATFORM_OS), macosx) TAR_SUPPORTS_TRANSFORM := false else ifeq ($(PLATFORM_OS), aix) @@ -21,7 +20,6 @@ else TAR_SUPPORTS_TRANSFORM := true endif - LIBCLANG_LIB_DIR := $(LIBCLANG_HOME)/$(OS_LIB_DIR) LIBCLANG_INCLUDE_DIR := $(LIBCLANG_HOME)/lib/clang/$(LIBCLANG_VERSION)/include From c9d5ec9537dddad9febcf817904bd4bdc863a942 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Thu, 20 Nov 2025 09:10:52 -0500 Subject: [PATCH 07/10] remove extra changes --- build.gradle | 2 -- gradlew | 2 +- .../java/org/openjdk/jextract/clang/libclang/Index_h.java | 1 - test/test-support/CMakeLists.txt | 5 ----- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 33db45e7..62385c18 100644 --- a/build.gradle +++ b/build.gradle @@ -286,8 +286,6 @@ tasks.named("jtreg") { dependsOn("copyLibClangToTestLib") } - - tasks.register("coverage", JavaExec) { dependsOn jtregWithCoverage diff --git a/gradlew b/gradlew index 54e65396..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -203,7 +203,7 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx1024m" "-Xms512m" "-Xss8m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, diff --git a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java index 399ed342..ea9d2d3f 100644 --- a/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java +++ b/src/main/java/org/openjdk/jextract/clang/libclang/Index_h.java @@ -109,7 +109,6 @@ static MemoryLayout align(MemoryLayout layout, long align) { SYMBOL_LOOKUP = SymbolLookup.loaderLookup().or(Linker.nativeLinker().defaultLookup()); } } - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; diff --git a/test/test-support/CMakeLists.txt b/test/test-support/CMakeLists.txt index 4f09f324..f534eb1c 100644 --- a/test/test-support/CMakeLists.txt +++ b/test/test-support/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.14) project(TestSupportLibs) option(TEST_SOURCE_ROOT "src directory with test files") -# Force XL C on AIX -if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - set(CMAKE_C_COMPILER /opt/IBM/xlC/13.1.3/bin/xlc) - set(CMAKE_CXX_COMPILER /opt/IBM/xlC/13.1.3/bin/xlC) -endif() file(GLOB_RECURSE TEST_LIBS ${TEST_SOURCE_ROOT}/*lib*.c) foreach(TEST_LIB ${TEST_LIBS}) From 847e9bfedb30f2ecf54e093f08e92b4fda68364d Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Thu, 20 Nov 2025 09:20:20 -0500 Subject: [PATCH 08/10] remove executable --- gradlew | 252 -------------------------------------------------------- 1 file changed, 252 deletions(-) delete mode 100755 gradlew diff --git a/gradlew b/gradlew deleted file mode 100755 index f5feea6d..00000000 --- a/gradlew +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" From a94e0a32b075c3829da648e7c03938c3092e4821 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Thu, 20 Nov 2025 09:41:14 -0500 Subject: [PATCH 09/10] Restore gradlew executable --- gradlew | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 gradlew diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..f5feea6d --- /dev/null +++ b/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" From 73da4b042567db03de6e9a9abd64bc43e69f8066 Mon Sep 17 00:00:00 2001 From: Suchismith Roy Date: Thu, 20 Nov 2025 09:55:02 -0500 Subject: [PATCH 10/10] remove debug codE --- build.gradle | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build.gradle b/build.gradle index 62385c18..3979a128 100644 --- a/build.gradle +++ b/build.gradle @@ -201,8 +201,6 @@ task createRuntimeImageForTest(type: Exec) { task cmakeConfigure(type: Exec) { executable = "cmake" - environment "CC", "/opt/IBM/xlC/13.1.3/bin/xlc" - environment "CXX", "/opt/IBM/xlC/13.1.3/bin/xlC" args = [ "-B", "$buildDir/testlib-build", "-S", "$projectDir/test/test-support", @@ -275,10 +273,6 @@ tasks.register("copyLibClangToTestLib", Copy) { dependsOn(copyLibClang) from(srcFile) into(destDir) - - doLast { - println "[DEBUG] Successfully copied libclang.a to test-lib/libs" - } } // Make jtreg depend on it