I have a very strange issue. My code below works just fine when I run it via the command line but it crashes (around ps_init(config) I believe) when I double-click the executable with my mouse pointer or try to run the code inside of a Qt application. I'm running this on a Raspberry Pi 3. Can anyone tell me what is wrong?
Running it through gdb (via script so I could reproduce the behavior) it doesn't seem to technically crash. But it exits with code 01 when it calls ps_init().
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think it has something to do with the environment variables. I know running from terminal versus double-clicking the executable changes the perspective. But, if I am correct, I don't know which environment variables ps_init() depends on.
Last edit: Justin 2018-01-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have two pocketsphinx installations - old in /usr and new probably in /usr/local. You configured LD_LIBRARY_PATH to load new installation but just in terminal, not globally. Probably you added it to bash_profile but didn't relogin. So desktop software still uses old library.
You need to configure linker properly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah that would seem to be in the right direction, thank you! I had the program dump out the environment variables every time it runs.
When I type ./Jeeves in the terminal, the environment variable list shows LD_LIBRARY_PATH=/usr/local/lib as it should. But when I double click the Jeeves executable or try to run it via external qt app, the environment variable list no longer contains LD_LIBRARY_PATH so it probably is defaulting to the old stuff.
I have a very strange issue. My code below works just fine when I run it via the command line but it crashes (around ps_init(config) I believe) when I double-click the executable with my mouse pointer or try to run the code inside of a Qt application. I'm running this on a Raspberry Pi 3. Can anyone tell me what is wrong?
COMPILE CMD:
g++ -o Jeeves Jeeves.cpp 'pkg-config --cflags --libs pocketsphinx sphinxbase'
CODE:
You'd better provide a backtrace of the crash. You can collect it with gdb.
Running it through gdb (via script so I could reproduce the behavior) it doesn't seem to technically crash. But it exits with code 01 when it calls ps_init().
I think it has something to do with the environment variables. I know running from terminal versus double-clicking the executable changes the perspective. But, if I am correct, I don't know which environment variables ps_init() depends on.
Last edit: Justin 2018-01-26
I just tried running the program with my gdb script with the logs unsupressed and the last entry in the logs is this:
"FATAL: "cmn.c", line 126: Unknown CMN type 'batch'"
Can anyone tell me what's happening here?
I just tried running the program with my gdb script with the logs unsupressed and the last entry in the logs is this:
"FATAL: "cmn.c", line 126: Unknown CMN type 'batch'"
Can anyone tell me what's happening here?
You have two pocketsphinx installations - old in /usr and new probably in /usr/local. You configured LD_LIBRARY_PATH to load new installation but just in terminal, not globally. Probably you added it to bash_profile but didn't relogin. So desktop software still uses old library.
You need to configure linker properly.
Ah that would seem to be in the right direction, thank you! I had the program dump out the environment variables every time it runs.
When I type ./Jeeves in the terminal, the environment variable list shows LD_LIBRARY_PATH=/usr/local/lib as it should. But when I double click the Jeeves executable or try to run it via external qt app, the environment variable list no longer contains LD_LIBRARY_PATH so it probably is defaulting to the old stuff.
I tried adding this to /etc/bash.bashrc:
LD_LIBRARY_PATH="/usr/local/lib"
export LD_LIBRARY_PATH
PATH=$PATH:/usr/local/lib/
export PATH
Hoping it would set it globally but it seems it didn't work. How do I remedy this?
Edit /etc/ld.so.conf and run ldconfig
Thanks! Actually editing /etc/ld.so.conf on Raspbian didn't work. I tried this method here and it worked:
http://www.linuxforums.org/forum/ubuntu-linux/176983-solved-cannot-set-ld_library_path-profile-etc-profile.html
Thank you so much for your help!