Closed lordsutch closed 4 years ago
Oh lovely stuff. I have absolutely no OSX dev experience at all so I expect I’ll take only a small look at this and just take it. Thanks very much for the work.
Essentially I have no idea if I can take your changes without it breaking Linux compatibility and I don’t really know how to do things properly for multi-platform.
TL;DR version: this pull request doesn't break building on Linux.
Longer version/explanation: Both changes shouldn't break building on other platforms including Linux. According to the malloc(3) man page for Linux, malloc is defined in stdlib.h on Linux as well (on my Linux systems, malloc.h seems to duplicate some declarations that are in stdlib.h), and POSIX.1's man page says the same at https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html. See also: https://stackoverflow.com/questions/12973311/difference-between-stdlib-h-and-malloc-h
LC_ALL is described in setlocale(3) on Linux, where it says setlocale (and thus LC_ALL) is defined in locale.h. Again, POSIX.1's man page says the same: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html. After doing some digging using the g++ -H option, it looks like the C++ string
header indirectly brings in locale.h on Linux but it doesn't bring it in on macOS.
Both Linux man pages say these definitions are in C89 (ANSI C) so any current C or C++ compiler should follow these definitions.
Just to double-check that this won't break Linux builds, I went ahead and built my fork on my Debian sid amd64 box, which apparently already had all of the dependencies installed from building other stuff:
git clone https://github.com/lordsutch/boinctui-extended.git
autoconf
./configure
make
./boinctui-extended
It builds and runs correctly. I also built my fork on my Raspberry Pi 4 running Raspbian buster; after installing libgnutls28-dev
and libncurses-dev
with apt, it also builds and runs fine.
Finally, I also built it with Clang instead of GCC on both the RPi and amd64 box (using CC=clang CXX=clang++ ./configure
). My fork also builds and runs fine when built this way on both systems.
Surprisingly I understood more of that than I expected to. That’s excellent, thanks very much. I’ll go ahead and take this.
Excellent, thanks!
These two commits fix some minor portability issues with building on Darwin/macOS:
In making these changes, I used the standards-conforming #include <c> syntax instead of #include <.h>, although I doubt it makes any real difference in practice.
With these two commits and Homebrew's openssl and ncurses installed, the build succeeds and the program appears to work normally.
autoconf
./configure --without-gnutls --without-ncursesw CPPFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/ncurses/include" CXXFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/ncurses/include" LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/openssl/lib"
make