apache / couchdb

Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
https://couchdb.apache.org/
Apache License 2.0
6.29k stars 1.04k forks source link

Compilation issues with Erlang 20 #611

Closed goncalotomas closed 7 years ago

goncalotomas commented 7 years ago

Erlang 20 seems to break the compile process due to at least 2 issues.

couchdb-snappy

Has a pre-compilation check for Erlang version that doesn't include version 20, easy to fix and I already submitted a pull request.

rebar.config.script

Has a pre-compilation check for Erlang version, but allowing the new version brings other problems that I was unable to solve. This is the result of a make command after running ./configure on Mac OS Sierra 64-bit with the newly released Erlang/OTP 20.0:

==> config (compile)
Compiled src/config_sup.erl
Compiled src/config_util.erl
Compiled src/config_writer.erl
Compiled src/config_notifier.erl
Compiled src/config_listener.erl
Compiled src/config_listener_mon.erl
Compiled src/config_app.erl
Compiled src/config.erl
==> b64url (compile)
Compiled src/b64url.erl
Compiling c_src/b64url.c
==> ets_lru (compile)
/my-awesome-path/couchdb/src/ets_lru/src/ets_lru.erl:167: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/ets_lru/src/ets_lru.erl:236: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/ets_lru.erl
==> khash (compile)
Compiled src/khash.erl
Compiling c_src/hash.c
Compiling c_src/khash.c
==> snappy (compile)
Compiled src/snappy.erl
Compiling c_src/snappy_nif.cc
Compiling c_src/snappy/snappy-sinksource.cc
Compiling c_src/snappy/snappy-stubs-internal.cc
Compiling c_src/snappy/snappy.cc
==> setup (compile)
Compiled src/setup_httpd_handlers.erl
Compiled src/setup_sup.erl
Compiled src/setup_app.erl
Compiled src/setup_httpd.erl
/my-awesome-path/couchdb/src/setup/src/setup_epi.erl:16: Warning: behaviour couch_epi_plugin undefined
Compiled src/setup_epi.erl
Compiled src/setup.erl
==> ioq (compile)
Compiled src/ioq_sup.erl
Compiled src/ioq_app.erl
/my-awesome-path/couchdb/src/ioq/src/ioq.erl:139: Warning: random:uniform/0: the 'random' module is deprecated; use the 'rand' module instead
Compiled src/ioq.erl
==> bear (compile)
/my-awesome-path/couchdb/src/bear/src/bear.erl:28: Warning: export_all flag enabled - all functions will be exported
Compiled src/bear.erl
==> meck (compile)
Compiled src/meck_util.erl
Compiled src/meck_matcher.erl
Compiled src/meck_ret_spec.erl
Compiled src/meck_history.erl
Compiled src/meck_expect.erl
Compiled src/meck_cover.erl
Compiled src/meck_code.erl
Compiled src/meck_code_gen.erl
Compiled src/meck_args_matcher.erl
Compiled src/meck_proc.erl
Compiled src/meck.erl
==> folsom (compile)
Compiled src/folsom_utils.erl
Compiled src/folsom_sup.erl
/my-awesome-path/couchdb/src/folsom/src/folsom_sample_uniform.erl:52: Warning: random:uniform_s/2: the 'random' module is deprecated; use the 'rand' module instead
Compiled src/folsom_sample_uniform.erl
/my-awesome-path/couchdb/src/folsom/src/folsom_sample_slide_uniform.erl:48: Warning: random:uniform_s/2: the 'random' module is deprecated; use the 'rand' module instead
Compiled src/folsom_sample_slide_uniform.erl
Compiled src/folsom_sample_slide_sup.erl
Compiled src/folsom_sample_slide_server.erl
Compiled src/folsom_sample_slide_sorted.erl
Compiled src/folsom_vm_metrics.erl
Compiled src/folsom_sample_slide.erl
Compiled src/folsom_sample_none.erl
Compiled src/folsom_sample.erl
Compiled src/folsom_metrics_spiral.erl
/my-awesome-path/couchdb/src/folsom/src/folsom_sample_exdec.erl:67: Warning: random:uniform_s/2: the 'random' module is deprecated; use the 'rand' module instead
/my-awesome-path/couchdb/src/folsom/src/folsom_sample_exdec.erl:76: Warning: random:uniform_s/2: the 'random' module is deprecated; use the 'rand' module instead
Compiled src/folsom_sample_exdec.erl
Compiled src/folsom_metrics_history.erl
Compiled src/folsom_metrics_meter_reader.erl
Compiled src/folsom_metrics_meter.erl
Compiled src/folsom_metrics_histogram_ets.erl
Compiled src/folsom_metrics_gauge.erl
Compiled src/folsom_metrics_histogram.erl
Compiled src/folsom_metrics_duration.erl
Compiled src/folsom_metrics_counter.erl
Compiled src/folsom_ewma.erl
Compiled src/folsom_meter_timer_server.erl
Compiled src/folsom_metrics.erl
Compiled src/folsom.erl
Compiled src/folsom_ets.erl
==> ibrowse (compile)
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_lib.erl:372: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/ibrowse_lib.erl
Compiled src/ibrowse_sup.erl
Compiled src/ibrowse_socks5.erl
Compiled src/ibrowse_lb.erl
Compiled src/ibrowse_app.erl
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_test.erl:82: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_test.erl:92: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_test.erl:170: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_test.erl:181: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/ibrowse_test.erl
Compiled src/ibrowse.erl
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_http_client.erl:428: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/ibrowse/src/ibrowse_http_client.erl:1831: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/ibrowse_http_client.erl
==> jiffy (compile)
Compiling c_src/decoder.c
Compiling c_src/encoder.c
Compiling c_src/jiffy.c
Compiling c_src/utf8.c
Compiling c_src/util.c
Compiling c_src/doubles.cc
Compiling c_src/double-conversion/bignum-dtoa.cc
Compiling c_src/double-conversion/bignum.cc
Compiling c_src/double-conversion/cached-powers.cc
Compiling c_src/double-conversion/diy-fp.cc
Compiling c_src/double-conversion/double-conversion.cc
Compiling c_src/double-conversion/fast-dtoa.cc
Compiling c_src/double-conversion/fixed-dtoa.cc
Compiling c_src/double-conversion/strtod.cc
Compiled src/jiffy_utf8.erl
Compiled src/jiffy.erl
==> mochiweb (compile)
Compiled src/reloader.erl
Compiled src/mochiweb_websocket.erl
Compiled src/mochiweb_socket.erl
/my-awesome-path/couchdb/src/mochiweb/src/mochiweb_session.erl:144: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
Compiled src/mochiweb_session.erl
Compiled src/mochiweb_socket_server.erl
Compiled src/mochiweb_util.erl
Compiled src/mochiweb_response.erl
Compiled src/mochiweb_mime.erl
Compiled src/mochiweb_io.erl
/my-awesome-path/couchdb/src/mochiweb/src/mochiweb_multipart.erl:59: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
Compiled src/mochiweb_multipart.erl
Compiled src/mochiweb_http.erl
Compiled src/mochiweb_headers.erl
Compiled src/mochiweb_echo.erl
Compiled src/mochiweb_cover.erl
Compiled src/mochiweb_request.erl
Compiled src/mochiweb_clock.erl
Compiled src/mochiweb_cookies.erl
Compiled src/mochiweb_base64url.erl
Compiled src/mochiweb_acceptor.erl
Compiled src/mochiweb.erl
Compiled src/mochiutf8.erl
/my-awesome-path/couchdb/src/mochiweb/src/mochiweb_html.erl:26: Warning: export_all flag enabled - all functions will be exported
Compiled src/mochiweb_html.erl
/my-awesome-path/couchdb/src/mochiweb/src/mochitemp.erl:108: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
Compiled src/mochitemp.erl
Compiled src/mochilogfile2.erl
Compiled src/mochinum.erl
Compiled src/mochilists.erl
Compiled src/mochijson.erl
Compiled src/mochihex.erl
Compiled src/mochiglobal.erl
Compiled src/mochifmt_std.erl
Compiled src/mochifmt_records.erl
Compiled src/mochijson2.erl
Compiled src/mochifmt.erl
Compiled src/mochiweb_charref.erl
==> oauth (compile)
/my-awesome-path/couchdb/src/oauth/src/oauth.erl:80: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
Compiled src/oauth.erl
==> couch_epi (compile)
/my-awesome-path/couchdb/src/couch_epi/src/couch_epi_util.erl:33: Warning: call to crypto:md5/1 will fail, since it was removed in 20.0; use crypto:hash/2
Compiled src/couch_epi_util.erl
Compiled src/couch_epi_sup.erl
Compiled src/couch_epi_module_keeper.erl
Compiled src/couch_epi_plugin.erl
Compiled src/couch_epi_functions.erl
Compiled src/couch_epi_data.erl
Compiled src/couch_epi_data_gen.erl
Compiled src/couch_epi_codechange_monitor.erl
Compiled src/couch_epi_functions_gen.erl
/my-awesome-path/couchdb/src/couch_epi/src/couch_epi_codegen.erl:78: Warning: erl_scan:token_info/2: removed in 19.0; use erl_scan:{category,column,line,location,symbol,text}/1 instead
Compiled src/couch_epi_codegen.erl
Compiled src/couch_epi_app.erl
Compiled src/couch_epi.erl
==> couch_log (compile)
Compiled src/couch_log_writer.erl
Compiled src/couch_log_writer_stderr.erl
Compiled src/couch_log_writer_file.erl
Compiled src/couch_log_writer_syslog.erl
Compiled src/couch_log_util.erl
Compiled src/couch_log_sup.erl
Compiled src/couch_log_server.erl
Compiled src/couch_log_monitor.erl
Compiled src/couch_log_trunc_io_fmt.erl
Compiled src/couch_log_formatter.erl
Compiled src/couch_log_error_logger_h.erl
Compiled src/couch_log_config_dyn.erl
Compiled src/couch_log_trunc_io.erl
Compiled src/couch_log_app.erl
Compiled src/couch_log.erl
Compiled src/couch_log_config.erl
==> chttpd (compile)
/my-awesome-path/couchdb/src/chttpd/src/chttpd.erl:207: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
Compiled src/chttpd.erl
Compiled src/chttpd_xframe_options.erl
Compiled src/chttpd_view.erl
Compiled src/chttpd_sup.erl
Compiled src/chttpd_test_util.erl
Compiled src/chttpd_plugin.erl
Compiled src/chttpd_show.erl
Compiled src/chttpd_httpd_handlers.erl
Compiled src/chttpd_rewrite.erl
Compiled src/chttpd_handlers.erl
Compiled src/chttpd_epi.erl
Compiled src/chttpd_external.erl
Compiled src/chttpd_misc.erl
Compiled src/chttpd_auth_request.erl
Compiled src/chttpd_cors.erl
Compiled src/chttpd_auth.erl
Compiled src/chttpd_app.erl
Compiled src/chttpd_auth_cache.erl
Compiled src/chttpd_db.erl
==> couch (compile)
Compiled src/couch_httpd.erl
Compiled src/test_request.erl
/my-awesome-path/couchdb/src/couch/src/couch_uuids.erl:40: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
/my-awesome-path/couchdb/src/couch/src/couch_uuids.erl:43: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
/my-awesome-path/couchdb/src/couch/src/couch_uuids.erl:46: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/couch/src/couch_uuids.erl:103: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
/my-awesome-path/couchdb/src/couch/src/couch_uuids.erl:106: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
Compiled src/couch_uuids.erl
Compiled src/couch_work_queue.erl
Compiled src/couch_users_db.erl
Compiled src/couch_totp.erl
/my-awesome-path/couchdb/src/couch/src/test_util.erl:234: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/test_util.erl
Compiled src/couch_sup.erl
Compiled src/couch_task_status.erl
/my-awesome-path/couchdb/src/couch/src/couch_util.erl:210: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
Compiled src/couch_util.erl
Compiled src/couch_secondary_sup.erl
Compiled src/couch_stream.erl
Compiled src/couch_server.erl
Compiled src/couch_query_servers.erl
Compiled src/couch_proc_manager.erl
Compiled src/couch_primary_sup.erl
Compiled src/couch_passwords.erl
Compiled src/couch_os_process.erl
Compiled src/couch_os_daemons.erl
Compiled src/couch_native_process.erl
/my-awesome-path/couchdb/src/couch/src/couch_lru.erl:22: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/couch/src/couch_lru.erl:28: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/couch_lru.erl
/my-awesome-path/couchdb/src/couch/src/couch_multidb_changes.erl:305: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
Compiled src/couch_multidb_changes.erl
Compiled src/couch_io_logger.erl
Compiled src/couch_httpd_vhost.erl
Compiled src/couch_httpd_rewrite.erl
Compiled src/couch_key_tree.erl
Compiled src/couch_httpd_multipart.erl
Compiled src/couch_httpd_proxy.erl
Compiled src/couch_httpd_oauth.erl
Compiled src/couch_httpd_handlers.erl
Compiled src/couch_httpd_external.erl
Compiled src/couch_httpd_misc_handlers.erl
Compiled src/couch_hotp.erl
Compiled src/couch_httpd_auth.erl
Compiled src/couch_external_server.erl
Compiled src/couch_file.erl
Compiled src/couch_external_manager.erl
Compiled src/couch_event_sup.erl
Compiled src/couch_ejson_compare.erl
Compiled src/couch_emsort.erl
Compiled src/couch_drv.erl
Compiled src/couch_debug.erl
Compiled src/couch_httpd_db.erl
Compiled src/couch_db_plugin.erl
Compiled src/couch_doc.erl
Compiled src/couch_db_epi.erl
Compiled src/couch_db_header.erl
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:25: Warning: call to crypto:sha/1 will fail, since it was removed in 20.0; use crypto:hash/2
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:27: Warning: call to crypto:md5/1 will fail, since it was removed in 20.0; use crypto:hash/2
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:37: Warning: call to crypto:sha_init/0 will fail, since it was removed in 20.0; use crypto:hash_init/1
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:39: Warning: call to crypto:md5_init/0 will fail, since it was removed in 20.0; use crypto:hash_init/1
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:50: Warning: call to crypto:sha_update/2 will fail, since it was removed in 20.0; use crypto:hash_update/2
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:52: Warning: call to crypto:md5_update/2 will fail, since it was removed in 20.0; use crypto:hash_update/2
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:63: Warning: call to crypto:sha_final/1 will fail, since it was removed in 20.0; use crypto:hash_final/1
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:65: Warning: call to crypto:md5_final/1 will fail, since it was removed in 20.0; use crypto:hash_final/1
/my-awesome-path/couchdb/src/couch/src/couch_crypto.erl:76: Warning: call to crypto:sha_mac/2 will fail, since it was removed in 20.0; use crypto:hmac/3
Compiled src/couch_crypto.erl
Compiled src/couch_compress.erl
/my-awesome-path/couchdb/src/couch/src/couch_compaction_daemon.erl:202: Warning: variable 'ViewsMonRef' exported from 'case' (line 169)
Compiled src/couch_compaction_daemon.erl
Compiled src/couch_db_updater.erl
Compiled src/couch_changes.erl
Compiled src/couch_db.erl
Compiled src/couch_base32.erl
Compiled src/couch_att.erl
/my-awesome-path/couchdb/src/couch/src/couch_btree.erl:399: Warning: variable 'NodeList' exported from 'case' (line 381)
Compiled src/couch_btree.erl
/my-awesome-path/couchdb/src/couch/src/couch.erl:15: Warning: export_all flag enabled - all functions will be exported
Compiled src/couch.erl
Compiled src/couch_app.erl
/my-awesome-path/couchdb/src/couch/src/couch_auth_cache.erl:206: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/my-awesome-path/couchdb/src/couch/src/couch_auth_cache.erl:314: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
Compiled src/couch_auth_cache.erl
Compiling /my-awesome-path/couchdb/src/couch/priv/couch_js/http.c
/my-awesome-path/couchdb/src/couch/priv/couch_js/http.c:18:10: fatal error: 'jsapi.h' file not found
#include <jsapi.h>
         ^
