[Porting] ncurses and nano

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yaucos
Member
Member
Posts: 26
Joined: Sat Jul 28, 2012 5:27 am

[Porting] ncurses and nano

Post 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.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: [Porting] ncurses and nano

Post by bluemoon »

Try specify the library on rightmost of the command line, gcc take dependency that way.
yaucos
Member
Member
Posts: 26
Joined: Sat Jul 28, 2012 5:27 am

Re: [Porting] ncurses and nano

Post by yaucos »

Thanks. Now I don't get undefined references any longer.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: [Porting] ncurses and nano

Post 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.
If a trainstation is where trains stop, what is a workstation ?
Post Reply