I attempted to compile this application on OpenBSD 6.6. From what I gather, OpenBSD does not provide gethostbyname_r.
After a quick search, I discovered that this issue is common among many applications and affects more operating systems than OpenBSD.
I found one Github Issue and associated Pull Request which solves the issue by replacing gethostbyname_r() with getaddrinfo(). In that Pull Request, most of the changes were actually deletions.
cmake output
router# cmake -DCMAKE_BUILD_TYPE=Release .
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CURL: /usr/local/lib/libcurl.so.26.0 (found version "7.66.0")
-- Found LibXml2: /usr/local/lib/libxml2.so.16.1 (found version "2.9.9")
-- Found OpenSSL: /usr/lib/libcrypto.so.45.5 (found version "2.0.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/speedtest-plus-plus/SpeedTest-master
Compilation Failure
router# make install
Scanning dependencies of target SpeedTest
[ 20%] Building CXX object CMakeFiles/SpeedTest.dir/main.cpp.o
[ 40%] Building CXX object CMakeFiles/SpeedTest.dir/SpeedTest.cpp.o
[ 60%] Building CXX object CMakeFiles/SpeedTest.dir/SpeedTestClient.cpp.o
/root/speedtest-plus-plus/SpeedTest-master/SpeedTestClient.cpp:197:9: error: use of undeclared identifier 'gethostbyname_r'
if (gethostbyname_r(hostp.first.c_str(), &server, (char *)&tmpbuf, BUFSIZ, &result, &errnop)) {
^
1 error generated.
*** Error 1 in . (CMakeFiles/SpeedTest.dir/build.make:89 'CMakeFiles/SpeedTest.dir/SpeedTestClient.cpp.o': /usr/bin/c++ -I/root/speedtest-...)
*** Error 1 in . (CMakeFiles/Makefile2:76 'CMakeFiles/SpeedTest.dir/all')
*** Error 1 in /root/speedtest-plus-plus/SpeedTest-master (Makefile:130 'all')
router# make install
I attempted to compile this application on OpenBSD 6.6. From what I gather, OpenBSD does not provide
gethostbyname_r
.After a quick search, I discovered that this issue is common among many applications and affects more operating systems than OpenBSD.
I found one Github Issue and associated Pull Request which solves the issue by replacing
gethostbyname_r()
withgetaddrinfo()
. In that Pull Request, most of the changes were actually deletions.cmake output
Compilation Failure