我试图从git源编译Asterisk开源PBX,几乎在运行./configure
之后,在检查bison对parse-param的支持时遇到了一个非常异常的错误,它遇到了一种段错误,或者说是内存损坏卡在捕获的内存损坏上,该过程完全停止了。
checking for bison that supports parse-param... *** Error in `/usr/bin/bison': double free or corruption (!prev): 0x00000000011d8760 ***
*** Error in `/usr/bin/bison': malloc(): memory corruption: 0x00007f4c5affd010 ***
我不太确定是什么原因引起的,或者为什么会发生此错误。我已经安装了编译Asterisk所需的所有东西。
如果有帮助,我会跟踪该命令以及它输出给野牛的信息;
strace /usr/bin/bison
execve("/usr/bin/bison", ["/usr/bin/bison"], [/* 49 vars */]) = 0
brk(0) = 0xf28000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f48a000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=174223, ...}) = 0
mmap(NULL, 174223, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f922f45f000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\265\5\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=979056, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f45e000
mmap(NULL, 3159072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f922ef66000
mprotect(0x7f922f04c000, 2093056, PROT_NONE) = 0
mmap(0x7f922f24b000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x7f922f24b000
mmap(0x7f922f255000, 82976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f922f255000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0T\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1063328, ...}) = 0
mmap(NULL, 3158344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f922ec62000
mprotect(0x7f922ed65000, 2093056, PROT_NONE) = 0
mmap(0x7f922ef64000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x102000) = 0x7f922ef64000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=88408, ...}) = 0
mmap(NULL, 2184224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f922ea4c000
mprotect(0x7f922ea61000, 2093056, PROT_NONE) = 0
mmap(0x7f922ec60000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7f922ec60000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\36\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1853400, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f45d000
mmap(NULL, 3961912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f922e684000
mprotect(0x7f922e841000, 2097152, PROT_NONE) = 0
mmap(0x7f922ea41000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f922ea41000
mmap(0x7f922ea47000, 17464, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f922ea47000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f45c000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f45a000
arch_prctl(ARCH_SET_FS, 0x7f922f45a740) = 0
mprotect(0x7f922ea41000, 16384, PROT_READ) = 0
mprotect(0x7f922ec60000, 4096, PROT_READ) = 0
mprotect(0x7f922ef64000, 4096, PROT_READ) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f922f459000
mprotect(0x7f922f24b000, 32768, PROT_READ) = 0
mprotect(0x7f922f48b000, 4096, PROT_READ) = 0
munmap(0x7f922f45f000, 174223) = 0
write(2, "/usr/bin/bison: no grammar file "..., 38/usr/bin/bison: no grammar file given
) = 38
exit_group(1) = ?
+++ exited with 1 +++
最佳答案
查看星号源代码,看来您实际上不需要Bison即可进行编译。通常它将使用已经生成的C文件代替。如果崩溃导致配置脚本无法运行完成,请使用./configure BISON=/bin/true
运行该脚本,并使其完成。
或者,您可以下载最新的GNU bison源代码,进行编译,安装,然后使用BISON=/path/to/bison
将Asterisk配置脚本指向它。我建议通过发行版所使用的任何版本的bison ++获取常规的GNU bison源。 GNU版本可能没有相同的错误,并且更有可能具有配置脚本正在测试的“parse-param”功能。
该错误似乎已在Ubuntu错误跟踪器中报告:https://bugs.launchpad.net/ubuntu/+source/bison++/+bug/80975
关于c++ - 野牛malloc内存损坏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25561333/