Bug 222047

Summary: emulators/dynamips-community crashes when using the JIT compiler. Runs fine without it (-j flag)
Product: Ports & Packages Reporter: opens.services <openss.services>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: bofh
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   

Description opens.services@gmail.com 2017-09-04 11:44:01 UTC
When running dynamips it crashes every time with the following error:

blades@ryzen:~/GNS3/images/IOS % dynamips c7200-adventerprisek9-mz.124-11.t1.image 
Cisco Router Simulation Platform (version 0.2.16-amd64/FreeBSD stable)
Copyright (c) 2005-2011 Christophe Fillot.
Build date: Sep  4 2017 10:42:56

IOS image file: c7200-adventerprisek9-mz.124-11.t1.image

CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
NVRAM is empty, setting config register to 0x2142
C7200 instance 'default' (id 0):
  VM Status  : 0
  RAM size   : 256 Mb
  IOMEM size : 0 Mb
  NVRAM size : 128 Kb
  NPE model  : npe-400
  Midplane   : vxr
  IOS image  : c7200-adventerprisek9-mz.124-11.t1.image

Loading ELF file 'c7200-adventerprisek9-mz.124-11.t1.image'...
ELF entry point: 0x80008000

C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
ROMMON emulation microcode.

Bus error (core dumped)
---------------------

gdb show the following:
(gdb) down
#4  0x0000000801268c4b in strftime_l (s=0x7fffde5f0ca8 "Sep ", maxsize=<value optimized out>, 
    format=0x48c14d "%b %d %H:%M:%S", t=0x7fffde5f0c70, loc=0x80151b3e8)
    at /usr/src/lib/libc/stdtime/strftime.c:99
99		p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, loc);
(gdb) down
#3  0x0000000801268e8a in _fmt (format=<value optimized out>, t=0x7fffde5f0c70, 
    pt=0x7fffde5f0cac "", ptlim=0x7fffde5f0da8 "�\231�^\003�\025^", warnp=0x7fffde5f0c14, 
    loc=0x80151b3e8) at /usr/src/lib/libc/stdtime/strftime.c:595
595		(void) sprintf_l(buf, loc, format, n);
(gdb) down
#2  0x00000008012bec51 in sprintf_l (str=<value optimized out>, locale=<value optimized out>, 
    fmt=<value optimized out>) at /usr/src/lib/libc/stdio/sprintf.c:70
70		ret = vsprintf_l(str, locale, fmt, ap);
(gdb) down
#1  0x00000008012c0f76 in vsprintf_l (str=0x7fffde5f0b88 "�\v_��\177", locale=0x80151b3e8, 
    fmt=0x8012e4d30 "%02d", ap=0x7fffde5f0ac8) at /usr/src/lib/libc/stdio/vsprintf.c:60
60		ret = __vfprintf(&f, locale, fmt, ap);
(gdb) down
#0  0x000000080126f364 in __vfprintf (fp=0x7fffde5f08a0, locale=0x80151b3e8, 
    fmt0=0x8012e4d30 "%02d", ap=0x7fffde5f0ac8) at /usr/src/lib/libc/stdio/vfprintf.c:471
471		va_copy(orgap, ap);
(gdb) down
Bottom (i.e., innermost) frame selected; you cannot go down.


FreeBSD 11.1 and 11.2 RELEASE are effected.

On a personal note I would love to get this running so I can run VMs in GNS3 2.0.3!
Comment 1 commit-hook freebsd_committer 2017-09-22 11:43:27 UTC
A commit references this bug:

Author: bofh
Date: Fri Sep 22 11:43:13 UTC 2017
New revision: 450356
URL: https://svnweb.freebsd.org/changeset/ports/450356

Log:
  emulators/dynamips-community: Update version 0.2.16=>0.2.17

  - Add OPTION DOCS
  - Fix build with NOJIT [1]

  PR:		222047 [1]
  Reported by:	openss.services@gmail.com [1]

Changes:
  head/emulators/dynamips-community/Makefile
  head/emulators/dynamips-community/distinfo
  head/emulators/dynamips-community/files/patch-CMakeLists.txt
  head/emulators/dynamips-community/files/patch-common_dynamips.c
  head/emulators/dynamips-community/files/patch-common_net__io.c
Comment 2 Muhammad Moinur Rahman freebsd_committer 2017-09-22 11:44:58 UTC
For the time being it has been solved. I just need to dig more with the issue. The CMAKE environment variables were not properly passed to the build environment which have been fixed. But need to dig more.