1 error generated.
ERROR: compile failed while processing /my-awesome-path/couchdb/src/couch: rebar_abort
make: *** [couch] Error 1
eiri commented 7 years ago

For what it's worth this seems to be a problem with your spider monkey installation, rather than with couch itself, it is technically possible to compile it with erlang 20

vagrant@sandbox:/tmp$ kerl active
The current active installation is:
/opt/erlang/20.0

vagrant@sandbox:/tmp$ git clone https://github.com/apache/couchdb.git
Cloning into 'couchdb'...
remote: Counting objects: 67715, done.
...

vagrant@sandbox:/tmp$ cd couchdb/
vagrant@sandbox:/tmp/couchdb (master)$ 

vagrant@sandbox:/tmp/couchdb (master)$ ./configure --disable-fauxton --disable-docs
==> configuring couchdb in rel/couchdb.config
Cloning into '/tmp/couchdb/src/rebar'...
remote: Counting objects: 367, done.
...
Updating bear from {git,"https://github.com/apache/couchdb-bear.git",
                        "008f48aff819126e281d5ccae80a258bf9bf9c30"}
You have configured Apache CouchDB, time to relax. Relax.

vagrant@sandbox:/tmp/couchdb (master)$ vi rebar.config.script
## add 20 to require_otp_vsn

vagrant@sandbox:/tmp/couchdb (master)$ vi src/snappy/rebar.config
## add 20 to require_otp_vsn

$ make
==> config (compile)
Compiled src/config_sup.erl
Compiled src/config_app.erl
...
Compiled src/rexi_sup.erl
Compiled src/rexi.erl
==> rel (compile)
==> couchdb (compile)

That said erlang 20 hasn't been tested and not recommended for use, hence it's not in require_otp_vsn.

goncalotomas commented 7 years ago

I did not use the --disable-fauxton --disable-docs options. I'm guessing from your response it has no effect on the outcome, is that right?

eiri commented 7 years ago

yes, this is only to speed up things, both docs build tools and fauxton not depend or use erlang.

goncalotomas commented 7 years ago

this seems to be a problem with your spider monkey installation

That explains it, I don't have spider monkey installed (I didn't know about the dependency).

wohali commented 7 years ago

Our build dependencies are documented in the INSTALL.Unix.md file. If you find any inaccuracies in there, please let us know!

I'm closing this ticket for now as not a bug in CouchDB. Thanks for using our software! 👯