MIPS Cross Compilation on Travis - c

How would one setup a .travis.yml to do cross compilation for MIPS target ? For PowerPC, this is trivial:
addons:
apt:
packages:
- gcc-powerpc-linux-gnu
Since I have access to the package directly.
For MIPS I cannot find a compiler for it in Ubuntu Trusty:
Software Packages in "trusty", Subsection devel
Even though it appears to be whitelisted:
https://github.com/travis-ci/apt-package-whitelist/commit/5761eccc#diff-3583c6522a64da63a272436df8de85ceR1311
It seems I would need an updated Ubuntu image (not possible on Travis):
GNU C compiler for the mips architecture
The alternate solution would be to use some pre-build MIPS compiler, eg:
Sourcery CodeBench Lite 2013.11-36 for MIPS GNU/Linux
But documentation rather explicitely says not to cache those things:
Caching Dependencies and Directories#Things not to cache
Large files that are quick to install but slow to download do not
benefit from caching, as they take as long to download from the cache
as from the original source:
Android SDKs
Debian packages
JDK packages
Compiled binaries
Docker images
How would you install a mips cross compiler on the default Ubuntu Travis image ?
Update I tried a naive solution:
addons:
apt:
sources:
- debian-sid
packages:
- gcc-mips-linux-gnu
But this fails with:
dpkg-deb: error: archive '/var/cache/apt/archives/gcc-7-base_7.2.0-18_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/gcc-7-base_7.2.0-18_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 2
It seems dpkg in Ubuntu/Trusty will not support those deb files:
xz compressed control.tar files not supported

It seems I cannot use container based because of this requirement, I gave up and simply used:
sudo: true
dist: trusty
addons:
apt:
packages:
- u-boot-tools
before_install:
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
- sudo apt-get -qq update
- sudo apt-get install -qq gcc-mips-linux-gnu
I am still intrigued by the fact that gcc-mips-linux-gnu is explicitly white-listed.

Related

Error when trying to do (sudo apt install flex bison): The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt [duplicate]

I was watching this, and, as you can see, the first command I am told to put in is:
sudo apt-get install python-setuptools
When I do this, it outputs:
sudo: apt-get: command not found
I have no idea why this is the case.
How can I resolve this so I am following the tutorial correctly?
Mac OS X doesn't have apt-get. There is a package manager called Homebrew that is used instead.
This command would be:
brew install python
Use Homebrew to install packages that you would otherwise use apt-get for.
The page I linked to has an up-to-date way of installing homebrew, but at present, you can install Homebrew as follows:
Type the following in your Mac OS X terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After that, usage of Homebrew is brew install <package>.
One of the prerequisites for Homebrew are the XCode command line tools.
Install XCode from the App Store.
Follow the directions in this Stack Overflow answer to install the XCode Command Line Tools.
Background
A package manager (like apt-get or brew) just gives your system an easy and automated way to install packages or libraries. Different systems use different programs. apt and its derivatives are used on Debian based linux systems. Red Hat-ish Linux systems use rpm (or at least they did many, many, years ago). yum is also a package manager for RedHat based systems.
Alpine based systems use apk.
Warning
As of 25 April 2016, homebrew opts the user in to sending analytics by default. This can be opted out of in two ways:
Setting an environment variable:
Open your favorite environment variable editor.
Set the following: HOMEBREW_NO_ANALYTICS=1 in whereever you keep your environment variables (typically something like ~/.bash_profile)
Close the file, and either restart the terminal or source ~/.bash_profile.
Running the following command:
brew analytics off
the analytics status can then be checked with the command:
brew analytics
As Homebrew is my favorite for macOS although it is possible to have apt-get on macOS using Fink.
MacPorts is another package manager for OS X:.
Installation instructions are at The MacPorts Project -- Download & Installation after which one issues sudo port install pythonXX, where XX is 27 or 35.
Conda can also be used as package manager. It can be installed from Anaconda.
Alternatively, a free minimal installer is Miniconda.
apt-get command is only available on Debian or Debian-based Linux distributions (such as Ubuntu, Linux Mint, Kali). It is not accessible on macOS. Alternatively, you can use package managers like Homebrew, MacPorts, and Nix. You can find equivalent commands for each as follows
brew install package_name
sudo port install package_name
nix-env -i package_name
Before installing above package managers, you need to install XCode first. Follow the operation instructions from this guide How to Fix "sudo apt-get command not found" Error on Mac Terminal.
Alternatively You can use the brew or curl command for installing things, wherever apt-get is mentioned with a URL...
For example,
curl -O http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz

