#1 Try to get asterisk building again
Closed 6 years ago by jsmith. Opened 6 years ago by tomh.
rpms/ tomh/asterisk fixes  into  master

@@ -0,0 +1,19 @@ 

+ commit 7e0d36fd61c244f292a5cf646fff1daf6963278c

+ Author: Tom Hughes <tom@compton.nu>

+ Date:   Fri Sep 1 21:47:55 2017 +0100

+ 

+     Include mariadb_version.h instead of mysql_version.h

+ 

+ diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c

+ index 259650d4f3..a7e433ff52 100644

+ --- a/addons/res_config_mysql.c

+ +++ b/addons/res_config_mysql.c

+ @@ -35,7 +35,7 @@ ASTERISK_REGISTER_FILE()

+  #include <sys/stat.h>

+  

+  #include <mysql/mysql.h>

+ -#include <mysql/mysql_version.h>

+ +#include <mysql/mariadb_version.h>

+  #include <mysql/errmsg.h>

+  

+  #include "asterisk/channel.h"

file removed
-83
@@ -1,83 +0,0 @@ 

- commit b9b82f067dd2372dda3ecd83411c7b58800b80a2

- Author: Tom Hughes <tom@compton.nu>

- Date:   Fri Mar 10 22:46:33 2017 +0000

- 

-     Fixes for OpenSSL 1.1.x support

- 

- diff --git a/main/libasteriskssl.c b/main/libasteriskssl.c

- index 4e6ea1a..9f6b98c 100644

- --- a/main/libasteriskssl.c

- +++ b/main/libasteriskssl.c

- @@ -74,7 +74,7 @@ static void ssl_lock(int mode, int n, const char *file, int line)

-  	}

-  }

-  

- -#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L

- +#if OPENSSL_VERSION_NUMBER < 0x10100000L

-  int SSL_library_init(void)

-  {

-  #if defined(AST_DEVMODE)

- @@ -116,7 +116,7 @@ void ERR_free_strings(void)

-  {

-  	/* we can't allow this to be called, ever */

-  }

- -#endif /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */

- +#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */

-  

-  #endif /* HAVE_OPENSSL */

-  

- diff --git a/main/tcptls.c b/main/tcptls.c

- index 513676c..4e131f2 100644

- --- a/main/tcptls.c

- +++ b/main/tcptls.c

- @@ -40,6 +40,8 @@ ASTERISK_REGISTER_FILE()

-  #include <signal.h>

-  #include <sys/stat.h>

-  

- +#include <openssl/dh.h>

- +

-  #include "asterisk/compat.h"

-  #include "asterisk/tcptls.h"

-  #include "asterisk/http.h"

- @@ -399,19 +401,17 @@ static int tcptls_stream_close(void *cookie)

-  					SSL_get_error(stream->ssl, res));

-  			}

-  

- -#if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT >= 0x10100000L

- +#if OPENSSL_VERSION_NUMBER >= 0x10100000L

-  			if (!SSL_is_server(stream->ssl)) {

-  #else

-  			if (!stream->ssl->server) {

-  #endif

-  				/* For client threads, ensure that the error stack is cleared */

- -#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L

- -#if OPENSSL_VERSION_NUMBER >= 0x10000000L

- -				ERR_remove_thread_state(NULL);

- -#else

- +#if OPENSSL_VERSION_NUMBER < 0x10000000L

-  				ERR_remove_state(0);

- -#endif	/* OPENSSL_VERSION_NUMBER >= 0x10000000L */

- -#endif  /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */

- +#elif OPENSSL_VERSION_NUMBER < 0x10100000L

- +				ERR_remove_thread_state(NULL);

- +#endif

-  			}

-  

-  			SSL_free(stream->ssl);

- @@ -850,12 +850,16 @@ static int __ssl_setup(struct ast_tls_config *cfg, int client)

-  			cfg->ssl_ctx = SSL_CTX_new(SSLv3_client_method());

-  		} else

-  #endif

- +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER  >= 0x10100000L)

- +		cfg->ssl_ctx = SSL_CTX_new(TLS_client_method());

- +#else

