Build error on macOS
amake opened this issue · comments
I maintain the MacPorts port for sslh.
I attempted to build 2.1.0, but found the following error:
make: Entering directory `/opt/local/var/macports/build/_Users_amake_Code_MacPorts_net_sslh/sslh/work/sslh-v2.1.0'
./genver.sh >version.h
/opt/local/var/macports/build/_Users_amake_Code_MacPorts_net_sslh/sslh/work/compwrap/cc/usr/bin/clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch x86_64 -Wall -O2 -DLIBPCRE -g -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -DENABLE_REGEX -DLIBCONFIG -c -o sslh-fork.o sslh-fork.c
sslh-fork.c:189:18: error: use of undeclared identifier 'ENONET'
case ENONET:
^
1 error generated.
make: *** [sslh-fork.o] Error 1
Looking at my local SDK's errno.h, It seems that ENONET
(and EOPTNOTSUPP
) are not available on macOS. The other cases in this switch
are all present.
This ecca78b should fix it.
will you want a release or are you happy staying at HEAD?
Unfortunately the compiler doesn't like that:
make: Entering directory `/opt/local/var/macports/build/_Users_amake_Code_MacPorts_net_sslh/sslh/work/sslh-v2.1.0'
./genver.sh >version.h
/opt/local/var/macports/build/_Users_amake_Code_MacPorts_net_sslh/sslh/work/compwrap/cc/usr/bin/clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch x86_64 -Wall -O2 -DLIBPCRE -g -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -DENABLE_REGEX -DLIBCONFIG -c -o sslh-fork.o sslh-fork.c
sslh-fork.c:200:18: error: duplicate case value '50'
case ENONET:
^
sslh-fork.c:170:16: note: expanded from macro 'ENONET'
#define ENONET ENETDOWN
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/errno.h:165:25: note: expanded from macro 'ENETDOWN'
#define ENETDOWN 50 /* Network is down */
^
sslh-fork.c:196:18: note: previous case defined here
case ENETDOWN: /* accept(2) cites all these errnos as "you should retry" */
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/errno.h:165:25: note: expanded from macro 'ENETDOWN'
#define ENETDOWN 50 /* Network is down */
^
1 error generated.
make: *** [sslh-fork.o] Error 1
will you want a release or are you happy staying at HEAD?
The MacPorts port looks at your official release source under https://rutschle.net/tech/sslh/ so it's nicer for me to have a release. But it's possible to handle either way.
Indeed, apparently C99 does not allow identical case
even if they end up at the same target. I need to figure out how to do this in a way that remains readable (I'd rather not have #ifdef's in the switch statement...)
For packaging purposes I can simply take 2.1.0 and patch out the unneeded symbols. It's not absolutely necessary, but could you tag 2.1.0 so I know where to branch from?
I'm not sure where EOPTNOTSUPP
is defined, but it turns out I only had to remove ENONET
to get it to build.
the 2.1.0 tag is already present: https://github.com/yrutschle/sslh/releases/tag/v2.1.0 or did I misunderstand?
Oops, I'm sorry, I was looking for it somewhere on the master
branch but I see now it's off-branch. Nevermind!
Ok, it' s now merged, but I think the tag remained on a different branch (which I guess is as intended). I have no idea how I managed to do this...
58783af should fix the problem, hopefully. as you indicated, I removed the case for EOPTNOTSUPP, and I replaced ENONET with EWOULDBLOCK which is hopefully different to others in the case
.
and this should all be on master with no tag :-)
Thanks! I can confirm that everything builds now.
Ideally it would be nice to have this as a patch release, but it's not strictly necessary.
tagged with v2.1.1 (on master, if I'm not mistaken :) ).