LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   "top" - cross compile for arm or binaries available? (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/top-cross-compile-for-arm-or-binaries-available-4175434181/)

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 (http://procps.sourceforge.net/index.html)
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
./make

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

but

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:
Code:

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
make

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 libproc-3.2.8.so 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.

jissj 11-10-2015 11:53 PM

top command error
 
Quote:

Originally Posted by ArnoStef (Post 4822570)
Sorry for the delay in answering - have been ill.
I just compiled ncurses with

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

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 libproc-3.2.8.so 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.

I have got a similar error when I am trying to run newly cross compiled top.
My error is "terminals database is inaccessible". I think both errors are due to terminal access problem. Did you fixed your issue? If so it will be help full for me also. Hope you will reply soon.

pan64 11-11-2015 02:38 AM

no, that is no terminal access problem, but unknown terminal type. Terminal database contains the information related to the commands used to move cursor, scroll and similar. You may try to start top in xterm or other, known terminal emulator (at least I think so).

jissj 11-11-2015 08:30 PM

Quote:

Originally Posted by pan64 (Post 5447950)
no, that is no terminal access problem, but unknown terminal type. Terminal database contains the information related to the commands used to move cursor, scroll and similar. You may try to start top in xterm or other, known terminal emulator (at least I think so).

I tried xterm too. But its same. I tried many terminal types such as linux,teraterm etc by changing environment variable TERM and in all case same error happened.

pan64 11-12-2015 01:47 AM

because changing the variable will not change the capabilities the actual/real terminal you use.


All times are GMT -5. The time now is 09:12 PM.