aarond10 / https_dns_proxy

A lightweight DNS-over-HTTPS proxy.
MIT License
777 stars 114 forks source link

macos compile error #13

Closed jimmont closed 7 years ago

jimmont commented 7 years ago
10.12.6 Sierra, Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64

xcode-select --install
xcode-select --switch /Library/Developer/CommandLineTools
brew doctor
brew install c-ares socat libev
curl 7.54.0

git clone https://github.com/aarond10/https_dns_proxy.git
cd https_dns_proxy
cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: ./https_dns_proxy

make
[ 11%] Linking C executable https_dns_proxy
ld: library not found for -lcares
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [https_dns_proxy] Error 1
make[1]: *** [CMakeFiles/https_dns_proxy.dir/all] Error 2
make: *** [all] Error 2

Any suggestions on how to resolve this error or any additional detail needed? Thanks.

jimmont commented 7 years ago

fixed with:

possibly unnecessary:

brew install curl --with-openssl --with-c-ares --with-libssh2 --with-nghttp2 --with-gssapi --with-libmetalink
brew link curl --force

curl -V
curl 7.56.0 (x86_64-apple-darwin16.7.0) libcurl/7.56.0 OpenSSL/1.0.2l zlib/1.2.8 c-ares/1.13.0 libssh2/1.8.0 nghttp2/1.26.0
Release-Date: 2017-10-04
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy Metalink

fix:

rm -rf https_dns_proxy/
git clone https://github.com/aarond10/https_dns_proxy.git
cd https_dns_proxy

cmake .
-- The C compiler identification is AppleClang 9.0.0.9000038
-- The CXX compiler identification is AppleClang 9.0.0.9000038
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: ...

make
Scanning dependencies of target https_dns_proxy
[ 11%] Building C object CMakeFiles/https_dns_proxy.dir/src/dns_poller.c.o
[ 22%] Building C object CMakeFiles/https_dns_proxy.dir/src/dns_server.c.o
[ 33%] Building C object CMakeFiles/https_dns_proxy.dir/src/https_client.c.o
[ 44%] Building C object CMakeFiles/https_dns_proxy.dir/src/json_to_dns.c.o
[ 55%] Building C object CMakeFiles/https_dns_proxy.dir/src/logging.c.o
./https_dns_proxy/src/logging.c:64:11: warning: format specifies type 'long' but the argument has type '__darwin_suseconds_t' (aka 'int') [-Wformat]
          tv.tv_usec, filename, line);
          ^~~~~~~~~~
1 warning generated.
[ 66%] Building C object CMakeFiles/https_dns_proxy.dir/src/main.c.o
./https_dns_proxy/src/main.c:174:5: warning: 'daemon' is deprecated: first deprecated in macOS 10.5 - Use posix_spawn APIs instead. [-Wdeprecated-declarations]
    daemon(0, 0);
    ^
/usr/include/stdlib.h:285:6: note: 'daemon' has been explicitly marked deprecated here
int      daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
         ^
1 warning generated.
[ 77%] Building C object CMakeFiles/https_dns_proxy.dir/src/options.c.o
[ 88%] Building C object CMakeFiles/https_dns_proxy.dir/lib/nxjson/nxjson.c.o
[100%] Linking C executable https_dns_proxy
[100%] Built target https_dns_proxy
laixintao commented 6 years ago

Hi, I meet a compile error on mac OSX:

cmake .
-- The C compiler identification is AppleClang 9.0.0.9000038
-- The CXX compiler identification is AppleClang 9.0.0.9000038
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBCARES_INCLUDE_DIR
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
LIBEV_INCLUDE_DIR
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy
   used as include directory in directory /Users/laixintao/Program/dns-projects/https_dns_proxy

-- Configuring incomplete, errors occurred!
See also "/Users/laixintao/Program/dns-projects/https_dns_proxy/CMakeFiles/CMakeOutput.log".

And resolved by run:

brew install curl --with-openssl --with-c-ares --with-libssh2 --with-nghttp2 --with-gssapi --with-libmetalink
brew link curl --force

Thanks!

iFwu commented 5 years ago

Tried

brew install curl --with-openssl --with-c-ares --with-libssh2 --with-nghttp2 --with-gssapi --with-libmetalink brew link curl --force

and doesn't work for me.

I fixed by modify CMakeFiles/https_dns_proxy.dir/link.txt file by replace or add -L option with -L/usr/local/lib.