[SOLVED] Ncurses based program had to be recompiled on a different PC, same OS
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
On an Ubuntu Server I am running, I wrote a small Ncurses program in GCC. It worked just fine.
Then, I copied the executable over to my Ubuntu 10.10 desktop edition with sftp. No matter what I did, it kept giving the error:
error opening terminal: xterm.
I had copied other non-curses programs and they all ran just fine.
Finally, I copied over the source, recompiled with GCC and voila, the executable now runs fine.
Why?
Find "error opening terminal" message in source, understand the context, i.e. what the program was actually trying to do, what checks it performed, what check failed, etc., and you'll find an answer to your 'why' question.
Distribution: Ubuntu Server lucid, Ubuntu Desktop maverick
Posts: 15
Original Poster
Rep:
Sorry Sergei,
I'm not understanding your advice. The error message is coming from the OS. It is not something I coded in to the source. The program ran on my server where I originally compiled it. I need to know why an executable copied to another machine would refuse to work unless recompiled. The OS's are supposed to be the same. Therefore, I should be able to copy programs from one machine to another and they should run. That was true with my programs that only used stdio, but the one with ncurses functions had to be recompiled.
Q: Finally, I copied over the source, recompiled with GCC and voila, the executable now runs fine.
Why?
A: In the words of a wise philosopher:
"Ca-ca happens "
Quote:
I'm not understanding your advice
I think Sergei was chastising you for transcribing "error opening terminal" instead of cut/pasting "Error opening terminal" (capital-E), making it slightly harder for him to "grep" for the error. No biggie, and certainly nothing to do either with your question or his response.
Quote:
The OS's are supposed to be the same. Therefore, I should be able to copy programs from one machine to another and they should run.
In this case, a dependent library caused the init_scr() failure.
Perhaps something similar happened in your case. And perhaps simply re-linking the program created a different set of dependencies, all of which were satisifed on your system. It's hard to tell.
I wouldn't lose too much sleep worrying about it, and I'd be reasonably confident that the next curses program you copied to a different PC might work just fine as-is.
Distribution: Ubuntu Server lucid, Ubuntu Desktop maverick
Posts: 15
Original Poster
Rep:
OK, I understand; somewhat. If terminfo is not loaded correctly a curses program cannot start. I did try loading ncurses and running the executable; yet, still received the same error. This answers my question, but will also raise others.
Thanks for ya'lls help. I might eventually learn how to post questions according to the rules.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.