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

Enable cross-compilation for musl on linux #339

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gloo/common/linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>

#include <algorithm>
Expand Down Expand Up @@ -198,7 +199,7 @@ static int getInterfaceSpeedGLinkSettings(int sock, struct ifreq* ifr) {
} ecmd;
int rv;

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stemann Why not (void *)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the Linux kernel defines this field as char *, probably for ergonomics ... https://lists.freebsd.org/pipermail/freebsd-questions/2006-August/128784.html

/opt/ai/pytorch/third_party/gloo/gloo/common/linux.cc:201:19: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
  201 |   ifr->ifr_data = (void *)&ecmd;
      |                   ^~~~~~~~~~~~~
      |                   |
      |                   void*
/opt/ai/pytorch/third_party/gloo/gloo/common/linux.cc: In function 'int gloo::getInterfaceSpeedGSet(int, ifreq*)':
/opt/ai/pytorch/third_party/gloo/gloo/common/linux.cc:229:19: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
  229 |   ifr->ifr_data = (void *)&edata;
      |                   ^~~~~~~~~~~~~~
      |                   |
      |                   void*

memset(&ecmd, 0, sizeof(ecmd));
ecmd.req.cmd = ETHTOOL_GLINKSETTINGS;

Expand Down Expand Up @@ -226,7 +227,7 @@ static int getInterfaceSpeedGSet(int sock, struct ifreq* ifr) {
struct ethtool_cmd edata;
int rv;

ifr->ifr_data = (__caddr_t)&edata;
ifr->ifr_data = (caddr_t)&edata;
memset(&edata, 0, sizeof(edata));
edata.cmd = ETHTOOL_GSET;

Expand Down