From d2a911792fd9fd3d1f683afc4e8674aaef02eb3b Mon Sep 17 00:00:00 2001 From: Benjamin Tovar Date: Mon, 13 Jan 2025 10:56:41 -0500 Subject: [PATCH] Aarch 64 comp changes (#4021) * fgetc casts result to int * aarch64 does not have SYS_open * rmonitor not when crosscompiling Piggybacker does not work in such case. --- batch_job/src/batch_queue_k8s.c | 8 ++++---- configure | 12 +++++++++++- dttools/src/bitmap.c | 2 +- dttools/src/envtools.c | 2 +- resource_monitor/src/Makefile | 6 +++--- resource_monitor/src/rmonitor_helper.c | 2 ++ 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/batch_job/src/batch_queue_k8s.c b/batch_job/src/batch_queue_k8s.c index 7c08e5d41b..011d4c14d2 100644 --- a/batch_job/src/batch_queue_k8s.c +++ b/batch_job/src/batch_queue_k8s.c @@ -489,9 +489,9 @@ static int batch_queue_k8s_gen_running_pod_lst(struct list **running_pod_lst, pod_state = strtok(NULL, " \t"); int i = 0; - while (pod_state[i] != '\n' && pod_state[i] != EOF) + while (pod_state[i] != '\n' && pod_state[i] != '\0') i++; - if (pod_state[i] == '\n' || pod_state[i] == EOF) + if (pod_state[i] == '\n') pod_state[i] = '\0'; if (strcmp(pod_state, "Running") == 0) { @@ -607,9 +607,9 @@ static batch_queue_id_t batch_queue_k8s_wait(struct batch_queue *q, // trim the tailing new line int i = 0; - while (log_tail_content[i] != '\n' && log_tail_content[i] != EOF) + while (log_tail_content[i] != '\n' && log_tail_content[i] != '\0') i++; - if (log_tail_content[i] == '\n' || log_tail_content[i] == EOF) + if (log_tail_content[i] == '\n' || log_tail_content[i] == '\0') log_tail_content[i] = '\0'; free(get_log_cmd); diff --git a/configure b/configure index 627d52d301..67a03ad5e9 100755 --- a/configure +++ b/configure @@ -64,6 +64,14 @@ case "$BUILD_CPU" in ;; esac +if [ "$BUILD_CPU" = X86_64 -a "$BUILD_SYS" = LINUX -a "$CONDA_BUILD_CROSS_COMPILATION" != 1 ] +then + BUILD_LINUX_NATIVE_X86_64=yes +else + BUILD_LINUX_NATIVE_X86_64=no +fi + + include_package_chirp="chirp" include_package_deltadb="deltadb" include_package_doc="doc" @@ -1241,7 +1249,7 @@ fi if [ "$include_package_resource_monitor" = resource_monitor ] then - if [ -d resource_monitor -a $BUILD_SYS = LINUX ] + if [ -d resource_monitor -a "$BUILD_LINUX_NATIVE_X86_64" = yes ] then echo "resource_monitor IS supported on ${BUILD_SYS}" else @@ -1429,6 +1437,8 @@ CCTOOLS_INSTALL_DIR=${install_path} CCTOOLS_OPSYS=${BUILD_SYS} +CCTOOLS_LINUX_NATIVE_X86_64=${BUILD_LINUX_NATIVE_X86_64} + CCTOOLS_PACKAGES=${packages} CCTOOLS_CC=${CCTOOLS_CC} diff --git a/dttools/src/bitmap.c b/dttools/src/bitmap.c index 84e9b772d8..608c90218f 100644 --- a/dttools/src/bitmap.c +++ b/dttools/src/bitmap.c @@ -385,7 +385,7 @@ static unsigned char pcx_rle_repeat = 0; static unsigned char pcx_rle_value = 0; static unsigned char pcx_rle_read(FILE *file) { - unsigned char c; + int c; retry: if (pcx_rle_repeat > 0) { pcx_rle_repeat--; diff --git a/dttools/src/envtools.c b/dttools/src/envtools.c index adb15b492e..ebc5980569 100644 --- a/dttools/src/envtools.c +++ b/dttools/src/envtools.c @@ -63,7 +63,7 @@ int env_replace(const char *infile, const char *outfile) int var_index = 0; int valid_var = 0; - char c = fgetc(INPUT); + int c = fgetc(INPUT); while (c != EOF) { if (c == '$') { valid_var = 1; diff --git a/resource_monitor/src/Makefile b/resource_monitor/src/Makefile index 8126e39f40..95adc95cd1 100644 --- a/resource_monitor/src/Makefile +++ b/resource_monitor/src/Makefile @@ -20,11 +20,11 @@ LOCAL_LINKAGE = ../../dttools/src/libdttools.a PROGRAMS = resource_monitor piggybacker rmonitor_poll_example rmonitor_snapshot -ifeq ($(CCTOOLS_OPSYS),DARWIN) +ifeq ($(CCTOOLS_LINUX_NATIVE_X86_64),yes) + TARGETS = $(LIBRARIES) $(PROGRAMS) +else TARGETS = PROGRAMS = -else - TARGETS = $(LIBRARIES) $(PROGRAMS) endif all: $(TARGETS) bindings diff --git a/resource_monitor/src/rmonitor_helper.c b/resource_monitor/src/rmonitor_helper.c index 34139fe3e0..8e13d7ef76 100644 --- a/resource_monitor/src/rmonitor_helper.c +++ b/resource_monitor/src/rmonitor_helper.c @@ -270,6 +270,7 @@ int close(int fd) return status; } +#if defined(SYS_open) static int open_for_writing(int fd) { int flags, access_mode; @@ -369,6 +370,7 @@ int open64(const char *path, int flags, ...) return fd; } #endif /* defined linux && __USE_LARGEFILE64 */ +#endif /* defined SYS_open */ int socket(int domain, int type, int protocol) {