1

I tracked down my issue to the following point. If I run my app by itself it works fine. However if I chroot it, it seems to work fine until the current game ends and then it core dumps calling the refresh() function. Can someone give me some pointers on what the refresh() function might be needing that is not in the chroot environment?

I have this code calling it:

move(My_pos.y, My_pos.x);
printw("AARRrrgghhhh....");
move(My_pos.y+1, My_pos.x); /* ZZZ */
printw("before refresh"); /* ZZZ */
refresh();
move(My_pos.y+1, My_pos.x); /* ZZZ */
printw("done with refresh"); /* ZZZ */

The ZZZ lines are what proves the error - the "before refresh" works either way, but the "done with refresh" only occurs in the non-chroot call. In the chroot it core dumps...

Any ideas?

4

You might have copied only the high-level library, e.g., libncurses.so or libncursesw.so, but Debian (and derived distributions such as Ubuntu) configure it with two libraries (libtinfo.so, libtinfow.so, etc.). The actual filename probably ends with the major/minor version such as

libncursesw.so.6.0

The refresh makes ncurses try to update the actual display; that uses the low-level library. The high-level library does its work in memory.

Responding to the followup discussion (which should be a new question),

  • you can "always" build ncurses with static libraries, but then you would have to re-link any application using ncurses.
  • to troubleshoot problems with shared libraries, you might find it helpful to have ldd and strace working inside the chroot, to (a) demonstrate that the pathnames are where they are expected, and (b) the correct filenames are executed.

If your application was linked only with "ncurses", e.g.,

gcc -o foo foo.c -lncurses

then the linker might not complain (since some packagers set the linker options to permit this), but running ldd on the shared library could show a problem,

ldd libncurses.so.6.0

The strace program could show which files (including loading shared libraries) the program attempts/succeeds.

  • Going to try building a version statically linked and see if that works around it.. – Marisa Giancarla Nov 17 '17 at 4:37
  • Ok, statically linked is a no go. I don't have static libs for some libraries so i can't build it that way. Anywhere i could upload the structure to show whats going on? – Marisa Giancarla Nov 17 '17 at 5:58
  • Also I checked the links and inside the chroot dir I have both versions of the dynamic libraries – Marisa Giancarla Nov 17 '17 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.