Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failure: gethostbyname_r missing #30

Open
kurtismullins opened this issue Feb 21, 2020 · 0 comments
Open

Build Failure: gethostbyname_r missing #30

kurtismullins opened this issue Feb 21, 2020 · 0 comments

Comments

@kurtismullins
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant