Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for musl libc and uclibc #1908

Merged
merged 20 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fabfbc4
[RPM] Add g++ as build dependency
amadio Jan 19, 2023
5056af5
Update XrdPosixAdmin.cc
costing Feb 8, 2023
1c68330
XrdHttp: Supports non-natively supported checksum in the case a user …
ccaffy Feb 10, 2023
5a83259
Revert "[XrdCl] Make sure error message does not include a null-chara…
amadio Feb 13, 2023
9987b4b
[XrdCms] Remove extraneous character from error output
amadio Feb 13, 2023
a344d5e
[Server] Avoid a race condition during deferred file close
smithdh Feb 14, 2023
dedcb2d
[Pfc] Add missing if-error for a rare direct-read error trace.
osschar Feb 14, 2023
0058c17
fix: Avoid 'may be used uninitialized' warning
matthewfeickert Feb 14, 2023
7026055
Update release notes for v5.5.3
amadio Feb 17, 2023
751bf28
Merge v5.5.3 into master
amadio Feb 17, 2023
ad2960e
[CMake] Add check for musl libc
amadio Feb 14, 2023
0750673
Use standard poll.h, errno.h in place of sys/*.h
Chocimier Jul 23, 2022
e281a27
Add (partial) support for musl libc
BenJarg Feb 14, 2023
0f5c231
Provide dummy implementation of innetgr() when compiling with musl
amadio Feb 14, 2023
aac3dd2
[XrdOssCsi] Include byteswap.h everywhere except on macOS
amadio Feb 14, 2023
9ff4dc1
Include missing sys/types.h where needed to support musl
amadio Feb 14, 2023
9f6f473
Include missing sys/time.h where needed to support musl
amadio Feb 14, 2023
ecf528a
[XrdOuc] Adapt XrdOucBackTrace.cc to support musl
amadio Feb 14, 2023
647e294
[XrdPosix] Add utility functions fseterr/fseteof with musl support
amadio Feb 14, 2023
cfd2b1d
[CI] Add build on Alpine Linux
amadio Feb 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,91 @@ jobs:
# ./common/test-runner ./XrdClTests/libXrdClTests.so 'All Tests/FileSystemTest/'
# ./common/test-runner ./XrdClTests/libXrdClTests.so 'All Tests/LocalFileHandlerTest/'

cmake-alpine-musl:

runs-on: ubuntu-latest
container: alpine

steps:
- name: Install external dependencies
shell: sh
run: |
apk add \
bash \
cmake \
cppunit-dev \
curl-dev \
fuse-dev \
fuse3-dev \
g++ \
git \
json-c-dev \
krb5-dev \
libxml2-dev \
linux-headers \
make \
openssl-dev \
py3-pip \
python3-dev \
readline-dev \
tinyxml-dev \
util-linux-dev \
zlib-dev

- name: Clone repository
uses: actions/checkout@v2

- name: Build with cmake
run: |
cd ..
# need to fix ownership not to confuse git
chown -R -v "$( id -u; ):$( id -g; )" xrootd
cmake \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DPYTHON_EXECUTABLE=$(command -v python3) \
-DFORCE_ENABLED=ON \
-DENABLE_HTTP=OFF \
-DENABLE_TESTS=ON \
-DENABLE_VOMS=OFF \
-DENABLE_XRDEC=OFF \
-DENABLE_XRDCLHTTP=OFF \
-DENABLE_MACAROONS=OFF \
-DENABLE_SCITOKENS=OFF \
-DPIP_OPTIONS="--verbose" \
-S xrootd \
-B build
cmake build -LH
cmake \
--build build \
--clean-first \
--parallel $(($(nproc) - 1))
cmake --build build --target install
python3 -m pip list

- name: Verify install
run: |
command -v xrootd
command -v xrdcp

- name: Verify Python bindings
run: |
python3 --version --version
python3 -m pip list
python3 -m pip show xrootd
python3 -c 'import XRootD; print(XRootD)'
python3 -c 'import pyxrootd; print(pyxrootd)'
python3 -c 'from XRootD import client; print(client.FileSystem("root://someserver:1094"))'

- name: Run libXrdCl tests
run: |
cd ../build/tests
./common/test-runner ./XrdClTests/libXrdClTests.so 'All Tests/UtilsTest/'
./common/test-runner ./XrdClTests/libXrdClTests.so 'All Tests/SocketTest/'
./common/test-runner ./XrdClTests/libXrdClTests.so 'All Tests/PollerTest/'

cmake-centos7:

runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions cmake/XRootDOSDefs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
set( LINUX TRUE )
include( GNUInstallDirs )
set( EXTRA_LIBS rt )

# Check for musl libc with the compiler, since it provides way to detect it
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE TARGET_TRIPLE ERROR_VARIABLE TARGET_ERROR)

if (NOT TARGET_ERROR)
if ("${TARGET_TRIPLE}" MATCHES "musl")
message(STATUS "Detected musl libc")
add_definitions(-DMUSL=1)
endif()
else()
message(WARNING "Could not detect system information!")
endif()

unset(TARGET_ERROR)
endif()

#-------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions docs/PreReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ Prerelease Notes
+ **Major bug fixes**

+ **Minor bug fixes**
**[PFC]** Add a missing if-error for a rare direct-read error trace.
**Commit: 9d2973d1

+ **Miscellaneous**
15 changes: 15 additions & 0 deletions docs/ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ XRootD
Release Notes
=============

-------------
Version 5.5.3
-------------

+ **Minor bug fixes**
**[Pfc]** Add missing if-error for a rare direct-read error trace
**[Server]** Avoid a race condition during deferred file close
**[XrdCms]** Fix compiler warning for potentially uninitialized variables
**[XrdCms]** Remove extraneous character from error output (issue 1501)
**[XrdHttp]** Support user-provided script for computing checksums
**[XrdPosix]** Add missing include

+ **Miscellaneous**
**[RPM]** Add g++ as build dependency

-------------
Version 5.5.2
-------------
Expand Down
2 changes: 2 additions & 0 deletions packaging/rhel/xrootd.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ Requires(postun): initscripts

%if %{?rhel}%{!?rhel:0} == 7
BuildRequires: devtoolset-7
%else
BuildRequires: gcc-c++
%endif

%description
Expand Down
2 changes: 2 additions & 0 deletions src/Xrd/XrdConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "Xrd/XrdProtLoad.hh"
#include "Xrd/XrdProtocol.hh"

#include <sys/types.h>

class XrdSysError;
class XrdTcpMonInfo;
class XrdNetSecurity;
Expand Down
2 changes: 1 addition & 1 deletion src/Xrd/XrdPoll.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/

#include <sys/poll.h>
#include <poll.h>
#include "XrdSys/XrdSysPthread.hh"

#define XRD_NUMPOLLERS 3
Expand Down
8 changes: 8 additions & 0 deletions src/XrdAcc/XrdAccGroups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
#include "XrdAcc/XrdAccGroups.hh"
#include "XrdAcc/XrdAccPrivs.hh"

#ifdef MUSL
int innetgr(const char *netgroup, const char *host, const char *user,
const char *domain)
{
return 0;
}
#endif

// Additionally, this routine does not support a user in more than
// NGROUPS_MAX groups. This is a standard unix limit defined in limits.h.

Expand Down
1 change: 1 addition & 0 deletions src/XrdCl/XrdClFileStateHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <set>
#include <vector>

#include <sys/time.h>
#include <sys/uio.h>
#include <cstdint>

Expand Down
2 changes: 2 additions & 0 deletions src/XrdCl/XrdClMonitor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

#include "XrdCl/XrdClFileSystem.hh"

#include <sys/time.h>

namespace XrdCl
{
class URL;
Expand Down
4 changes: 1 addition & 3 deletions src/XrdCl/XrdClXRootDMsgHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1202,9 +1202,7 @@ namespace XrdCl
if( pStatus.code == errErrorResponse )
{
st->errNo = rsp->body.error.errnum;
// omit the last character as the string returned from the server
// (acording to protocol specs) should be null-terminated
std::string errmsg( rsp->body.error.errmsg, rsp->hdr.dlen-5 );
std::string errmsg( rsp->body.error.errmsg, rsp->hdr.dlen-4 );
if( st->errNo == kXR_noReplicas && !pLastError.IsOK() )
errmsg += " Last seen error: " + pLastError.ToString();
st->SetErrorMessage( errmsg );
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCms/XrdCmsCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ int XrdCmsCluster::Unuseable(XrdCmsSelect &Sel)

int n = snprintf(Sel.Resp.Data, sizeof(Sel.Resp.Data),
"No servers are available to %s%s the %s.",
Xmode, Amode, EType)+1;
Xmode, Amode, EType);
if (n < (int)sizeof(Sel.Resp.Data)) Sel.Resp.DLen = n+1;
else Sel.Resp.DLen = sizeof(Sel.Resp.Data);

Expand Down
2 changes: 1 addition & 1 deletion src/XrdNet/XrdNetMsg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/******************************************************************************/