-  		if (ast_test_flag(&cfg->flags, AST_SSL_TLSV1_CLIENT)) {

-  			cfg->ssl_ctx = SSL_CTX_new(TLSv1_client_method());

-  		} else {

-  			disable_ssl = 1;

-  			cfg->ssl_ctx = SSL_CTX_new(SSLv23_client_method());

-  		}

- +#endif

-  	} else {

-  		disable_ssl = 1;

-  		cfg->ssl_ctx = SSL_CTX_new(SSLv23_server_method());

file modified
+8 -3
@@ -62,7 +62,8 @@ 

  Source5:          asterisk.service

  Source6:          asterisk-tmpfiles

  

- Patch0:           asterisk-openssl.patch

+ # mariadb-devel 10.2.8 has moved mysql_version.h

+ Patch0:           asterisk-mariadb.patch

  

  BuildRoot:        %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)

  # Does not build on s390x: https://bugzilla.redhat.com/show_bug.cgi?id=1465162
@@ -134,6 +135,9 @@ 

  # res_rtp_asterisk

  BuildRequires:    libuuid-devel

  

+ # res_resolver_unbound

+ BuildRequires:    unbound-devel

+ 

  %if 0%{?corosync}

  BuildRequires:    corosynclib-devel

  %endif
@@ -638,8 +642,7 @@ 

  

  %prep

  %setup -q -n asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}

- 

- #%patch0 -p1

+ %patch0 -p1

  

  cp %{S:3} menuselect.makedeps

  cp %{S:4} menuselect.makeopts
@@ -1175,6 +1178,7 @@ 

  %{_libdir}/asterisk/modules/res_parking.so

  %{_libdir}/asterisk/modules/res_phoneprov.so

  %{_libdir}/asterisk/modules/res_realtime.so

+ %{_libdir}/asterisk/modules/res_resolver_unbound.so

  %{_libdir}/asterisk/modules/res_rtp_asterisk.so

  %{_libdir}/asterisk/modules/res_rtp_multicast.so

  %{_libdir}/asterisk/modules/res_security_log.so
@@ -1266,6 +1270,7 @@ 

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/phoneprov.conf

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/queuerules.conf

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/queues.conf

+ %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/resolver_unbound.conf

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/res_parking.conf

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/res_stun_monitor.conf

  %attr(0640,asterisk,asterisk) %config(noreplace) %{_sysconfdir}/asterisk/resolver_unbound.conf

file removed
-125
@@ -1,125 +0,0 @@ 

- diff --git a/channels/chan_sip.c b/channels/chan_sip.c

- index bd694ec..4c25ec2 100644

- --- a/channels/chan_sip.c

- +++ b/channels/chan_sip.c

- @@ -9595,7 +9595,8 @@ static int parse_request(struct sip_request *req)

