getdnsapi / getdns

A modern asynchronous DNS API https://getdnsapi.net/
Other
468 stars 126 forks source link

build error on macOS 10.14 #415

Closed l2dy closed 5 years ago

l2dy commented 5 years ago

Hi,

Compiling getdns 1.5.0 on macOS 10.14 failed with the following error.

../libtool --tag=CC --mode=link /usr/bin/clang -o libgetdns.la const-info.lo convert.lo dict.lo dnssec.lo general.lo list.lo request-internal.lo platform.lo pubkey-pinning.lo rr-dict.lo rr-iter.lo server.lo stub.lo sync.lo ub_loop.lo util-internal.lo mdns.lo version.lo context.lo anchor.lo poll_eventloop.lo keyraw.lo gbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo str2wire.lo strptime.lo rbtree.lo val_secalgo.lo lruhash.lo lookup3.lo locks.lo jsmn.lo yxml.lo danessl.lo -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -arch x86_64 -L/opt/local/lib -L/opt/local/lib -lidn2 -lssl -lcrypto -lpthread  -rpath /opt/local/lib -version-info 11:0:1 -no-undefined -export-symbols ./libgetdns.symbols
libtool: link: sed 's|^|_|' < ./libgetdns.symbols > .libs/libgetdns-symbols.expsym
libtool: link: /usr/bin/clang -dynamiclib  -o .libs/libgetdns.10.dylib  .libs/const-info.o .libs/convert.o .libs/dict.o .libs/dnssec.o .libs/general.o .libs/list.o .libs/request-internal.o .libs/platform.o .libs/pubkey-pinning.o .libs/rr-dict.o .libs/rr-iter.o .libs/server.o .libs/stub.o .libs/sync.o .libs/ub_loop.o .libs/util-internal.o .libs/mdns.o .libs/version.o .libs/context.o .libs/anchor.o .libs/poll_eventloop.o .libs/keyraw.o .libs/gbuffer.o .libs/wire2str.o .libs/parse.o .libs/parseutil.o .libs/rrdef.o .libs/str2wire.o .libs/strptime.o .libs/rbtree.o .libs/val_secalgo.o .libs/lruhash.o .libs/lookup3.o .libs/locks.o .libs/jsmn.o .libs/yxml.o .libs/danessl.o   -L/opt/local/lib -lidn2 -lssl -lcrypto -lpthread  -Wl,-headerpad_max_install_names -Wl,-syslibroot -Wl,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -arch x86_64   -install_name  /opt/local/lib/libgetdns.10.dylib -compatibility_version 12 -current_version 12.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libgetdns-symbols.expsym
Undefined symbols for architecture x86_64:
  "_getdns_context_", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _getdns_context_get_tls_backoff_time, _getdns_context_get_api_information , _getdns_context_set_tls_authentication , _getdns_context_set_hosts , _getdns_context_get_num_pending_requests , _getdns_context_set_timeout , _getdns_context_get_follow_redirects , _getdns_context_set_limit_outstanding_queries , _getdns_context_set_edns_version , __getdns_context_get_sys_ctxt , _getdns_context_get_tls_min_version , _getdns_context_get_tls_ciphersuites , _getdns_context_get_tls_ca_file , _getdns_context_get_tls_ca_path , __getdns_context_can_write_appdata , _getdns_context_set_update_callback , _getdns_context_set_tls_min_version , __getdns_context_get_priv_fp , _getdns_context_set_trust_anchors_url , _getdns_context_create_with_extended_memory_functions , _getdns_context_set_trust_anchors_backoff_time , _getdns_context_set_trust_anchors_verify_email , _getdns_context_set_tls_ca_path , _getdns_context_set_tls_ciphersuites , _getdns_context_config , _getdns_context_get_tls_query_padding_blocksize , _getdns_context_get_edns_version , _getdns_context_get_edns_extended_rcode , _getdns_context_get_tls_cipher_list , _getdns_context_get_edns_maximum_udp_payload_size , _getdns_context_get_dnssec_allowed_skew , _getdns_context_get_timeout , _getdns_context_get_tls_connection_retries , _getdns_context_get_max_backoff_value , _getdns_context_get_tls_authentication , _getdns_context_set_tls_ca_file , _getdns_context_get_dns_transport_list , _getdns_context_get_dns_transport , _getdns_context_get_namespaces , _getdns_context_get_resolution_type , _getdns_context_set_return_dnssec_status , _getdns_context_get_suffix , _getdns_context_get_upstream_recursive_servers , _getdns_context_set_eventloop , _getdns_context_process_async , _getdns_context_set_edns_client_subnet_private , _getdns_context_set_memory_functions , _getdns_context_set_tls_query_padding_blocksize , _getdns_context_set_edns_do_bit , _getdns_context_set_edns_extended_rcode , _getdns_context_set_tls_cipher_list , _getdns_context_set_edns_maximum_udp_payload_size , _getdns_context_unset_edns_maximum_udp_payload_size , _getdns_context_set_upstream_recursive_servers , _getdns_context_set_dnssec_allowed_skew , _getdns_context_set_dnssec_trust_anchors , _getdns_context_set_append_name , _getdns_context_set_dns_root_servers , _getdns_context_set_idle_timeout , _getdns_context_set_dns_transport_list , _getdns_context_set_resolution_type , _getdns_context_set_use_threads , _getdns_context_set_logfunc , __getdns_context_write_priv_file , _getdns_context_get_edns_client_subnet_private , _getdns_context_get_trust_anchors_url , __getdns_context_cancel_request , __getdns_context_local_namespace_resolve , _getdns_context_get_trust_anchors_verify_email , _getdns_context_get_hosts , _getdns_context_set_tls_curves_list , _getdns_context_set_resolvconf , __getdns_context_update_root_ksk , _priv_getdns_context_mf , _getdns_context_set_listen_addresses , _getdns_context_get_tls_curves_list , _getdns_context_create_with_memory_functions , _getdns_context_get_eventloop , _getdns_context_get_append_name , __getdns_context_request_timed_out , _getdns_context_get_trust_anchors_verify_CA , _getdns_context_destroy , _getdns_context_get_idle_timeout , _getdns_context_get_dns_root_servers , _getdns_context_set_follow_redirects , _getdns_context_get_limit_outstanding_queries , _getdns_context_set_extended_memory_functions , __getdns_context_track_outbound_request , __getdns_context_get_priv_file , _getdns_context_set_tls_max_version , __getdns_context_clear_outbound_request , _getdns_context_set_tls_connection_retries , _getdns_context_run , _getdns_context_set_max_backoff_value , __getdns_context_equip_with_anchor , _getdns_context_get_tls_max_version , _getdns_context_get_edns_do_bit , _getdns_context_detach_eventloop , _getdns_context_set_tls_backoff_time , _getdns_context_set_context_update_callback , _getdns_context_create , _getdns_context_set_dns_transport , _getdns_context_get_trust_anchors_backoff_time , _getdns_context_get_resolvconf , _getdns_context_get_dnssec_trust_anchors , _getdns_context_get_update_callback , _getdns_context_set_suffix , _getdns_context_get_round_robin_upstreams , __getdns_context_prepare_for_resolution , _getdns_context_set_appdata_dir , _getdns_context_set_round_robin_upstreams , _getdns_context_set_namespaces , _getdns_context_set_trust_anchors_verify_CA )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libgetdns.la] Error 1
