Difference between revisions of "Compile Software for the Humax"
(Fix cross-compiler link and other grammar/punctuation) |
|||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Compiling on-box == | == Compiling on-box == | ||
− | It is possible to compile some software directly on the Humax itself, however due to the limited amount of CPU horsepower available, this is only recommended for fairly small packages. | + | It is possible to compile some software directly on the Humax itself, however, due to the limited amount of CPU horsepower available, this is only recommended for fairly small packages. |
− | First you need to install the ''gcc'' and ''gawk'' packages. ''gcc'' is the compiler itself and automatically pulls in dependant packages | + | First you need to install the ''gcc'' and ''gawk'' packages. ''gcc'' is the compiler itself and automatically pulls in dependant packages. ''gawk'' is needed to properly support packages which use GNU autoconf, which most do. |
<pre> | <pre> | ||
− | humax# opkg install gcc gawk | + | humax# opkg install gcc gawk gmake |
</pre> | </pre> | ||
− | After this, close your telnet session | + | After this, close your telnet session, open a new one to set up the environment properly, and you are ready to compile your first piece of software on the Humax. |
+ | |||
+ | === Warning: Problems with floating-point numbers === | ||
+ | |||
+ | Whilst programs that use floating-point number functions such as rint() may compile OK on the Humax box, they may not produce the correct results on execution. | ||
+ | |||
+ | This appears to be because the on-box compilers are configured to use software floating-point libraries rather than hardware floating-point. | ||
+ | You can use compiler option ''-mhard-float'' to overcome the problem, but this does generate warning messages from the compiler. | ||
+ | |||
+ | Until this problem is resolved it is best to use the cross-compiler (see below) for code that requires floating-point numbers. | ||
=== Example - compiling the GNU zip (gzip) program === | === Example - compiling the GNU zip (gzip) program === | ||
Line 34: | Line 43: | ||
humax# cd gzip-1.4 | humax# cd gzip-1.4 | ||
− | humax# CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ./configure --prefix=/mod | + | humax# CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \ |
+ | ./configure --prefix=/mod --build=mipsel-linux | ||
checking for a BSD-compatible install... /mod/bin/busybox/install -c | checking for a BSD-compatible install... /mod/bin/busybox/install -c | ||
checking whether build environment is sane... yes | checking whether build environment is sane... yes | ||
Line 51: | Line 61: | ||
</pre> | </pre> | ||
+ | == Cross-compiling on an external host == | ||
+ | |||
+ | To cross-compile code to run on the Humax you need another Linux system on which to run the compiler. If you don't have another spare Linux box lying around, you can run it on a standard Windows system using VirtualBox. Oracle provide a number of [http://www.oracle.com/technetwork/server-storage/linux/downloads/vm-for-hol-1896500.html pre-configured Linux systems] which can be downloaded to prevent the need for a full Linux install. You may need to update BIOS settings to enable the virtual machine to run (on HP System Configuration -> Device Configurations Enable Virtualization technology VT-x) | ||
+ | |||
+ | The actual cross-compiler is available from the [https://uk.humaxdigital.com/open-source/ HUMAX open source download site] with the specific package needed being entitled '''crosstools_hf-linux-2.6.18.0_gcc-4.2-11ts_uclibc-nptl-0.9.29-20070423_20090508.tar.bz2''' | ||
+ | |||
+ | Once downloaded to your Linux system, the file needs to be extracted under ''/opt/toolchains/'' and your path set up appropriately. | ||
+ | |||
+ | Hint: due to the excessively long path and file names, use symlinks to create shortcuts. | ||
+ | |||
+ | To reduce the hassle of building software libraries such as ''libsndfile'', copy the relevant headers and libraries across from the Humax box. | ||
− | + | If running on a 64 bit Linux system you may experience error messages when compiling such as "bad ELF interpreter: No such file or directory" due to missing 32 bit libraries. See [http://www.howtodoityourself.org/how-to-fix-libld-linux-so-2-bad-elf-interpreter-no-such-file-or-directory.html here] for how to fix. |
Latest revision as of 23:23, 12 June 2023
Contents
Compiling on-box
It is possible to compile some software directly on the Humax itself, however, due to the limited amount of CPU horsepower available, this is only recommended for fairly small packages.
First you need to install the gcc and gawk packages. gcc is the compiler itself and automatically pulls in dependant packages. gawk is needed to properly support packages which use GNU autoconf, which most do.
humax# opkg install gcc gawk gmake
After this, close your telnet session, open a new one to set up the environment properly, and you are ready to compile your first piece of software on the Humax.
Warning: Problems with floating-point numbers
Whilst programs that use floating-point number functions such as rint() may compile OK on the Humax box, they may not produce the correct results on execution.
This appears to be because the on-box compilers are configured to use software floating-point libraries rather than hardware floating-point. You can use compiler option -mhard-float to overcome the problem, but this does generate warning messages from the compiler.
Until this problem is resolved it is best to use the cross-compiler (see below) for code that requires floating-point numbers.
Example - compiling the GNU zip (gzip) program
humax# cd /mod/tmp humax# wget http://ftp.gnu.org/gnu/gzip/gzip-1.4.tar.gz --2011-08-18 16:39:58-- http://ftp.gnu.org/gnu/gzip/gzip-1.4.tar.gz Resolving ftp.gnu.org... 140.186.70.20 Connecting to ftp.gnu.org|140.186.70.20|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 907411 (886K) [application/x-gzip] Saving to: `gzip-1.4.tar.gz' 100%[======================================>] 907,411 225K/s in 4.2s 2011-08-18 16:40:03 (210 KB/s) - `gzip-1.4.tar.gz' saved [907411/907411] humax# tar -xvf gzip-1.4.tar.gz gzip-1.4/ gzip-1.4/zgrep.1 gzip-1.4/configure.ac ... humax# cd gzip-1.4 humax# CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \ ./configure --prefix=/mod --build=mipsel-linux checking for a BSD-compatible install... /mod/bin/busybox/install -c checking whether build environment is sane... yes ... humax# make Making all in lib make[1]: Entering directory `/mnt/hd2/mod/tmp/gzip-1.4/lib' GEN alloca.h GEN arg-nonnull.h ... humax# ./gzip -V gzip 1.4 Copyright (C) 2007 Free Software Foundation, Inc.
Cross-compiling on an external host
To cross-compile code to run on the Humax you need another Linux system on which to run the compiler. If you don't have another spare Linux box lying around, you can run it on a standard Windows system using VirtualBox. Oracle provide a number of pre-configured Linux systems which can be downloaded to prevent the need for a full Linux install. You may need to update BIOS settings to enable the virtual machine to run (on HP System Configuration -> Device Configurations Enable Virtualization technology VT-x)
The actual cross-compiler is available from the HUMAX open source download site with the specific package needed being entitled crosstools_hf-linux-2.6.18.0_gcc-4.2-11ts_uclibc-nptl-0.9.29-20070423_20090508.tar.bz2
Once downloaded to your Linux system, the file needs to be extracted under /opt/toolchains/ and your path set up appropriately.
Hint: due to the excessively long path and file names, use symlinks to create shortcuts.
To reduce the hassle of building software libraries such as libsndfile, copy the relevant headers and libraries across from the Humax box.
If running on a 64 bit Linux system you may experience error messages when compiling such as "bad ELF interpreter: No such file or directory" due to missing 32 bit libraries. See here for how to fix.