How to list/download the recursive BUILD dependencies of a debian package?

I've recently learned that one can use apt to download sources and easily amend, re-build, and install the package locally from Cinnamon volume step and media keys.
# Download the sources
apt source cinnamon-settings-daemon
cd cinnamon-settings-daemon-4.4.0+tricia
# Then install the build dependencies
apt build-dep cinnamon-settings-daemon
#Then build from the modified sources
apt build
Install the modified deb file (again note the version string may differ for different Cinnamon versions)
apt deb ~/cinnamon-settings-daemon_4.4.0+tricia_amd64.deb
I now also want to be able to just download all packages needed for apt build-dep as for binary package install How to list/download the recursive dependencies of a debian package?. However, when I've tried to use --download-only and then install debs files, it resulted in several other files needed:
The following additional packages will be installed:
libarchive-cpio-perl libcupsfilters-dev libicu66:i386 libltdl-dev
libmail-sendmail-perl libpng-tools libpulse0:i386 libsys-hostname-long-perl
Even $ apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances cinnamon-settings-daemon | grep "^\w" | sort -u does not list e.g. libarchive-cpio-perl and also --download-only when I tried to substitute empty dmkg status file ($(apt-config shell STATUS Dir::State::status)) and downloaded ~500 files, not ~100, that "additional" file(s) is(are) still missing.
Added 1:
I added --no-install-recommends to apt install debs and now only two i386 remained in additional not downloaded:
The following additional packages will be installed:
libicu66:i386 libpulse0:i386
Any idea what is so special about them? These are the only i386 mentioned, 1st one listed in apt cache above. 2nd not listed, so combining two deb sets is not a way to solve.
I downloaded debs with dpkg status file corresponding to a system with less packages installed than one where I tried to install later. I assumed it ensures all required are downloaded. However, as I received an answer after facing same issue with regular (not build, sources) packages, it is not so: https://unix.stackexchange.com/a/684975/446998. Additionally installed packages included some i386 architecture packages with corresponding amd64 packages among downloaded debs, so i386 required upgrade too when amd64 were installed as needed to be kept in sync.

How do I package up go code as an arm RPM?

I've got a go project that I'm building on OSX. I've compiled it for arm linux by using docker to run the linux compiler and GOARCH=arm64 to generate arm code. now I want to package it up as an RPM.
The problem is that I can't figure out how to get rpmbuild to give me an arm package. I've tried setting --target arm, --target arm64, --target arm-test-linux, and --target arm64-test-linux
All produce the same result,
file project.arm.rpm => project.arm.rpm: RPM v3.0 bin noarch
How do I get it to recognize the architecture instead of producing a noarch rpm?
use the BuildArch option in your spec file:
BuildArch: arm64
rpmbuild -bs project.spec
This will create project.src.rpm. And then:
sudo dnf install qemu-user-static
mock -r fedora-33-aarch64 project.src.rpm
which will use this feature: https://github.com/rpm-software-management/mock/wiki/Feature-forcearch
With the recent version of Mock you do not even need to specify --forcearch as it automatically detected.
If you omit the BuildArch then it will be automatically set using the chroot you use as a parameter for Mock.
BTW here is general guidance about packaging Go as an RPM. https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/

Install arm-poky-linux-gnueabi toolchain on PC

There are 2 compilers used in IMX7(ARM Yocto Linux):
arm-poky-linux-gnueabi-gcc
arm-poky-linux-gnueabi-g++
When I build complete image by spending about 2 hours its already downloaded.
But I would like to know how to install this tool chain directly on PC(Ubuntu/CentOS) and use it as separate compiler in PC instead of with its Image as I mentioned above.
Use below command in your ubuntu pc
$ sudo apt-get install gcc-arm-linux-gnueabihf
$ sudo apt-get install g++-arm-linux-gnueabihf

opencv install folder on ubuntu

I installed opencv2.3 on ubuntu by first adding the ppa and the doing apt-get install
$ sudo add-apt-repository ppa:gijzelaar/cuda
$ sudo add-apt-repository ppa:gijzelaar/opencv2.3
$ sudo apt-get update
$ sudo apt-get install libopencv-dev
I am developing on Eclipse and my programs work. I have this one problem though, while following an ebook. I cannot find the /opencv/samples folder in my system. I did a unix directory search to no avail.
Also, in Synaptic Package Manager I find that the opencv packages are not marked green, ie they're not installed. However I have written and executed opencv codes on my machine.
What is the reason for this?
It seems you have installed binary OpenCV package while the samples are (most likely) included only to source package.

Resources