hanvinke commented 5 years ago

Tried "make clean_all && make -j4" ?

See https://github.com/dmlc/xgboost/issues/1839 for maybe similar problem.

l2dy commented 5 years ago

Tried "make clean_all && make -j4" ?

See dmlc/xgboost#1839 for maybe similar problem.

make: *** No rule to make target `clean_all'.  Stop.
l2dy commented 5 years ago

I was building it with --enable-stub-only, perhaps that's the problem?

hanvinke commented 5 years ago

Sorry, the working of the command "make clean" depends on the makefile.in from the program. In Getdns thereis f.i. :

autoclean: megaclean Which does effectively: "libtoolize -ci" and "autoreconf -fi"

Also there is...

megaclean: cd $(srcdir) && rm -fr * .dir-locals.el .gitignore .indent.pro .travis.yml && git reset --hard && git submodule update --init

l2dy commented 5 years ago

I built it from a released tarball getdns-1.5.0.tar.gz. If the clean commands made it work, I think the tarball is broken.

hanvinke commented 5 years ago

Could you try to build from Git and see if that works?

glibtoolize -ci (use glibtoolize for OS X, libtool is installed as glibtool to avoid name conflict on OS X) autoreconf -fiAs git submodule update --init

and then configure again with both --enable-stub-only and --without-libidn options.

Does that work?

l2dy commented 5 years ago

autoreconf -fiAs failed:

autoreconf: unrecognized option '-As'.
autoreconf: Try '/opt/local/bin/autoreconf --help' for more information.

With glibtoolize, autoreconf -fi, submodule update, ./configure --enable-stub-only --without-libidn, and then make:

../libtool --quiet --tag=CC --mode=compile gcc -I. -I. -I./util/auxiliary -I./../stubby/src -g -O2 -Wall -Wextra -D_DARWIN_C_SOURCE -I/opt/local/include  -I/opt/local/include  -Wno-error=unused-parameter -Wno-unused-parameter -c ./ssl_dane/danessl.c -o danessl.lo
../libtool --tag=CC --mode=link gcc -o libgetdns.la const-info.lo convert.lo dict.lo dnssec.lo general.lo list.lo request-internal.lo platform.lo pubkey-pinning.lo rr-dict.lo rr-iter.lo server.lo stub.lo sync.lo ub_loop.lo util-internal.lo mdns.lo version.lo context.lo anchor.lo poll_eventloop.lo keyraw.lo gbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo str2wire.lo strptime.lo rbtree.lo val_secalgo.lo lruhash.lo lookup3.lo locks.lo jsmn.lo yxml.lo danessl.lo -L/opt/local/lib -L/opt/local/lib -lidn2 -lssl -lcrypto -lpthread  -rpath /usr/local/lib -version-info 11:0:1 -no-undefined -export-symbols ./libgetdns.symbols
libtool: link: sed 's|^|_|' < ./libgetdns.symbols > .libs/libgetdns-symbols.expsym
libtool: link: gcc -dynamiclib  -o .libs/libgetdns.10.dylib  .libs/const-info.o .libs/convert.o .libs/dict.o .libs/dnssec.o .libs/general.o .libs/list.o .libs/request-internal.o .libs/platform.o .libs/pubkey-pinning.o .libs/rr-dict.o .libs/rr-iter.o .libs/server.o .libs/stub.o .libs/sync.o .libs/ub_loop.o .libs/util-internal.o .libs/mdns.o .libs/version.o .libs/context.o .libs/anchor.o .libs/poll_eventloop.o .libs/keyraw.o .libs/gbuffer.o .libs/wire2str.o .libs/parse.o .libs/parseutil.o .libs/rrdef.o .libs/str2wire.o .libs/strptime.o .libs/rbtree.o .libs/val_secalgo.o .libs/lruhash.o .libs/lookup3.o .libs/locks.o .libs/jsmn.o .libs/yxml.o .libs/danessl.o   -L/opt/local/lib -lidn2 -lssl -lcrypto -lpthread    -install_name  /usr/local/lib/libgetdns.10.dylib -compatibility_version 12 -current_version 12.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libgetdns-symbols.expsym
Undefined symbols for architecture x86_64:
  "_getdns_context_", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _getdns_context_get_tls_backoff_time, _getdns_context_get_api_information , _getdns_context_set_tls_authentication , _getdns_context_set_hosts , _getdns_context_get_num_pending_requests , _getdns_context_set_timeout , _getdns_context_get_follow_redirects , _getdns_context_set_limit_outstanding_queries , _getdns_context_set_edns_version , __getdns_context_get_sys_ctxt , _getdns_context_get_tls_min_version , _getdns_context_get_tls_ciphersuites , _getdns_context_get_tls_ca_file , _getdns_context_get_tls_ca_path , _getdns_context_create_with_extended_memory_functions , _getdns_context_set_trust_anchors_backoff_time , __getdns_context_can_write_appdata , _getdns_context_set_update_callback , _getdns_context_set_tls_min_version , __getdns_context_get_priv_fp , _getdns_context_set_trust_anchors_url , _getdns_context_set_trust_anchors_verify_email , _getdns_context_set_tls_ciphersuites , _getdns_context_set_tls_ca_path , _getdns_context_config , _getdns_context_get_tls_query_padding_blocksize , _getdns_context_get_edns_version , _getdns_context_get_edns_extended_rcode , _getdns_context_get_tls_cipher_list , _getdns_context_get_edns_maximum_udp_payload_size , _getdns_context_get_dnssec_allowed_skew , _getdns_context_get_timeout , _getdns_context_get_tls_connection_retries , _getdns_context_get_max_backoff_value , _getdns_context_get_tls_authentication , _getdns_context_set_tls_ca_file , _getdns_context_get_dns_transport_list , _getdns_context_get_dns_transport , _getdns_context_get_namespaces , _getdns_context_get_resolution_type , _getdns_context_set_return_dnssec_status , _getdns_context_get_suffix , _getdns_context_get_upstream_recursive_servers , _getdns_context_set_eventloop , _getdns_context_process_async , _getdns_context_set_edns_client_subnet_private , _getdns_context_set_memory_functions , _getdns_context_set_tls_query_padding_blocksize , _getdns_context_set_edns_do_bit , _getdns_context_set_edns_extended_rcode , _getdns_context_set_tls_cipher_list , _getdns_context_set_edns_maximum_udp_payload_size , _getdns_context_unset_edns_maximum_udp_payload_size , _getdns_context_set_upstream_recursive_servers , _getdns_context_set_dnssec_allowed_skew , _getdns_context_set_dnssec_trust_anchors , _getdns_context_set_append_name , _getdns_context_set_dns_root_servers , _getdns_context_set_idle_timeout , _getdns_context_set_dns_transport_list , _getdns_context_set_resolution_type , __getdns_context_write_priv_file , _getdns_context_get_edns_client_subnet_private , _getdns_context_get_trust_anchors_url , __getdns_context_cancel_request , __getdns_context_local_namespace_resolve , _getdns_context_get_trust_anchors_verify_email , _getdns_context_get_hosts , _getdns_context_set_tls_curves_list , _getdns_context_set_resolvconf , __getdns_context_update_root_ksk , _priv_getdns_context_mf , _getdns_context_set_listen_addresses , _getdns_context_get_tls_curves_list , _getdns_context_create_with_memory_functions , _getdns_context_get_eventloop , _getdns_context_set_logfunc , _getdns_context_get_append_name , __getdns_context_request_timed_out , _getdns_context_get_trust_anchors_verify_CA , _getdns_context_destroy , _getdns_context_get_idle_timeout , _getdns_context_get_dns_root_servers , _getdns_context_set_follow_redirects , _getdns_context_get_limit_outstanding_queries , _getdns_context_set_extended_memory_functions , __getdns_context_track_outbound_request , __getdns_context_get_priv_file , _getdns_context_set_tls_max_version , __getdns_context_clear_outbound_request , _getdns_context_set_tls_connection_retries , _getdns_context_run , _getdns_context_set_max_backoff_value , __getdns_context_equip_with_anchor , _getdns_context_get_tls_max_version , _getdns_context_get_edns_do_bit , _getdns_context_detach_eventloop , _getdns_context_set_tls_backoff_time , _getdns_context_set_context_update_callback , _getdns_context_create , _getdns_context_set_dns_transport , _getdns_context_get_trust_anchors_backoff_time , _getdns_context_get_resolvconf , _getdns_context_get_dnssec_trust_anchors , _getdns_context_get_update_callback , _getdns_context_set_suffix , _getdns_context_get_round_robin_upstreams , _getdns_context_set_use_threads , __getdns_context_prepare_for_resolution , _getdns_context_set_appdata_dir , _getdns_context_set_round_robin_upstreams , _getdns_context_set_namespaces , _getdns_context_set_trust_anchors_verify_CA )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libgetdns.la] Error 1
make: *** [default] Error 2
l2dy commented 5 years ago

BTW, I'm building commit 309db67f8b3ea721b377f728b0389fbd769122ab (HEAD, tag: v1.5.0) with Xcode 10.1.

hanvinke commented 5 years ago

Thank you for your quick reaction.

Yes, I think I'll leave this to the developers ;-)

hanvinke commented 5 years ago

@wtoorop Maybe this configure now is just failing while testing for symbol leakage?

@l2dy Sorry for the inconvenience, but maybe still a good idea to test if "make clean && make" works, just a last idea ;-)

wtoorop commented 5 years ago

@i2dy acknowledged! I can reproduce. I'm looking into it.

wtoorop commented 5 years ago

For some reason src/libgetdns.symbols contains the incorrect symbol: getdns_context_. If you remove that line, it links and compiles correctly, i.e.:

sed -i '' '/^getdns_context_$/d' src/libgetdns.symbols 

I will look into how this happened and perhaps do a quickfix 1.5.1 release shortly... Thanks for reporting!

PS. The sed command is MacOS specific.

joelpurra commented 5 years ago

Recall problems having a space after -i -- would use -i''.

echo -e 'a\nb\nc\n' > t.txt
cat t.txt
sed -i '' '/^b/d' t.txt
cat t.txt
sed -i'' '/^b/d' t.txt
cat t.txt
l2dy commented 5 years ago

Thanks @wtoorop, getdns 1.5.1 works.