-   Linux - Embedded & Single-board computer (
-   -   "top" - cross compile for arm or binaries available? (

ArnoStef 10-26-2012 07:07 AM

"top" - cross compile for arm or binaries available?
top in busybox isn't as functional as I need it. So I tried to compile "top" from source (
It compiles on my ubuntu, but I couldn't crosscompile it.

make lib64=lib CC=arm-none-linux-gnueabi-gcc gives:
top.c:28: fatal error: curses.h: No such file or directory

while adding the dir with

make CC=arm-none-linux-gnueabi-gcc CPPFLAGS=-I/usr/include

cc1: warning: include location "/usr/include" is unsafe for cross-compilation
top.c:3385: error: impossible constraint in 'asm'

I have no clue how to solve this issue. Can you help? What am I doing wrong?

Is there maybe a source for Cortex-A8 binaries that I can use - whithout installing a hole new system on my embedded device?

AnkurTank 10-26-2012 07:15 AM

I am not sure about this
I think you can try below ?
make ARCH=arm CC=arm-none-linux-gnueabi-gcc CPPFLAGS=-I/usr/include
it might work.

ArnoStef 10-26-2012 09:22 AM

Thanks AnkurTank

make ARCH=arm CC=arm-none-linux-gnueabi-gcc CPPFLAGS=-I/usr/include

will probably use the internal curses lib, which doesn't fit to the architecture. I guess this is the problem.#
And what is about this message:
cc1: warning: include location "/usr/include" is unsafe for cross-compilation

I downloaded ncurses and did
./configure --host=arm-none-linux-gnueabi

then I tried:
make CC=arm-none-linux-gnueabi-gcc CPPFLAGS=-I../ncurses-5.9/include LDFLAGS=-L../ncurses-5.9/lib


arm-none-linux-gnueabi-gcc -D_GNU_SOURCE -I proc -I../ncurses-5.9/include -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 -Wdeclaration-after-statement -Wpadded -Wstrict-aliasing -fweb -frename-registers -fomit-frame-pointer -fno-inline-functions -c -o watch.o watch.c
watch.c:18: fatal error: ncurses.h: No such file or directory

And indeed - there is no ncurse.h in the ncurses-5.9/include path?!?

theNbomr 10-26-2012 06:36 PM

You will probably need to download either a curses-devel package, or download and build the ncurses package for your target architecture.

gcc is complaining when you point it to local include directories, since those are intended for the native compiler on your build host. I have 4 cross toolchains from various origins and three of them have ncurses.h installed in the sys-root of the toolchain. My ncurses-5.8 installation doesn't seem to have the header file either. I've lost track of whether I installed that package or not, but I wonder if the header file only gets created at install time.
You can re-configure your ncurses source package with the --prefix option, pointing --prefix to a non-system directory, such as the curses source tree itself. Then, make and make install the cross-compiled package. See if it creates an include directory with ncurses.h in it. If so, either copy the contents to the sys-root of your cross toolchain, or point to it with your gcc compiler args.

Another possibility is that since there is probably a curses shared object library on your target host filesystem, you might find the respective ncurses.h there.

And, now that I've looked at the arguments you are using, I wonder if they are correct. CPPFLAGS is typically used for the C preprocessor, but I always add include paths with CFLAGS:

gcc CFLAGS+=-I /some/include/path
--- rod.

ArnoStef 11-05-2012 08:34 AM

Sorry for the delay in answering - have been ill.
I just compiled ncurses with

./configure --host=arm-none-linux-gnueabi

The missing lncurses.h is indeed created as a link with installing it. So I did this manually.

Additionally I compiled proc-tools with

make CC=arm-none-linux-gnueabi-gcc CPPFLAGS=-I../ncurses-5.9/include LDFLAGS=-L../ncurses-5.9/lib

Additionally I have to copy the created to the device under test.
The problem now is, that calling top I get:

'vt102': unknown terminal type

Other programms that has been compiled (as free) seem to work fine.

All times are GMT -5. The time now is 05:30 AM.