RPM construído no mesmo sistema operacional convidado, segfaults em outro host (Asterisk)

1

Eu construí um RPM para o Asterisk 13 para o Centos 7 usando uma VM de compilação em execução no OSX (MacBook, usando o Parallels). Isso é com a intenção de usar este RPM em nossos sistemas de controle de qualidade e produção.

No entanto, após instalar o RPM em um dos servidores de controle de qualidade, segfaults de asterisco imediatamente na inicialização e não são executados. O servidor de controle de qualidade é outra VM do Centos 7 rodando em uma CPU Intel com um host Centos usando o KVM (Qemu).

Meu arquivo de especificação do RPM é:

%define _prefix /usr/local
%define _ver    13.4.0
%define _unpackaged_files_terminate_build 0
%define debug_package %{nil}

Name:          asterisk
Version:       %{_ver}
Release:       1
Summary:       Asterisk
Vendor:        Asterisk
Packager:      Amir Abiri <???>
Source:        http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-%{_ver}.tar.gz
URL:           http://www.asterisk.org/
Group:         Applications/Multimedia
BuildRequires: ncurses-devel
BuildRequires: libuuid-devel
BuildRequires: jansson-devel
BuildRequires: sqlite-devel

%description
-

%prep
%setup

%build
./configure
make

%install
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p "$RPM_BUILD_ROOT/usr/lib/systemd/system"
cp %{_topdir}/PATCHES/asterisk/asterisk.service "$RPM_BUILD_ROOT/usr/lib/systemd/system"

%post
/sbin/ldconfig 2>/dev/null
systemctl enable asterisk

%postun
/sbin/ldconfig 2>/dev/null
systemctl disable asterisk

%files
%defattr (-,root,root)
/usr/sbin/*
/usr/lib/asterisk/*
/usr/lib/libasteriskssl.so*
%exclude /usr/include/asterisk*
/usr/lib/systemd/system/asterisk.service
/var/lib/asterisk/*
/usr/share/man/*

A versão do GCC é:

4.8.3 20140911 (Red Hat 4.8.3-9)

A cpuinfo da compilação VM (host do OSX) é:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 70
model name  : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
stepping    : 1
cpu MHz     : 2194.000
cache size  : 6144 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat xsaveopt pln pts dtherm fsgsbase bmi1 avx2 smep bmi2 invpcid
bogomips    : 4388.00
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

O cpuinfo da VM do servidor de controle de qualidade é:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 13
model name  : QEMU Virtual CPU version 1.5.3
stepping    : 3
microcode   : 0x1
cpu MHz     : 3092.836
cache size  : 4096 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 4
wp      : yes
flags       : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl pni cx16 hypervisor lahf_lm abm
bogomips    : 6185.67
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Se eu executar o asterisco sagfaulting através de strace, a última metade da saída de strace é:

clone(child_stack=0x7f5d487c3f70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f5d487c49d0, tls=0x7f5d487c4700, child_tidptr=0x7f5d487c49d0) = 4583
mmap(NULL, 507904, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f5d486cd000
mprotect(0x7f5d486cd000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f5d48747f70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f5d487489d0, tls=0x7f5d48748700, child_tidptr=0x7f5d487489d0) = 4584
open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 6
fcntl(6, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
getuid()                                = 0
getppid()                               = 4569
read(6, "2Dm23n347,5mw0", 16) = 16
close(6)                                = 0
gettid()                                = 4572
stat("/etc/asterisk/codecs.conf", 0x7fffc4362f20) = -1 ENOENT (No such file or directory)
mmap(NULL, 507904, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f5d48651000
mprotect(0x7f5d48651000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f5d486cbf70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f5d486cc9d0, tls=0x7f5d486cc700, child_tidptr=0x7f5d486cc9d0) = 4585
mmap(NULL, 507904, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f5d485d5000
mprotect(0x7f5d485d5000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f5d4864ff70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f5d486509d0, tls=0x7f5d48650700, child_tidptr=0x7f5d486509d0) = 4586
brk(0)                                  = 0x1993000
brk(0x19b4000)                          = 0x19b4000
open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 6
fcntl(6, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
getuid()                                = 0
getppid()                               = 4569
read(6, "171U77G4@26r10r", 16) = 16
close(6)                                = 0
gettid()                                = 4572
stat("/etc/asterisk/modules.conf", {st_mode=S_IFREG|0644, st_size=2768, ...}) = 0
open("/etc/asterisk/modules.conf", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=2768, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5d4b6ab000
read(6, "[modules]\nautoload = no\n\n; This "..., 4096) = 2768
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0x7f5d4b6ab000, 4096)            = 0
stat("/etc/asterisk/features.conf", 0x7fffc4362ea0) = -1 ENOENT (No such file or directory)
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0x5d5a57} ---
+++ killed by SIGILL (core dumped) +++
    
por Amir Abiri 30.07.2015 / 10:07

1 resposta

1

Você precisará desativar a opção BUILD_NATIVE se quiser construir em uma máquina e executá-la em outra.

Na sua seção% build, tente:

./configure
make menuselect.makeopts
menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts
make
    
por 31.07.2015 / 01:20

Tags