Opened 5 years ago

Closed 5 years ago

#58507 closed defect (fixed)

libuv @1.29.1: Undefined symbols for architecture i386: "_close$NOCANCEL"

Reported by: kencu (Ken) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mopihopi
Port: libuv

Description

I haven't totally sorted this out yet.

There is a new function in src/unix/core.c to make a non-cancellable close() function on systems that support that.

They have implemented this on darwin as close$NOCANCEL, but I think this function might be only 64 bit. At least when I try to build it on a 32bit OS, or when I try to build it +universal, I run into errors like the above.

Not fully sure what the right fix is. Adding an __LP64__ like this does fix the +universal build. Maybe that is the right fix. Perhaps there is some other function to call for 32bit?

int uv__close_nocancel(int fd) {
-#if defined(__APPLE__)
+#if defined(__APPLE__) && __LP64__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
  extern int close$NOCANCEL(int);
  return close$NOCANCEL(fd);
#pragma GCC diagnostic pop
#elif defined(__linux__)
  return syscall(SYS_close, fd);
#else
  return close(fd);
#endif
}

also - you'll notice some #pragma calls inside the function definition in the function above, so gcc-4.2 barfs on that, and we have to remove those for gcc-4.2.

Change History (6)

comment:1 Changed 5 years ago by mopihopi

Cc: mopihopi added

comment:3 Changed 5 years ago by kencu (Ken)

This looks pretty comprehensive too: <https://github.com/lionheart/openradar-mirror/issues/4506>

comment:4 Changed 5 years ago by kencu (Ken)

This appears to work too, and looks probably better:

int uv__close_nocancel(int fd) {
#if defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
#if __LP64__
  extern int close$NOCANCEL(int);
  return close$NOCANCEL(fd);
#else
  extern int close$NOCANCEL$UNIX2003(int);
  return close$NOCANCEL$UNIX2003(fd);
#endif
#pragma GCC diagnostic pop
#elif defined(__linux__)
  return syscall(SYS_close, fd);
#else
  return close(fd);
#endif
}

This fix seems solid from 10.5 to 10.12. For Tiger, have to take the old pathway as there does not seem to be a close$NOCANCEL implementation I can find.

Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:5 Changed 5 years ago by kencu (Ken)

Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:6 Changed 5 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In 1735bb1417aa634f94d7127c4c127f3d5f50e8e9/macports-ports (master):

libuv: bump older systems to 1.29.1

add patch for older gcc versions to not error on pragmas
add patch for 32bit code to link correctly
add bypass path for Tiger, that doesn't seem to have

a non-cancellable close function available

closes: #58507

Note: See TracTickets for help on using tickets.