From af5a3578b242f425bec5cf64d4ec0dce548214b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Dr=C3=B6scher?= Date: Thu, 9 Apr 2020 23:36:15 +0200 Subject: [PATCH 1/9] Replacing strange datatype definition with standard ACE_Dev_Poll_Reactor is using __uint32_t for no apparent reason. Since struct epoll_event.events is defined as uint32_t and using __uint32_t breaks compatibility with musl, __uint32_t should be replaced with uint32_t. But to conform with ACE Guidelines I'm using ACE_UINT32. --- ACE/ace/Dev_Poll_Reactor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ACE/ace/Dev_Poll_Reactor.cpp b/ACE/ace/Dev_Poll_Reactor.cpp index 55cb4d4d5a37f..879568dc1509a 100644 --- a/ACE/ace/Dev_Poll_Reactor.cpp +++ b/ACE/ace/Dev_Poll_Reactor.cpp @@ -1122,10 +1122,10 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) // Define bits to check for while dispatching. #if defined (ACE_HAS_EVENT_POLL) - const __uint32_t out_event = EPOLLOUT; - const __uint32_t exc_event = EPOLLPRI; - const __uint32_t in_event = EPOLLIN; - const __uint32_t err_event = EPOLLHUP | EPOLLERR; + const ACE_UINT32 out_event = EPOLLOUT; + const ACE_UINT32 exc_event = EPOLLPRI; + const ACE_UINT32 in_event = EPOLLIN; + const ACE_UINT32 err_event = EPOLLHUP | EPOLLERR; #else const short out_event = POLLOUT; const short exc_event = POLLPRI; @@ -1138,7 +1138,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) // is invalid, there's no event there. Else process it. In any event, we // have the event, so clear event_ for the next thread. const ACE_HANDLE handle = this->event_.data.fd; - __uint32_t revents = this->event_.events; + ACE_UINT32 revents = this->event_.events; this->event_.data.fd = ACE_INVALID_HANDLE; this->event_.events = 0; if (handle != ACE_INVALID_HANDLE) From 96e0a8511e27fb962cfb324dd654fe23311b0f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Dr=C3=B6scher?= Date: Thu, 9 Apr 2020 23:38:08 +0200 Subject: [PATCH 2/9] typedef ACE_LOFF_T as off_t for musl --- ACE/ace/os_include/sys/os_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/os_include/sys/os_types.h b/ACE/ace/os_include/sys/os_types.h index 60a425b9252aa..2ca0c771f8ae7 100644 --- a/ACE/ace/os_include/sys/os_types.h +++ b/ACE/ace/os_include/sys/os_types.h @@ -66,7 +66,7 @@ typedef double ACE_timer_t; #if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 typedef off_t ACE_LOFF_T; #elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__INTERIX) || \ - (defined (ACE_OPENVMS) && defined (_LARGEFILE)) + (defined (ACE_OPENVMS) && defined (_LARGEFILE)) || defined (ACE_HAS_MUSL) typedef off_t ACE_LOFF_T; #elif defined (AIX) || defined (HPUX) || defined (__QNX__) typedef off64_t ACE_LOFF_T; From b9e97a9a68ddfe06bc6a871df86f3211d2f19d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Dr=C3=B6scher?= Date: Thu, 9 Apr 2020 23:39:02 +0200 Subject: [PATCH 3/9] Added musl specific section to config-linux.h --- ACE/ace/config-linux.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h index 954d61f091d1d..9fedefb87b69e 100644 --- a/ACE/ace/config-linux.h +++ b/ACE/ace/config-linux.h @@ -204,6 +204,44 @@ #endif /* __UCLIBC__ */ +// To support musl (note: musl devs refuse to add a __MUSL__) +#if defined (ACE_HAS_MUSL) + +// Enable stuff that musl definitly has +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_PTHREADS +#define ACE_HAS_RECURSIVE_MUTEXES +#define ACE_HAS_PTHREADS_UNIX98_EXT +#define ACE_HAS_CPU_SET_T +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SOCKLEN_T + +// Mask some features musl lacks +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + +// Following the example set by uclib undef some festures +# if defined (ACE_SCANDIR_CMP_USES_VOIDPTR) +# undef ACE_SCANDIR_CMP_USES_VOIDPTR +# endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */ + +# if defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR) +# undef ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +# endif /* ACE_SCANDIR_CMP_USES_CONST_VOIDPTR */ + +# if defined(__GLIBC__) +# undef __GLIBC__ +# endif /* __GLIBC__ */ + +# if defined(ACE_HAS_SEMUN) +# undef ACE_HAS_SEMUN +# endif /* ACE_HAS_SEMUN */ + +#endif /* ACE_HAS_MUSL */ + #include /**/ "ace/post.h" #endif /* ACE_CONFIG_LINUX_H */ From 7ec8330eb8adf35e2bbf12bc40a5321feb93c4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Dr=C3=B6scher?= Date: Thu, 9 Apr 2020 23:39:46 +0200 Subject: [PATCH 4/9] Abort compilation if no libc is detected or enabled --- ACE/ace/config-linux.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h index 9fedefb87b69e..372c9a5838349 100644 --- a/ACE/ace/config-linux.h +++ b/ACE/ace/config-linux.h @@ -242,6 +242,10 @@ #endif /* ACE_HAS_MUSL */ +#if !defined (__GLIBC__) && !defined (__UCLIBC__) && !defined (ACE_HAS_MUSL) +# error "Could not determine C Standard Library" +#endif /* !defined (__GLIBC__) && !defined (__UCLIBC__) && !defined (ACE_HAS_MUSL) */ + #include /**/ "ace/post.h" #endif /* ACE_CONFIG_LINUX_H */ From 1eee82d3680bbf03ee6d6adb45bec9f2a2bf805f Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Thu, 8 Aug 2024 21:38:32 +0000 Subject: [PATCH 5/9] Updated and simplified musl-libc compatibility --- ACE/ace/config-linux.h | 55 ++++++++----------------------- ACE/ace/os_include/sys/os_types.h | 4 +++ 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h index 372c9a5838349..af9c6491f85ad 100644 --- a/ACE/ace/config-linux.h +++ b/ACE/ace/config-linux.h @@ -106,7 +106,7 @@ #define ACE_HAS_UALARM -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +#if defined (__GLIBC__) && (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) // Although the scandir man page says otherwise, this setting is correct. // The setting was fixed in 2.10, so do not use the hack after that. # define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR @@ -120,7 +120,9 @@ #define ACE_HAS_SYSV_IPC // Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN +#if defined (__GLIBC__) +# define ACE_HAS_SEMUN +#endif #if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE) // 32bit PowerPC Linux uses 128bit long double @@ -186,10 +188,6 @@ # undef ACE_SCANDIR_CMP_USES_VOIDPTR # endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */ -# if defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR) -# undef ACE_SCANDIR_CMP_USES_CONST_VOIDPTR -# endif /* ACE_SCANDIR_CMP_USES_CONST_VOIDPTR */ - # if defined (ACE_HAS_EXECINFO_H) # undef ACE_HAS_EXECINFO_H # endif /* ACE_HAS_EXECINFO_H */ @@ -198,53 +196,26 @@ # undef __GLIBC__ # endif /* __GLIBC__ */ -# if defined(ACE_HAS_SEMUN) -# undef ACE_HAS_SEMUN -# endif /* ACE_HAS_SEMUN */ - #endif /* __UCLIBC__ */ -// To support musl (note: musl devs refuse to add a __MUSL__) -#if defined (ACE_HAS_MUSL) +#if !defined (__GLIBC__) && !defined (__UCLIBC__) +// Assume musl, it has no equivalent macro -// Enable stuff that musl definitly has -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_CPU_SET_T #define ACE_HAS_PTHREADS -#define ACE_HAS_RECURSIVE_MUTEXES #define ACE_HAS_PTHREADS_UNIX98_EXT -#define ACE_HAS_CPU_SET_T +#define ACE_HAS_RECURSIVE_MUTEXES #define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGTIMEDWAIT #define ACE_HAS_SOCKLEN_T +#define ACE_HAS_UCONTEXT_T -// Mask some features musl lacks -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_SYS_SYSCTL_H #define ACE_LACKS_ISCTYPE #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_SYS_SYSCTL_H -// Following the example set by uclib undef some festures -# if defined (ACE_SCANDIR_CMP_USES_VOIDPTR) -# undef ACE_SCANDIR_CMP_USES_VOIDPTR -# endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */ - -# if defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR) -# undef ACE_SCANDIR_CMP_USES_CONST_VOIDPTR -# endif /* ACE_SCANDIR_CMP_USES_CONST_VOIDPTR */ - -# if defined(__GLIBC__) -# undef __GLIBC__ -# endif /* __GLIBC__ */ - -# if defined(ACE_HAS_SEMUN) -# undef ACE_HAS_SEMUN -# endif /* ACE_HAS_SEMUN */ - -#endif /* ACE_HAS_MUSL */ - -#if !defined (__GLIBC__) && !defined (__UCLIBC__) && !defined (ACE_HAS_MUSL) -# error "Could not determine C Standard Library" -#endif /* !defined (__GLIBC__) && !defined (__UCLIBC__) && !defined (ACE_HAS_MUSL) */ +#endif #include /**/ "ace/post.h" diff --git a/ACE/ace/os_include/sys/os_types.h b/ACE/ace/os_include/sys/os_types.h index 5a885ff4cd1a6..cbb5a44f9a902 100644 --- a/ACE/ace/os_include/sys/os_types.h +++ b/ACE/ace/os_include/sys/os_types.h @@ -28,6 +28,10 @@ # include /**/ #endif /* !ACE_LACKS_SYS_TYPES_H */ +#if !defined (ACE_LACKS_FCNTL_H) +# include /**/ +#endif /* !ACE_LACKS_FCNTL_H */ + # if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) using std::time_t; From 9852caf3f92873d582389df1053ef8bad7c0204d Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Thu, 8 Aug 2024 16:55:50 -0500 Subject: [PATCH 6/9] Build in a container in GitHub Actions --- .github/workflows/linux-container.yml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/linux-container.yml diff --git a/.github/workflows/linux-container.yml b/.github/workflows/linux-container.yml new file mode 100644 index 0000000000000..83e87f8f4ca28 --- /dev/null +++ b/.github/workflows/linux-container.yml @@ -0,0 +1,56 @@ +name: linux + +on: + push: + pull_request: + schedule: + - cron: '0 1 * * SUN' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + strategy: + fail-fast: false + runs-on: ubuntu-22.04 + name: alpine-3.18 + env: + ACE_ROOT: ${{ github.workspace }}/ACE + TAO_ROOT: ${{ github.workspace }}/TAO + MPC_ROOT: ${{ github.workspace }}/MPC + steps: + - name: Checkout ACE_TAO + uses: actions/checkout@v4 + - name: Checkout MPC + uses: actions/checkout@v4 + with: + repository: DOCGroup/MPC + path: ${{ env.MPC_ROOT }} + - name: Write configuation files + run: | + echo '#include "ace/config-linux.h"' > ${{ env.ACE_ROOT }}/ace/config.h + echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' > ${{ env.ACE_ROOT }}/include/makeinclude/platform_macros.GNU + - name: Build in container + uses: addnab/docker-run-action@v3 + with: + image: alpine:3.18 + options: -v ${{ github.workspace }}:${{ github.workspace }} + run: | + apk add --no-cache git bash make g++ perl linux-headers + export ACE_ROOT=${{ env.ACE_ROOT }} + export TAO_ROOT=${{ env.TAO_ROOT }} + export MPC_ROOT=${{ env.MPC_ROOT }} + perl ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace ${{ env.TAO_ROOT }}/TAO_ACE.mwc -workers 4 + perl ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace ${{ env.ACE_ROOT }}/tests/tests.mwc -workers 4 + perl ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace ${{ env.TAO_ROOT }}/tests/IDL_Test -workers 4 + perl ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace ${{ env.TAO_ROOT }}/tests/IDLv4 -workers 4 + make -j 6 -C ${{ env.TAO_ROOT }} + make -j 6 -C ${{ env.ACE_ROOT }}/tests + make -j 6 -C ${{ env.TAO_ROOT }}/tests/IDL_Test + make -j 6 -C ${{ env.TAO_ROOT }}/tests/IDLv4 From 905aea0ad6cc2bcc91d80558af16d54995888cc4 Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Fri, 9 Aug 2024 12:10:47 -0500 Subject: [PATCH 7/9] Corrected GitHub Actions workflow name --- .github/workflows/linux-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-container.yml b/.github/workflows/linux-container.yml index 83e87f8f4ca28..2a9f510262134 100644 --- a/.github/workflows/linux-container.yml +++ b/.github/workflows/linux-container.yml @@ -1,4 +1,4 @@ -name: linux +name: linux-container on: push: From 13c89f982a41df87f9f80fc681252e7672315fc0 Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Fri, 9 Aug 2024 12:25:27 -0500 Subject: [PATCH 8/9] removed check for unused macro --- ACE/ace/os_include/sys/os_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/os_include/sys/os_types.h b/ACE/ace/os_include/sys/os_types.h index cbb5a44f9a902..90dcb6ac411df 100644 --- a/ACE/ace/os_include/sys/os_types.h +++ b/ACE/ace/os_include/sys/os_types.h @@ -57,7 +57,7 @@ typedef double ACE_timer_t; #if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 typedef off_t ACE_LOFF_T; -#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || defined (ACE_HAS_MUSL) +#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) typedef off_t ACE_LOFF_T; #elif defined (__QNX__) typedef off64_t ACE_LOFF_T; From 843f39c3f34d51fdb1e458508b9a31fd7d9f39d9 Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Fri, 9 Aug 2024 12:28:26 -0500 Subject: [PATCH 9/9] updated preprocessor expression --- ACE/ace/config-linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h index af9c6491f85ad..f5d1272a88f6f 100644 --- a/ACE/ace/config-linux.h +++ b/ACE/ace/config-linux.h @@ -106,7 +106,7 @@ #define ACE_HAS_UALARM -#if defined (__GLIBC__) && (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +#if defined (__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10)) // Although the scandir man page says otherwise, this setting is correct. // The setting was fixed in 2.10, so do not use the hack after that. # define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR