Problémy s kompilací Asterisku 24.0 na Arch Linux je způsobená nekompatibilitou vendored PJSIP/PJPROJECT s novější verzí OpenSSL 4.0.
Nejedná se primárně o chybu Asterisku ani o chybu kompilátoru – PJPROJECT přistupuje přímo k interním členům struktury ASN1_TIME, které už novější OpenSSL zpřístupňuje jinak.
Při kompilaci je zobrazeno chybové hlášení:
../src/pj/ssl_sock_ossl.c: In function ‘init_ossl_ctx’:
../src/pj/ssl_sock_ossl.c:1648:29: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1648 | if ((xn = X509_get_subject_name(x)) == NULL)
| ^
../src/pj/ssl_sock_ossl.c: In function ‘parse_ossl_asn1_time’:
../src/pj/ssl_sock_ossl.c:2108:13: error: invalid use of incomplete typedef ‘ASN1_TIME’ {aka ‘const struct asn1_string_st’}
2108 | utc = tm->type == V_ASN1_UTCTIME;
| ^~
../src/pj/ssl_sock_ossl.c:2109:18: error: invalid use of incomplete typedef ‘ASN1_TIME’ {aka ‘const struct asn1_string_st’}
2109 | p = (char*)tm->data;
| ^~
../src/pj/ssl_sock_ossl.c:2110:13: error: invalid use of incomplete typedef ‘ASN1_TIME’ {aka ‘const struct asn1_string_st’}
2110 | len = tm->length;
| ^~
../src/pj/ssl_sock_ossl.c: In function ‘get_cert_info’:
../src/pj/ssl_sock_ossl.c:2198:5: warning: ‘ASN1_STRING_length’ is deprecated: Since OpenSSL 4.1; use ASN1_STRING_get_length() [-Wdeprecated-declarations]
2198 | len = M_ASN1_STRING_length(X509_get_serialNumber(x));
| ^~~
In file included from ../src/pj/ssl_sock_ossl.c:46:
/usr/include/openssl/asn1.h:794:5: note: declared here
794 | int ASN1_STRING_length(const ASN1_STRING *x);
| ^~~~~~~~~~~~~~~~~~
../src/pj/ssl_sock_ossl.c:2269:21: warning: ‘ASN1_STRING_length’ is deprecated: Since OpenSSL 4.1; use ASN1_STRING_get_length() [-Wdeprecated-declarations]
2269 | len = M_ASN1_STRING_length(name->d.ip);
| ^~~
/usr/include/openssl/asn1.h:794:5: note: declared here
794 | int ASN1_STRING_length(const ASN1_STRING *x);
| ^~~~~~~~~~~~~~~~~~
make[4]: *** [/space/data/build/makepkg/asterisk/src/asterisk-24.0.0/third-party/pjproject/source/build/rules.mak:163: output/pjlib-x86_64-pc-linux-gnu/ssl_sock_ossl.o] Chyba 1
make[3]: *** [Makefile:108: libpj-x86_64-pc-linux-gnu.a] Chyba 2
make[2]: *** [Makefile:212: source/pjlib/lib/libpj-x86_64-pc-linux-gnu.a] Chyba 2
make[2]: Opouští se adresář „/space/data/build/makepkg/asterisk/src/asterisk-24.0.0/third-party/pjproject“
make[1]: *** [Makefile:47: pjproject] Chyba 2
make[1]: Opouští se adresář „/space/data/build/makepkg/asterisk/src/asterisk-24.0.0/third-party“
make: *** [Makefile:402: third-party] Chyba 2
==> CHYBA: Došlo k chybě v build().
Pro překlad je možné použít soubor PKGBUILD, který jsem získal upravením originálního, distribučního souboru:
pkgname=asterisk
pkgver=24.0.0
pkgrel=1
pkgdesc='A complete PBX solution'
arch=(x86_64 i686 aarch64 armv7h)
url=https://www.asterisk.org
license=("GPL-2.0-only")
depends=(alsa-lib
curl
jansson
libedit
libsrtp
libvorbis
libxml2
libxslt
opus
popt
speex)
makedepends=(gsm
sqlite3)
optdepends=(dahdi
gsm
libpri
libss7
lua51
openr2
postgresql
unixodbc)
_confs=(acl.conf
adsi.conf
aeap.conf
agents.conf
alarmreceiver.conf
amd.conf
app_skel.conf
ari.conf
ast_debug_tools.conf
asterisk.adsi
asterisk.conf
calendar.conf
ccss.conf
cdr.conf
cdr_adaptive_odbc.conf
cdr_beanstalkd.conf
cdr_custom.conf
cdr_manager.conf
cdr_odbc.conf
cdr_pgsql.conf
cdr_sqlite3_custom.conf
cdr_tds.conf
cel.conf
cel_beanstalkd.conf
cel_custom.conf
cel_odbc.conf
cel_pgsql.conf
cel_sqlite3_custom.conf
cel_tds.conf
chan_dahdi.conf
chan_mobile.conf
chan_websocket.conf
cli.conf
cli_aliases.conf
cli_permissions.conf
codecs.conf
confbridge.conf
config_test.conf
console.conf
dbsep.conf
dnsmgr.conf
dsp.conf
dundi.conf
enum.conf
extconfig.conf
extensions.ael
extensions.conf
extensions.lua
extensions_minivm.conf
features.conf
festival.conf
followme.conf
func_odbc.conf
geolocation.conf
hep.conf
http.conf
iax.conf
iaxprov.conf
indications.conf
logger.conf
manager.conf
meetme.conf
minivm.conf
modules.conf
motif.conf
musiconhold.conf
ooh323.conf
phoneprov.conf
phoneprov_users.conf
pjproject.conf
pjsip.conf
pjsip_notify.conf
pjsip_wizard.conf
prometheus.conf
queuerules.conf
queues.conf
res_config_mysql.conf
res_config_sqlite3.conf
res_config_odbc.conf
res_corosync.conf
res_curl.conf
res_fax.conf
res_http_media_cache.conf
res_ldap.conf
res_odbc.conf
res_parking.conf
res_pgsql.conf
res_snmp.conf
res_stun_monitor.conf
resolver_unbound.conf
rtp.conf
say.conf
sla.conf
smdi.conf
sorcery.conf
ss7.timers
stasis.conf
statsd.conf
stir_shaken.conf
telcordia-1.adsi
test_sorcery.conf
udptl.conf
unistim.conf
voicemail.conf
websocket_client.conf
xmpp.conf)
backup=("${_confs[@]/#/etc/$pkgname/}")
_archive="$pkgname-$pkgver"
source=("https://downloads.asterisk.org/pub/telephony/$pkgname/releases/$_archive.tar.gz"
"$pkgname.sysusers::https://aur.archlinux.org/cgit/aur.git/plain/asterisk.sysusers?h=asterisk"
"$pkgname.logrotated::https://aur.archlinux.org/cgit/aur.git/plain/asterisk.logrotated?h=asterisk"
"$pkgname.tmpfiles::https://aur.archlinux.org/cgit/aur.git/plain/asterisk.tmpfiles?h=asterisk"
"fix-upnp.patch::https://aur.archlinux.org/cgit/aur.git/plain/fix-upnp.patch?h=asterisk"
"openssl4-pjproject.diff::https://git.sapian.cloud/Asterisk/asterisk/raw/commit/9a3bd18d4d4c4310eef46b5e6db9d7f3d0268768/third-party/pjproject/patches/0030-openssl4.patch")
sha256sums=('ece42a75bc965180007c56b03f2fd1dc8484eb84fc4cddc090db0ee5d5da1af9'
'38a53911647fb2308482179cba605ebf12345df37eed23eb4ea67bf0bf041486'
'b97dc10a262621c95e4b75e024834712efd58561267b59b9171c959ecd9f7164'
'1b6b489d4f71015bfc56ce739d92df7e9abdb349aed6f5a47dd9c18d84546c1b'
'55798baa02698de3d81c4b6e11097b3dee73b20e9dfa1e08091a7037830ad6d8'
'SKIP')
prepare() {
cd "$_archive"
# Install OpenSSL 4 compatibility patch for bundled PJPROJECT
install -Dm644 "$srcdir/openssl4-pjproject.diff" \
third-party/pjproject/patches/0030-openssl4.patch
# Apply regular Asterisk patches
patch -p1 -N -i "$srcdir/fix-upnp.patch"
}
build() {
cd "$_archive"
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--sbindir=/usr/bin
make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1
}
_cmp() {
cmp -s \
<(IFS=$'\n'; echo "${_confs[*]}" | sort) \
<(IFS=$'\n'; echo "${_backs[*]}" | sort)
}
_comm() {
comm -3 --nocheck-order \
<(IFS=$'\n'; echo "${_confs[*]}" | sort) \
<(IFS=$'\n'; echo "${_backs[*]}" | sort)
}
package(){
cd "$_archive"
make DESTDIR="$pkgdir" install
make DESTDIR="$pkgdir" install-headers
make DESTDIR="$pkgdir" samples
# Backup file list changes frequently and is hard to keep up to date. Check
# that our current meta data matches whatever just got packaged, else flunk
# with a helpful output of where the lists differ. We have to compare twice
# because cmp has a useful exit code, comm has a useful output, neither both
local _backs=($(cd "$pkgdir/etc/$pkgname" && echo *))
_cmp || (_comm && exit 1)
sed -i -e 's,/var/run,/run,' "$pkgdir/etc/$pkgname/asterisk.conf"
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/examples" "$pkgdir/etc/$pkgname/"*
mv "$pkgdir/var/run" "$pkgdir"
pushd contrib/systemd
install -Dm644 -t "$pkgdir/usr/lib/systemd/system/" "$pkname"*.{service,socket}
pushd "$srcdir"
install -Dm644 "$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
install -Dm644 "$pkgname.logrotated" "$pkgdir/etc/logrotate.d/$pkgname"
install -Dm644 "$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
chmod 0750 "$pkgdir"/{etc,run,var/{lib,log,spool}}/"$pkgname"
}
Po vytvoření souboru je možné provést běžnou instalaci balíčků ze souboru PKGBUILD:
[user@buildmachine build]$ makepkg -Csf
