{"action":"created","issue":{"url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/35","labels_url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/35/comments","events_url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/35/events","html_url":"https://github.com/cmusphinx/pocketsphinx/issues/35","id":111985219,"number":35,"title":"Segmentation fault when running tutorial code hello_ps","user":{"login":"steowens","id":978310,"avatar_url":"https://avatars.githubusercontent.com/u/978310?v=3","gravatar_id":"","url":"https://api.github.com/users/steowens","html_url":"https://github.com/steowens","followers_url":"https://api.github.com/users/steowens/followers","following_url":"https://api.github.com/users/steowens/following{/other_user}","gists_url":"https://api.github.com/users/steowens/gists{/gist_id}","starred_url":"https://api.github.com/users/steowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steowens/subscriptions","organizations_url":"https://api.github.com/users/steowens/orgs","repos_url":"https://api.github.com/users/steowens/repos","events_url":"https://api.github.com/users/steowens/events{/privacy}","received_events_url":"https://api.github.com/users/steowens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-17T21:12:07Z","updated_at":"2015-10-17T21:15:24Z","closed_at":null,"body":"I am providing output from gdb in order to facilitate more rapid diagnosis of the issue.\r\n\r\n```\r\nGNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1\r\nCopyright (C) 2014 Free Software Foundation, Inc.\r\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\r\nand \"show warranty\" for details.\r\nThis GDB was configured as \"i686-linux-gnu\".\r\nType \"show configuration\" for configuration details.\r\nFor bug reporting instructions, please see:\r\n<http://www.gnu.org/software/gdb/bugs/>.\r\nFind the GDB manual and other documentation resources online at:\r\n<http://www.gnu.org/software/gdb/documentation/>.\r\nFor help, type \"help\".\r\nType \"apropos word\" to search for commands related to \"word\"...\r\nReading symbols from ./hello_ps...(no debugging symbols found)...done.\r\n(gdb) r\r\nStarting program: /home/thinkpad/Sphinx/helloWorld/hello_ps \r\n[Thread debugging using libthread_db enabled]\r\nUsing host libthread_db library \"/lib/i386-linux-gnu/libthread_db.so.1\".\r\n\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n0xb7fb0acd in ps_process_raw (ps=0xb7fe77aa <_dl_lookup_symbol_x+266>, data=0xbfffedd0, n_samples=512, no_search=0, full_utt=0) at pocketsphinx.c:1077\r\n1077\t    if (ps->acmod->state == ACMOD_IDLE) {\r\n(gdb) bt full\r\n#0  0xb7fb0acd in ps_process_raw (ps=0xb7fe77aa <_dl_lookup_symbol_x+266>, data=0xbfffedd0, n_samples=512, no_search=0, full_utt=0) at pocketsphinx.c:1077\r\n        n_searchfr = 0\r\n#1  0x08048917 in main ()\r\nNo symbol table info available.\r\n(gdb) Quit\r\nA debugging session is active.\r\n\r\n\tInferior 1 [process 31910] will be killed.\r\n\r\nQuit anyway? (y or n) y\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/comments/148952622","html_url":"https://github.com/cmusphinx/pocketsphinx/issues/35#issuecomment-148952622","issue_url":"https://api.github.com/repos/cmusphinx/pocketsphinx/issues/35","id":148952622,"user":{"login":"steowens","id":978310,"avatar_url":"https://avatars.githubusercontent.com/u/978310?v=3","gravatar_id":"","url":"https://api.github.com/users/steowens","html_url":"https://github.com/steowens","followers_url":"https://api.github.com/users/steowens/followers","following_url":"https://api.github.com/users/steowens/following{/other_user}","gists_url":"https://api.github.com/users/steowens/gists{/gist_id}","starred_url":"https://api.github.com/users/steowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steowens/subscriptions","organizations_url":"https://api.github.com/users/steowens/orgs","repos_url":"https://api.github.com/users/steowens/repos","events_url":"https://api.github.com/users/steowens/events{/privacy}","received_events_url":"https://api.github.com/users/steowens/received_events","type":"User","site_admin":false},"created_at":"2015-10-17T21:15:24Z","updated_at":"2015-10-17T21:15:24Z","body":"Here is the source file that produces the above error.\r\n```\r\n# include <pocketsphinx.h>\r\n\r\nint main(int argc, char *argv[]) {\r\n  \r\n\tps_decoder_t *ps;\r\n\tcmd_ln_t *config;\r\n\tFILE *fh;\r\n\tchar const *hyp, *uttid;\r\n\tint16 buf[512];\r\n\tint rv;\r\n\tint32 score;\r\n\tconst char* fileName = \"goforward.raw\";\r\n\r\n\tconfig = cmd_ln_init(NULL, ps_args(), TRUE,\r\n\t\t\t\"-hmm\", MODELDIR \"/en-us/en-us\",\r\n\t\t\t\"-lm\", MODELDIR \"/en-us/en-us.lm.bin\",\r\n\t\t\t\"-dict\", MODELDIR \"/en-us/cmudict-en-us.dict\",\r\n\t\t\tNULL);\r\n\tif(config == NULL)\r\n\t\treturn 1;\r\n\t\r\n\tfh = fopen(fileName, \"rb\");\r\n\tif(fh == NULL){\r\n\t\tfprintf(stderr, \"Unable to open: %s\", fileName);\r\n\t\treturn -1;\r\n\t}\r\n\twhile(!feof(fh)){\r\n\t\tsize_t nsamp;\r\n\t\tnsamp = fread(buf, 2, 512, fh);\r\n\t\trv = ps_process_raw(ps, buf, nsamp, FALSE, FALSE);\r\n\t}\t\r\n\trv = ps_end_utt(ps);\r\n\tif(rv < 0)\r\n\t\treturn 1;\r\n\thyp = ps_get_hyp(ps, &score);\r\n\tif(hyp == NULL)\r\n\t\treturn 1;\r\n\tprintf(\"Recognized: %s\\n\", hyp);\r\n\t\r\n\tfclose(fh);\r\n\tps_free(ps);\r\n\tcmd_ln_free_r(config);\r\n\treturn 0;\r\n}\r\n```"}}