pytorch / pytorch/gloo

Gloo won't compile on Alpine Linux, and how to fix it.

Open Beginner friendly
#501 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.5k
Forks
368
Avg merge
19h 32m
Merged PRs (30d)
3

Description

Summary

Fix build failure on Alpine Linux (musl libc) due to use of non-portable type.

Problem

When compiling Gloo on Alpine Linux (which uses musl libc), the build fails in gloo/common/linux.cc due to the use of __caddr_t:

ifr->ifr_data = (__caddr_t)&ecmd;
ifr->ifr_data = (__caddr_t)&edata;

__caddr_t is not portable and causes issues on musl-based systems.

Proposed fix

Replace __caddr_t with char*, which is compatible across libc implementations:

ifr->ifr_data = (char*)&ecmd;
ifr->ifr_data = (char*)&edata;
Notes

This change allows successful compilation on Alpine Linux without affecting behavior on glibc-based systems.

This change does not break compatibility either; it is a subtle change that does not alter how Glibc performs the operation.

__caddr_t is effectively an alias for char* on glibc-based systems, so replacing it with char* preserves behavior while improving portability.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open gloo/common/linux.cc and inspect the two assignments using __caddr_t. Replace the non-portable type as proposed, then verify that Gloo compiles on Alpine Linux with musl libc and that the existing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.