Opened 2 years ago

Closed 2 years ago

#64941 closed defect (fixed)

usbredir @0.9.0: error: ‘TCP_KEEPINTVL’ undeclared

Reported by: barracuda156 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: tiger leopard snowleopard lion mountainlion Cc:
Port: usbredir

Description (last modified by ryandesign (Ryan Carsten Schmidt))

This is a separate issue from #64940. When restricted to ppc32, usbredir still fails on Leopard and Snow Leopard Rosetta due to undeclared TCP_KEEPINTVL and TCP_KEEPCNT.

This is on 10.5.8:

Making all in usbredirserver
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0/usbredirserver'
/usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -I/opt/local/include/libusb-1.0 -I../usbredirhost -I../usbredirparser -pipe -Os -arch ppc -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -MT usbredirserver-usbredirserver.o -MD -MP -MF .deps/usbredirserver-usbredirserver.Tpo -c -o usbredirserver-usbredirserver.o `test -f 'usbredirserver.c' || echo './'`usbredirserver.c
usbredirserver.c: In function ‘main’:
usbredirserver.c:390: error: ‘TCP_KEEPINTVL’ undeclared (first use in this function)
usbredirserver.c:390: error: (Each undeclared identifier is reported only once
usbredirserver.c:390: error: for each function it appears in.)
usbredirserver.c:397: error: ‘TCP_KEEPCNT’ undeclared (first use in this function)
make[2]: *** [usbredirserver-usbredirserver.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0/usbredirserver'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0" && /usr/bin/make -j4 -w all 
Exit code: 2
Error: Failed to build usbredir: command execution failed

And on 10.6.8 with gcc10:

Making all in usbredirserver
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0/usbredirserver'
/opt/local/bin/gcc-mp-10 -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -I/opt/local/include/libusb-1.0 -I../usbredirhost -I../usbredirparser -pipe -Os -arch ppc -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -MT usbredirserver-usbredirserver.o -MD -MP -MF .deps/usbredirserver-usbredirserver.Tpo -c -o usbredirserver-usbredirserver.o `test -f 'usbredirserver.c' || echo './'`usbredirserver.c
usbredirserver.c: In function 'main':
usbredirserver.c:390:48: error: 'TCP_KEEPINTVL' undeclared (first use in this function); did you mean 'TCP_KEEPALIVE'?
  390 |             if (setsockopt(client_fd, SOL_TCP, TCP_KEEPINTVL, &optval, optlen) == -1) {
      |                                                ^~~~~~~~~~~~~
      |                                                TCP_KEEPALIVE
usbredirserver.c:390:48: note: each undeclared identifier is reported only once for each function it appears in
usbredirserver.c:397:48: error: 'TCP_KEEPCNT' undeclared (first use in this function); did you mean 'TCP_KEEPIDLE'?
  397 |             if (setsockopt(client_fd, SOL_TCP, TCP_KEEPCNT, &optval, optlen) == -1) {
      |                                                ^~~~~~~~~~~
      |                                                TCP_KEEPIDLE
make[2]: *** [usbredirserver-usbredirserver.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0/usbredirserver'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_usbredir/usbredir/work/usbredir-0.9.0" && /usr/bin/make -j4 -w all 
Exit code: 2
Error: Failed to build usbredir: command execution failed

Attachments (3)

main_10.5.8.log (56.7 KB) - added by barracuda156 2 years ago.
main_10.6.8_gcc42.log (133.5 KB) - added by barracuda156 2 years ago.
main_10.6.8_gcc10.log (39.5 KB) - added by barracuda156 2 years ago.

Download all attachments as: .zip

Change History (10)

Changed 2 years ago by barracuda156

Attachment: main_10.5.8.log added

Changed 2 years ago by barracuda156

Attachment: main_10.6.8_gcc42.log added

Changed 2 years ago by barracuda156

Attachment: main_10.6.8_gcc10.log added

comment:1 Changed 2 years ago by barracuda156

Summary: usbredir fails to build for PowerPCusbredir fails to build for PowerPC: error: ‘TCP_KEEPINTVL’ undeclared

comment:2 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: tiger lion mountainlion added; powerpc rosetta removed
Summary: usbredir fails to build for PowerPC: error: ‘TCP_KEEPINTVL’ undeclaredusbredir @0.9.0: error: ‘TCP_KEEPINTVL’ undeclared

Yes, this problem affects Mountain Lion and earlier. I guess TCP_KEEPINTVL and TCP_KEEPCNT aren't declared by the system headers on those OS versions. I haven't investigated whether upstream has already fixed this (we are not using the latest version yet because that would require switching to the meson build system and I didn't feel like dealing with that yet) or, if not, what the solution would be.

Last edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 in reply to:  2 Changed 2 years ago by barracuda156

Replying to ryandesign:

Yes, this problem affects Mountain Lion and earlier. I guess TCP_KEEPINTVL and TCP_KEEPCNT aren't declared by the system headers on those OS versions. I haven't investigated whether upstream has already fixed this (we are not using the latest version yet because that would require switching to the meson build system and I didn't feel like dealing with that yet) or, if not, what the solution would be.

Yeah, these appear from 10.9 onwards:

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
…
#define	TCP_KEEPINTVL		0x101	/* interval between keepalives */
#define	TCP_KEEPCNT		0x102	/* number of keepalives before close */

UPD: Well, just adding these two lines to usbredirserver.c solved the problem:

36-109% port -v installed usbredir
The following ports are currently installed:
  usbredir @0.9.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-04-06T08:39:45+0800'
Last edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

While that may compile, just defining those values may not do anything useful. The program will be passing those constants to the OS, or comparing those values against something returned by the OS. If the OS didn't define those constants, likely the OS is not prepared to accept or return those values.

The error is occurring in usbredirserver.c; upstream has removed usbredirserver in the latest not-yet-released version. Maybe we can instruct the port not to build that component.

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

Status: assignedaccepted

comment:6 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 861efe933cfb7c0a00f3269a8e284c7dd274f699/macports-ports (master):

usbredir: Don't build usbredirserver on <= 10.8

usbredirserver can't be built with the 10.8 SDK and earlier, but it has
been deprecated for awhile and upstream has already removed the code in
the next version.

Closes: #64941

Note: See TracTickets for help on using tickets.