-  {

-  	char *c = ast_str_buffer(req->data);

-  	ptrdiff_t *dst = req->header;

- -	int i = 0, lim = SIP_MAX_HEADERS - 1;

- +	int i = 0;

- +	unsigned int lim = SIP_MAX_HEADERS - 1;

-  	unsigned int skipping_headers = 0;

-  	ptrdiff_t current_header_offset = 0;

-  	char *previous_header = "";

- diff --git a/include/asterisk/inline_api.h b/include/asterisk/inline_api.h

- index d76dfa0..291a838 100644

- --- a/include/asterisk/inline_api.h

- +++ b/include/asterisk/inline_api.h

- @@ -48,7 +48,7 @@

-  #if !defined(LOW_MEMORY) && !defined(DISABLE_INLINE)

-  

-  #if !defined(AST_API_MODULE)

- -#if defined(__clang__)

- +#if defined(__clang__) || defined(__GNUC_STDC_INLINE__)

-  #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body

-  #else /* if defined(__clang__) */

-  #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

- diff --git a/main/ccss.c b/main/ccss.c

- index 7f63690..ff5739a 100644

- --- a/main/ccss.c

- +++ b/main/ccss.c

- @@ -825,7 +825,7 @@ int ast_cc_set_param(struct ast_cc_config_params *params, const char * const nam

-  		return 0;

-  	}

-  

- -	if (!sscanf(value, "%30u", &value_as_uint) == 1) {

- +	if (sscanf(value, "%30u", &value_as_uint) != 1) {

-  		return -1;

-  	}

-  

- diff --git a/main/dsp.c b/main/dsp.c

- index a329dbb..335fb3d 100644

- --- a/main/dsp.c

- +++ b/main/dsp.c

- @@ -112,9 +112,11 @@ static struct progalias {

-  	{ "uk", PROG_MODE_UK },

-  };

-  

- +#define FREQ_ARRAY_SIZE 7

- +

-  static struct progress {

-  	enum gsamp_size size;

- -	int freqs[7];

- +	int freqs[FREQ_ARRAY_SIZE];

-  } modes[] = {

-  	{ GSAMP_SIZE_NA, { 350, 440, 480, 620, 950, 1400, 1800 } },	/*!< North America */

-  	{ GSAMP_SIZE_CR, { 425 } },					/*!< Costa Rica, Brazil */

- @@ -389,7 +391,7 @@ struct ast_dsp {

-  	struct ast_dsp_busy_pattern busy_cadence;

-  	int historicnoise[DSP_HISTORY];

-  	int historicsilence[DSP_HISTORY];

- -	goertzel_state_t freqs[7];

- +	goertzel_state_t freqs[FREQ_ARRAY_SIZE];

-  	int freqcount;

-  	int gsamps;

-  	enum gsamp_size gsamp_size;

- @@ -1036,6 +1038,8 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)

-  	int pass;

-  	int newstate = DSP_TONE_STATE_SILENCE;

-  	int res = 0;

- +	int freqcount = dsp->freqcount > FREQ_ARRAY_SIZE ? FREQ_ARRAY_SIZE : dsp->freqcount;

- +

-  	while (len) {

-  		/* Take the lesser of the number of samples we need and what we have */

-  		pass = len;

- @@ -1045,7 +1049,7 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)

-  		for (x = 0; x < pass; x++) {

-  			samp = s[x];

-  			dsp->genergy += (int32_t) samp * (int32_t) samp;

- -			for (y = 0; y < dsp->freqcount; y++) {

- +			for (y = 0; y < freqcount; y++) {

-  				goertzel_sample(&dsp->freqs[y], samp);

-  			}

-  		}

- @@ -1053,8 +1057,8 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)

-  		dsp->gsamps += pass;

-  		len -= pass;

-  		if (dsp->gsamps == dsp->gsamp_size) {

- -			float hz[7];

- -			for (y = 0; y < 7; y++) {

- +			float hz[FREQ_ARRAY_SIZE];

- +			for (y = 0; y < FREQ_ARRAY_SIZE; y++) {

-  				hz[y] = goertzel_result(&dsp->freqs[y]);

-  			}

-  			switch (dsp->progmode) {

- @@ -1642,7 +1646,7 @@ static void ast_dsp_prog_reset(struct ast_dsp *dsp)

-  

-  	dsp->gsamp_size = modes[dsp->progmode].size;

-  	dsp->gsamps = 0;

- -	for (x = 0; x < ARRAY_LEN(modes[dsp->progmode].freqs); x++) {

- +	for (x = 0; x < FREQ_ARRAY_SIZE; x++) {

-  		if (modes[dsp->progmode].freqs[x]) {

-  			goertzel_init(&dsp->freqs[x], (float)modes[dsp->progmode].freqs[x], dsp->sample_rate);

-  			max = x + 1;

- @@ -1668,6 +1672,7 @@ static struct ast_dsp *__ast_dsp_new(unsigned int sample_rate)

-  		dsp->digitmode = DSP_DIGITMODE_DTMF;

-  		dsp->faxmode = DSP_FAXMODE_DETECT_CNG;

-  		dsp->sample_rate = sample_rate;

- +		dsp->freqcount = 0;

-  		/* Initialize digit detector */

-  		ast_digit_detect_init(&dsp->digit_state, dsp->digitmode & DSP_DIGITMODE_MF, dsp->sample_rate);

-  		dsp->display_inband_dtmf_warning = 1;

- diff --git a/main/manager.c b/main/manager.c

- index 8fa1942..be780e7 100644

- --- a/main/manager.c

- +++ b/main/manager.c

- @@ -4785,7 +4785,7 @@ static int action_atxfer(struct mansession *s, const struct message *m)

-  static int check_blacklist(const char *cmd)

-  {

-  	char *cmd_copy, *cur_cmd;

- -	char *cmd_words[MAX_BLACKLIST_CMD_LEN] = { NULL, };

- +	char *cmd_words[AST_MAX_CMD_LEN] = { NULL, };

-  	int i;

-  

-  	cmd_copy = ast_strdupa(cmd);

file modified
+1 -1
@@ -14,7 +14,7 @@ 

  MENUSELECT_MOH=

  MENUSELECT_OPTS_app_voicemail=FILE_STORAGE

  MENUSELECT_PBX=

- MENUSELECT_RES=res_config_sqlite res_timing_kqueue res_stasis_test res_mwi_external res_mwi_external_ami res_stasis_mailbox res_ari_mailboxes res_digium_phone res_resolver_unbound

+ MENUSELECT_RES=res_config_sqlite res_timing_kqueue res_stasis_test res_mwi_external res_mwi_external_ami res_stasis_mailbox res_ari_mailboxes res_digium_phone

  MENUSELECT_TESTS=test_skel test_heap test_sched test_astobj2 test_dlinklists test_acl test_aoc test_app test_ast_format_str_reduce test_devicestate test_event test_func_file test_gosub test_named_lock test_pbx test_stringfields test_strings test_substitution test_time test_utils test_amihooks test_locale test_logger test_security_events test_poll test_expr test_netsock2 test_db test_linkedlists test_config test_voicemail_api test_jitterbuf test_abstract_jb test_astobj2_thrash test_hashtab_thrash test_xml_escape test_callerid test_ari test_ari_model test_bucket test_cdr test_cel test_channel_feature_hooks test_core_codec test_core_format test_endpoints test_format_cache test_format_cap test_json test_message test_optional_api test_res_pjsip_scheduler test_res_stasis test_scoped_lock test_sorcery test_sorcery_astdb test_sorcery_realtime test_stasis test_stasis_channels test_stasis_endpoints test_taskprocessor test_threadpool test_uri test_uuid test_websocket_client test_vector test_sorcery_memory_cache_thrash test_astobj2_weaken test_dns test_dns_naptr test_dns_query_set test_dns_recurring test_dns_srv test_file test_http_media_cache test_media_cache test_bridging

  MENUSELECT_UTILS=aelparse astcanary astdb2sqlite3 astman check_expr check_expr2 conf2ael muted smsq stereorize streamplayer

  MENUSELECT_DEPSFAILED=MENUSELECT_APPS=app_osplookup

This fixes the mysql build failure in your last attempt (the latest mariadb-devel has removed the top level mysql_version.h) and cleans up a few things.

Build is now working on i686, x86_64, aarch64 and armv7hl but ppc64 and ppc64le are failing due to https://bugzilla.redhat.com/show_bug.cgi?id=1487787.

Thanks for your patches -- I was actively working on trying to get Asterisk back in decent shape while at the Flock conference, so your pull request was very timely. Since I'd already commited part of the changes, and I was trying to do this work today from a plane without internet access, I didn't just directly merge your pull request, but I think I've covered everything.

I've temporarily disabled the corosync sub-package, as I doubt many people are using it, and it'll let things (mostly) build until the problem with libcpg is solved.

I'm still experiencing a problem with res_pjsip on arm7hl, almost as if the arm7hl patch for pjproject isn't actually being applied -- but it's after 2am and I haven't slept in a couple of days.

See the scratch build at https://koji.fedoraproject.org/koji/taskinfo?taskID=21624509 for more information (which I'm assuming will fail, just like https://koji.fedoraproject.org/koji/taskinfo?taskID=21615656 did before I added the unbound-devel stuff for res_resolver_unbound).

Sorry, I pasted the wrong link. https://koji.fedoraproject.org/koji/taskinfo?taskID=21624622 should be the latest scratch build.

You're right that the ARM patch on pjproject was broken - it wasn't removing the old error directive so it was hitting that before getting to the patched in auto-detection code. I've opened https://src.fedoraproject.org/rpms/pjproject/pull-request/1 with a fix.

I think these changes have all been addressed -- if not, feel free to open a new PR

Pull-Request has been closed by jsmith

6 years ago