I am trying to build the apcupsd package under a newer version of MacOS and Xcode, but the configure
script supplied with the current version of apcupsd breaks under Xcode 12.4 (though it worked under Xcode 11.2).
The error is gethostbyname_r
is required. Now, configure
tests for this function, and ordinarily it adapts to systems that do not provide it. On the newer Xcode version, however, configure
just exits with an error. I THINK it has something to do with Apple making the -Werror
setting mandatory. I've found that I can get a successful build by commenting out the broken test in configure
, then running it and explicitly passing the flag that configure
is supposed to set. But that's not very satisfactory.
Is there is a general way to pass an override to configure
for the compiler? I tried setting -Wno-error
in the CPPFLAGS
and CFLAGS
environment for configure
, but the configtest program seems to ignore those. What seems to be going on is configure
is seeing that gethostbyname_r
doesn't exist and sets it to no but then later on still tests for it. I'm just wondering if there's a flag or something to get past this error, as it seems to me that whatever Apple did to break (or fix) Xcode after version 11.2 would have broken a lot of people's projects.
I am looking for a solution that does not involve modifying the program sources or the Autotools input files. The project manual is not helpful in this regard.
As an update: someone on the apcupsd list told me that this issue is fixed in a later version of Xcode. I have not tried that yet but when I do if that is what it proves out to be I'll post a followup
Is there is a general way to pass an override to
configure
for the compiler? I tried setting-Wno-error
in theCPPFLAGS
andCFLAGS
environment forconfigure
, but the configtest program seems to ignore those.
If you set the CFLAGS
or CPPFLAGS
variable in configure
's environment, then not only should configure
use those flags when it builds test programs, but it should also memorialize the variable so that you don't need to specify it again to make
. Indeed, this...
What seems to be going on is configure is seeing that
gethostbyname_r
doesn't exist and sets it to no
... suggests that it is doing so in your case.
In that event, if it seems to test again later, or else to fail in some other way despite determining that the function is not present, then that suggests a flaw in the project's own autotooling.
I'm just wondering if there's a flag or something to get past this error,
You have already tried the most likely candidate ( CFLAGS
). Alternatively, you might also be able work around the issue through use of a cache file . That's still hacky, but I think less so than modifying the configure
script. I'm afraid I have no specific guidance on doing this.
as it seems to me that whatever Apple did to break (or fix) Xcode after version 11.2 would have broken a lot of people's projects.
It did. That does not imply that there is a quick or easy solution, though it would be good news if indeed Apple solved the issue in a later version of Xcode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.