Page 1 of 1

[Porting] ncurses and nano

Posted: Mon Sep 03, 2012 10:48 am
by yaucos
Hi,

I have built a cross-compiler according to the instructions on the Wiki, ported dash, and now I'd like to port ncurses and nano for my OS. I have already built ncurses: no error occured during the build process. After building it, I installed it and I could check that I had all the includes and the static libraries I needed. My ncurses version is 5.9.

However, things became a little more tricky when I tried to port nano... Indeed, at linking time I got plently of undefined references: all these references were symbols defined in libncurses.a (I could check it by analyzing the file, I disassembled it with objdump).

The linking command was the following:

Code: Select all

i586-pc-myos-gcc  -g -O2   -o nano browser.o chars.o color.o cut.o files.o global.o help.o move.o nano.o prompt.o rcfile.o search.o text.o utils.o winio.o
Then, it seemed to me that my compiler had not automatically linked the ncurses library. So it tried this :

Code: Select all

i586-pc-myos-gcc  -g -O2   -o nano /usr/local/cross/i586-pc-myos/lib/libncurses.a browser.o chars.o color.o cut.o files.o global.o help.o move.o nano.o prompt.o rcfile.o search.o text.o utils.o winio.o
But I got the same result. What could the problem be ? I'd like insist on the following point: the missing references refer to symbols which are defined in libncurses.a.

Thanks in advance.

Re: [Porting] ncurses and nano

Posted: Mon Sep 03, 2012 10:54 am
by bluemoon
Try specify the library on rightmost of the command line, gcc take dependency that way.

Re: [Porting] ncurses and nano

Posted: Mon Sep 03, 2012 11:09 am
by yaucos
Thanks. Now I don't get undefined references any longer.

Re: [Porting] ncurses and nano

Posted: Mon Sep 03, 2012 3:01 pm
by gerryg400
Bluemoon's suggestion is of course correct but it is not the perfect solution. After you build each package you should 'make install' it. This should place it in the place where your cross-GCC will find it automatically. It is a bit more work but the end result is better. As you build up your system you should be able to make and install all the standard packages with little or no changes.