Hi everyone,
This is the third post on the cross-compile series for DroboFS.
Introduction: Why ncurses?
Ncurses is one of the most used libraries for command-line software. We’ll use it later on for compiling screen, nano, wget, rtorrent, and so on.
Overall compiling complexity: Hard. Really, this one is a pain in the b***. Do not feel bad if you don’t manage at first, because neither did I.
Step 1: Background info
To be able to make use of this post, you need a VM configured as indicated in this post.
Step 2: Enter the cross-compiling environment
See step 2 of this post to see instructions on how to enter the chroot environment.
Step 3: Get the source code
zlib’s website: http://ftp.gnu.org/gnu/ncurses/
Version: 5.7
Direct link: http://ftp.gnu.org/gnu/ncurses/ncurses-5.7.tar.gz
Make sure that you are in the folder /root/code, then type:
wget http://ftp.gnu.org/gnu/ncurses/ncurses-5.7.tar.gz
tar zxf ncurses-5.7.tar.gz
cd ncurses-5.7
Step 4: Configuration
Configuration for ncurses is a bit more complex than for zlib, but nothing crazy:
./configure --host=arm-none-linux-gnueabi --prefix=/usr/arm
This should return no errors.
Step 5: Compiling
Within the folder /root/code/ncurses-5.7:
make
Again, there should be no errors. If any errors are reported, make sure you performed steps 3 and 4 correctly. If you still have errors, make sure that the VM is properly configured (e.g. like I did the first time around, when I got the wrong toolchain, or forgot to ‘export’ the proper compiler flags).
Step 6: Installing
Now, here comes the problem. Until this step everything should be working fine. Here is where things will get complicated.
In summary, we will split the install step in two. The reason for this is that ncurses is not very cross-compile friendly, and thus tries to perform installation steps that are not possible in the cross-compile environment. In fact, if you naively try to just call make install, the process will hang and will be stuck at 100% CPU usage. No way out but to CTRL+C it.
This is not a drobo-only issue, and happens for pretty much all platforms (for the hard-core linux people out there: it seems that the install procedure tries to call the local ‘tic’ instead of the cross-platform one).
Someone with more experience than me will probably find a more elegant solution to this problem, but the way I did was as follows:
nano misc/run_tic.sh
…and comment lines 101 to 140. This means that the following lines should be commented out:
[code]#if test “$ext_funcs” = 1 ; then
#cat <<EOF
#Running tic to install $TERMINFO …
You may see messages regarding extended capabilities, e.g., AX.
These are extended terminal capabilities which are compiled
using
tic -x
If you have ncurses 4.2 applications, you should read the INSTALL
document, and install the terminfo without the -x option.
#EOF
#if ( $SHLIB tic$suffix -x -s -o $TERMINFO $source )
#echo $SHLIB tic$suffix -x -s -o $TERMINFO $source
#then
echo '** built new '$TERMINFO
#else
echo '? tic could not build '$TERMINFO
exit 1
#fi
#else
#cat <<EOF
#Running tic to install $TERMINFO …
You may see messages regarding unknown capabilities, e.g., AX.
These are extended terminal capabilities which may be compiled
using
tic -x
If you have ncurses 4.2 applications, you should read the INSTALL
document, and install the terminfo without the -x option.
#EOF
#if ( $SHLIB tic$suffix -s -o $TERMINFO $source )
#then
echo '** built new '$TERMINFO
#else
echo '? tic could not build '$TERMINFO
exit 1
#fi
#fi
[/code]
In other words, we remove all calls to tic.
Now we can do the traditional install step:
make install
…which will place the compiled library and some extra stuff under /usr/arm.
Then we package the whole /usr/arm and copy it over to the DroboFS, as indicated on step 9 here.
We are not done yet, though. The final steps are:
[list=1]
[]Copy the file /root/code/ncurses-5.7/misc/terminfo.tmp (edit: fixed path) to /mnt/DroboFS/Shares/DroboApps/arm, or to /mnt/DroboApps/arm/ if you have the DroboFS share mounted locally (edit: added local mount path).
[]Within an SSH session on the DroboFS, execute:
cd /mnt/DroboFS/Shares/DroboApps/arm
tic -x -s -o /usr/arm/share/terminfo terminfo.tmp
[/list]
This will perform the remaining steps to install ncurses.
Congratulations!
Now you can cross-compile any application that uses ncurses, since the required headers are libraries are present in /usr/arm both in the VM and on the Drobo.
As usual, corrections, feedback and suggestions are welcome.
Changelog:
Oct 3rd: Fixed comment section, terminfo.tmp source path and added path for DroboFS share mount. Thanks to ZenCocoon for the feedback.