Opened 5 weeks ago

Closed 13 hours ago

#63748 closed defect (fixed)

xsel 1.2.0 fails to build on macOS 12.0.1

Reported by: derekschrock (Derek Schrock) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: monterey Cc:
Port: xsel

Description

$ sudo port install xsel
...
Error: Failed to build xsel: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_xsel/xsel/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port xsel failed
...
:info:build if /usr/bin/clang -DHAVE_CONFIG_H -I. -I. -I.   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk  -pipe -Os -isysroot/Libr
ary/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -fno-strict-aliasing -Wall -Werror -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused -MT xsel.o -MD -
MP -MF ".deps/xsel.Tpo" -c -o xsel.o xsel.c; \
:info:build     then mv -f ".deps/xsel.Tpo" ".deps/xsel.Po"; else rm -f ".deps/xsel.Tpo"; exit 1; fi
:info:build xsel.c:372:14: error: 'fork' is deprecated: Use posix_spawn or fork [-Werror,-Wdeprecated-declarations]
:info:build   if ((pid = fork()) == -1) {
:info:build              ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/unistd.h:604:1: note: 'fork' has been explicitly marked deprecated here
:info:build __deprecated_msg("Use posix_spawn or fork")
:info:build ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/cdefs.h:208:48: note: expanded from macro '__deprecated_msg'
:info:build         #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
:info:build                                                       ^
:info:build xsel.c:382:14: error: 'fork' is deprecated: Use posix_spawn or fork [-Werror,-Wdeprecated-declarations]
:info:build   if ((pid = fork()) == -1) {
:info:build              ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/unistd.h:604:1: note: 'fork' has been explicitly marked deprecated here
:info:build __deprecated_msg("Use posix_spawn or fork")
:info:build ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/cdefs.h:208:48: note: expanded from macro '__deprecated_msg'
:info:build         #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
:info:build                                                       ^
:info:build 2 errors generated.
:info:build make[1]: *** [xsel.o] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_xsel/xsel/wo
rk/xsel-1.2.0'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_x11_xsel/xsel/work/
xsel-1.2.0'

Change History (12)

comment:1 Changed 5 weeks ago by reneeotten (Renee Otten)

Keywords: monterey added
Owner: set to ryandesign
Status: newassigned

comment:2 Changed 5 weeks ago by ryandesign (Ryan Schmidt)

I have reported the bug to the developers of xsel for you here.

comment:3 Changed 4 weeks ago by ryandesign (Ryan Schmidt)

However the last release of xsel was in 2008 so it may be dead. If anyone knows the fix for this issue, please contribute it to upstream, then notify us here.

comment:4 Changed 4 weeks ago by derekschrock (Derek Schrock)

If you're open to getting it to just build, patching out the "#define vfork fork" in config.h post-configure should fix it. There's a number of other options for upstream however I don't it being fixed in a timely manner.

Is it possible for the port to patch around it until then?

comment:5 Changed 4 weeks ago by ryandesign (Ryan Schmidt)

It is technically possible, of course. Though I can't say that I understand the issues at hand here.

comment:6 Changed 4 weeks ago by derekschrock (Derek Schrock)

xsel's configure.ac has AC_FUNC_FORK which creates the macro:

#define vfork fork

This is added to "config.h" included in xsel.c before system headers.

macOS 12's <unistd.h> has the following:

...

#if !defined(_POSIX_C_SOURCE)
__deprecated_msg("Use posix_spawn or fork")
#endif
pid_t	 vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
/* End XSI */
...

Since "config.h" with the above macro #define vfork fork that pid_t vfork ... turns in to pid_t fork ... So now any usage of fork() results in a depercation message.

The exact fix is still in question as mentioned here. Any one of those can be used. However, the easy ones would be to remove ​AC_FUNC_FORK from configure.ac or remove or #undef vfork the vfork macro after autoconf runs.

Assuming everything I said is true/correct. Removing AC_FUNC_FORK from configure.ac might be the easiest/safest? From my understanding AC_FUNC_FORK is only here for broken vfork/fork which isn't an issue on supported macOS version? `

comment:8 Changed 4 weeks ago by ryandesign (Ryan Schmidt)

Great but

  1. since this only fixes a build failure and does not change the functionality of existing successful builds on earlier OS versions the revision should not be increased;
  2. you must check os.platform before you check os.arch; and
  3. this should be a patchfile not a reinplace for the usual reasons.

You mentioned in the upstream bug that it may be an autoconf bug. If you think so, please file a bug report with them. I have not attempted to understand the issue in as much detail as you have and don't currently intend to do so; I'm busy with other things.

comment:9 Changed 4 weeks ago by derekschrock (Derek Schrock)

Update the patch to x11/xsel instead of patching/replace but to default AC_FUNC_FORK's vfork function check to yes so in turn doesn't create the macro.

Reverted the revision bump and checked for darwin before os.major.

https://github.com/derekschrock/macports-ports/commit/066d3a2b2c529d16856a5775221da52ca51fc1d5

comment:10 Changed 2 weeks ago by derekschrock (Derek Schrock)

Any issues with the above commit? If not I can submit a pull request.

comment:11 Changed 2 weeks ago by ryandesign (Ryan Schmidt)

Use eq instead of == when performing string comparisons in Tcl. And it's a good idea to add a comment in the Portfile, above your change, with a link to the upstream bug report that explains why it's there.

As for whether this fix is correct, as I've said, I have no information and take no responsibility for it. If this breaks something, I hope that you will follow up with any necessary fixes; I don't want to be involved.

comment:12 Changed 13 hours ago by derekschrock (Derek Schrock)

Resolution: fixed
Status: assignedclosed

In a5e2d3e12ea03b0a6712a7f8efeab9049b428cc8/macports-ports (master):

xsel: disable check for autoconf vfork AC_FUNC_FORK

  • disable check for autoconf AC_FUNC_FORK vfork checking caching to yes.
  • AC_FUNC_FORK will create a #define vfork fork macro in config.h
  • vfork has been mark depercated in macOS 12.
  • This macro will mark fork() usage as depercated due to config.h being included before system header <unistd.h>.

Re: https://github.com/kfish/xsel/issues/42
Closes: #63748

Note: See TracTickets for help on using tickets.