#include <cerrno>
#include <sys/poll.h>
#include <poll.h>

#include "XrdNet/XrdNet.hh"
#include "XrdNet/XrdNetMsg.hh"
Expand Down
13 changes: 8 additions & 5 deletions src/XrdNet/XrdNetSecurity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
#include <sys/types.h>
#include <Winsock2.h>
#include <io.h>
int innetgr(const char *netgroup, const char *host, const char *user,
const char *domain)
{
return 0;
}
#include "XrdSys/XrdWin32.hh"
#endif

Expand All @@ -53,6 +48,14 @@ int innetgr(const char *netgroup, const char *host, const char *user,
#include "XrdNet/XrdNetUtils.hh"
#include "XrdSys/XrdSysTrace.hh"

#if defined(MUSL) || defined(WIN32)
int innetgr(const char *netgroup, const char *host, const char *user,
const char *domain)
{
return 0;
}
#endif

/******************************************************************************/
/* L o c a l C l a s s e s */
/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/XrdOfs/XrdOfsHandle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <cstdio>
#include <ctime>
#include <sys/errno.h>
#include <errno.h>
#include <sys/types.h>

#include "XrdOfs/XrdOfsHandle.hh"
Expand Down
6 changes: 3 additions & 3 deletions src/XrdOssCsi/XrdOssCsiTagstoreFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#include <memory>
#include <mutex>

#if defined(__GLIBC__) || defined(__BIONIC__) || defined(__CYGWIN__)
#include <byteswap.h>
#elif defined(__APPLE__)
#if defined(__APPLE__)
// Make sure that byte swap functions are not already defined.
#if !defined(bswap_16)
// Mac OS X / Darwin features
Expand All @@ -49,6 +47,8 @@
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
#endif
#else
#include <byteswap.h>
#endif

class XrdOssCsiTagstoreFile : public XrdOssCsiTagstore
Expand Down
12 changes: 5 additions & 7 deletions src/XrdOuc/XrdOucBackTrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <vector>
#include <sys/syscall.h>

#ifdef __GNUC__
#ifndef MUSL /* glibc, uclibc, and macOS all have execinfo.h */
#include <execinfo.h>
#include <cxxabi.h>
#endif
Expand Down Expand Up @@ -176,13 +176,11 @@ XrdInfo *CvtRsp(const char *name, int snum)
/* D e m a n g l e */
/******************************************************************************/

#ifndef MUSL
namespace
{
int Demangle(char *cSym, char *buff, int blen)
{
#ifndef __GNUC__
return -1;
#else
int status;
char *plus = index(cSym, '+');
char *brak = (plus ? index(plus, '[') : 0);
Expand All @@ -201,7 +199,6 @@ int Demangle(char *cSym, char *buff, int blen)
status = snprintf(buff, blen, "%s %s+%s\n", brak, realname, plus+1);
free(realname);
return status;
#endif
}
}

Expand All @@ -221,6 +218,7 @@ int DumpDepth()
return (depth <= maxDepth ? depth : maxDepth);
}
}
#endif

/******************************************************************************/
/* D u m p S t a c k */
Expand All @@ -230,8 +228,8 @@ namespace
{
void DumpStack(char *bP, int bL, TidType tid)
{
#ifndef __GNUC__
snprintf(bP, bL, "TBT " TidFmt " No stack information available, not gnuc.", tid);
#ifdef MUSL
snprintf(bP, bL, "TBT " TidFmt " No stack information available with musl libc.", tid);
return;
#else
static int btDepth = DumpDepth(); // One time MT-safe call
Expand Down