This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Listing threads: procps cross compile issue

The busybox ps command doesn't have the option to list the threads. So I am trying to cross compile procps and port ps onto the target board (OMAP L138 based eXp board running Davinci code base). But it fails during compilation. Here is the command I run and few lines from the compilation error.

procps-3.2.8# make  CC=arm-none-linux-gnueabi-gcc CPPFLAGS= lib64=lib m64=

arm-none-linux-gnueabi-gcc -D_GNU_SOURCE -I proc  -fno-common -ffast-math -W -Wall -Wshadow -Wcast-align -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -O2 -s         -c -o top.o top.c
top.c:28:20: error: curses.h: No such file or directory
top.c:38:18: error: term.h: No such file or directory
top.c:72: error: 'COLOR_RED' undeclared here (not in a function)
top.c:72: error: 'COLOR_YELLOW' undeclared here (not in a function)
top.c:72: error: 'COLOR_CYAN' undeclared here (not in a function)
top.c:72: error: 'COLOR_WHITE' undeclared here (not in a function)
top.c:72: error: 'COLOR_MAGENTA' undeclared here (not in a function)
top.c:72: error: 'COLOR_BLUE' undeclared here (not in a function)
top.c:72: error: 'COLOR_GREEN' undeclared here (not in a function)
top.c:72: warning: missing initializer
top.c:72: warning: (near initialization for 'Rc.win')
top.c: In function 'tg2':
top.c:316: warning: implicit declaration of function 'tgoto'
top.c:316: error: 'cursor_address' undeclared (first use in this function)
top.c:316: error: (Each undeclared identifier is reported only once
top.c:316: error: for each function it appears in.)
top.c:316: warning: pointer/integer type mismatch in conditional expression

Here it fails while building top. so was I even trying to modify the Makefile to remove other binaries and keep only ps. But I am surprised I didnt see any reference to ps in the list of binaries there. Cross compiling ps seemed a fairly common affir. But I couldn't find any post for this in any forum. May be there is an alternative to list threads in an embedded Linux environment. Even that would satisfy my requirement instead of cross compiling ps.

  • I haven't been able to resolve this cleanly. But I could build ps for the target board by tweaking the Makefile. I removed the targets those were dependent on curses, for example 'top', 'watch' and 'slabtop'. Then it worked fine. That means I will run into the same problem, if ever I need to run 'top' on the target board. So I am still looking for a resolution.

    Here I am putting the steps in case somebody needs.

    Download the sourcecode from http://procps.sourceforge.net/download.html and untar

    Remove top, watch and slabtop from the BINFILES variable in the Makefile and run the make for the target.

    host # make CPPFLAGS= lib64=lib m64= CC=arm-none-linux-gnueabi-gcc

    Download the libproc library and the binaries you need to the target. I use NFS and needed only ps.

    host # sudo install -p ps/ps /home/asabat/targetfs/usr/bin/

    host # sudo install -p proc/libproc-3.2.8.so /home/asabat/targetfs/usr/lib/

    target # # /usr/bin/ps -eLo ppid,pid,tid,class,rtprio,stat,comm

    You can run even a simple option for ps like 'ps -eLf' and you may even need to ldconfig after copying library.