Compiling gnuradio on Raspberry pi using distcc - makefile

I want to compile gnuradio on Raspberry Pi with a fresh copy of Raspbian wheezy. I have a setup of distcc with an i7 to offload the work from RPi.
It works well with a simple test file when I use
$gcc -c hello.c
I can see that the task is done in the log of the other computer.
BUT, when I want to build gnuradio and invoke the 'make' command, distcc doesn't even produce any output in the verbose mode.
Trying
$distcc make
produces this:
distcc[5464] (dcc_scan_args) compiler apparently called not for compile
and continues building on the localhost.
Is there a way around this ?

Do you have $DISTCC_HOSTS set in the shell you're calling make from? Have you specified -j for multiple jobs? What is the result of which gcc and echo $CC?
If you follow the directions here you can see that gcc, cc, etc. are symlinked into /usr/local/bin as references to /usr/bin/distcc, which he then added to the beginning of his path so that make would find it first.
It can also be helpful to export DISTCC_VERBOSE=1 to provide more output. There's more thorough documentation on this rPi stackexchange answer.

Distcc can't redistribute all of the work done my make onto other machines. Some of it, such as linking, has to be made locally. Hence the "called not for compile" messages.

Related

How to check which components are compiled by which server when using distcc

I've got a distccd daemon running on two servers.
One (call it A, .12) serves as the master, while the other (call it B, .11) serves as a slave:
Settings on A:
vim ~/.distcc/hosts
# contents of ~/.distcc/hosts
localhost
192.168.1.11,cpp,lzo
Settings on B:
distccd --daemon --allow 192.168.1.12 --log-file /home/nhlee/distcc.log
"ps aux | grep distcc" to check that it's running
Then I build something with:
pump make -j xxx
And it tells me that:
__________Using distcc-pump from /usr/bin
__________Using 2 distcc servers, of which only 1 support(s) pump mode
...
__________Shutting down distcc-pump include server
However, the time spent is nearly the same. I'm not sure if there is way to check which components were compiled by which host.
I turned on the monitor with:
distccmon-text 1
I tried this on both machines, and both show me empty lines only.
I looked in /var/look/messages, but there is nothing related to distcc.
I checked in the log file, which is also empty.
How can I see how my files are being
compiled?
#
So I checked with top on both machines, and it turns out that all files were compiled on the master's local (A). I'm not sure why there isn't any error, though.
I also tried removing 'localhost' from ~/.distcc/hosts, but the results are still the same.
OK, so I tried a few things and solved the problem. And I ran into some new issues that I'd like to share as well.
First, I did
export CC=/usr/bin/distcc
export CXX=/usr/bin/distcc
to let CMake know that I wanted to use distcc instead of gcc/g++.
This was the main problem. After I did this things were showing up in the monitor.
I had two versions of gcc/g++ installed on my machine, an older version under /usr/bin/ that did not support C++11, and a newer one that did.
Though my LD_LIBRARY_PATH had the new one's path in the front, somehow distcc wasn't finding the older one first. Thus I ran into some compile errors saying that -std=c++11 wasn't recognized.
## The following solved this issue:
sudo yum remove /usr/bin/g++
sudo yum remove /usr/bin/gcc
There were linking errors when I used distcc, but not when I used g++ directly:
# Add a simple one-line script (mine was called /usr/bin/distg++)
distcc g++ "$#"
Then add "-DCMAKE_CXX_COMPILER=distg++" to your CMake command:
cmake ... -DCMAKE_CXX_COMPILER=distg++

how to identify whether mingw compiled library with success

i'm tackling the problem of compiling vmime library using this guide with MinGW. As this guide states, first i need to compile libiconv library with these commands(yep i'm new to MinGW):
$ tar -xvvzf libiconv-1.13.1.tar.gz
$ cd ./libiconv-1.13.1
$ ./configure --prefix=/mingw #configures makefile, use /mingw as a prefix
$ make
$ make install
after all this commands the libiconv.dll.a appears in libiconv-1.13.1\lib.libs
directory.Also after compiling process appears the /bin directory and there is only 1 library - libcharset-1.dll.
My question is - how do i know if the library properly compiled, without errors?Should i check the output from the MSYS console? there are tons of checks, it seems pretty boring task. Thanks in advance, glad to hear any advice!
You're building a GNU Autotools package.
./configure generates the makefile(s) needed by make to build the library
on your particular system. If it thinks the library can't be built on your particular
system, it will tell you why. It might just miss some reason why you can't build
the library, because the library developer(s) have to script the tests that it runs, and might
just overlook some necessary ones. But if it misses something then make will fail.
make executes all the commands necessary to build the library on your system. If any of them fail,
then make will fail, and will tell you so unmistakably.
Likewise make install does everything necessary to install the library
under the default or specified prefix path.
Classically, unix tools (like the autootols) will inform you when something goes wrong
and not inform you that nothing went wrong.

Reliable build of the Linux Kernel for the BeagleBone Black

Is there a reliable build of the Linux kernel for the BeagleBone Black platform anywhere ? I've followed the instructions here, as well as numerous other places, and none of them work. Either the modules don't build (the .ko files just don't get built and can't be found in the case of the link above), or there's missing build targets for the kernel. I'm using the Linaro ARM compiler (arm-linux-gnueabihf-gcc) cross compiling on 32-bit x86 Ubuntu 14.04.
Specifically, I've checked out the source at the BeagleBone Git repository, branches 3.8, 3.11, 3.12, 3.13 and 3.14. I've also checked out a 3rd party git clone here. The problems I've encountered are as follows:
3.8: Kernel will compile (with numerous warnings), but the modules fail to compile due to errors in the patching process from running patch.sh in the branch.
3.11: Kernel will compile (with numerous warnings), but the uImage-dtb.am335x-boneblack Make target will not. Compiling modules fails due to at least one file having an incorrect patch that yields incorrect C syntax.
3.12: Kernel will compile (with numerous warnings), along with the modules. Copying kernel and modules to the board succeeds. Booting the kernel fails, and freezes as soon as the bootup begins right out of the boot command in U-Boot.
3.13, 3.14: The kernel compilation fails with numerous syntax errors.
3.8.13+ from TowerTech: The kernel compilation succeeds (with numerous warnings), the module compilation fails, again due to incorrect patching from patch.sh.
In the cases where I could compile a kernel, I copied it to a fresh, vanilla board in memory using a TFTP boot server from U-Boot, and booted the kernel in memory. However, none of the successfully compiled kernels could work properly because they were missing their modules / firmware / dtbs. What could be causing the incorrect patching ? Surely, the developers who've written the code and patches must have tested it, so there may be something wrong with my workspace, though I can't imagine what at this point. The commands I used were the same as those at link 1.
I also followed the link you have mentioned and I am able to boot the BBB. I am using the mainline kernel from https://www.kernel.org/. The following are the steps I followed
Download the latest kernel. My version is 3.18-rc4
Use "omap2plus_defconfig" which is the default config for beaglebone black
Make commands are
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap2plus_defconfig -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4.
The image produced is present in the following path.
arch/arm/boot/uImage uImage
arch/arm/boot/dts/am335x-boneblack.dtb
After this compile the modules.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
I was using busybox and NFS server as root
Compiler used is arm-linux-gnueabi-gcc. With this I am able to boot successfully and run modules. It has the advantage that we are using the latest kernel available.
I was finally able to boot the BBB with a new kernel 3.14
I am on a beagleboneblack rev C with debian pre-installed.
I basically followed steps here
http://dev.ardupilot.com/wiki/building-for-beaglebone-black-on-linux/
Kernel download: (I didn't use git, limited bandwidth...)
https://github.com/beagleboard/linux/archive/3.14.tar.gz
Build (done on a Ubuntu 14.04) : (I am not sure if some steps are not relevant or redundant)
Install mkimage
sudo apt-get install libssl-dev
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2014.10/
make sandbox_defconfig tools-only
sudo install tools/mkimage /usr/local/bin
Download am335x-pm-firmware.bin from http://arago-project.org/git/projects/?p=am33x-cm3.git;a=tree;f=bin;h=75a5de7aa94ff6ccbfb1b3b9dc80bc2fe5b423bf;hb=refs/heads/master and copy to kernel directory
Build the kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x-boneblack.dtb -j4
Install Modules
mkdir -p ../export/rootfs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=../export/rootfs/ modules_install
Now copy modules to /lib/modules/ directory in your beaglebone black (create a new directory for the modules)
cd ../export/rootfs/lib/modules/
rsync -avz 3.14.25/ root#192.168.1.3:/lib/modules/3.14.25/
Next is to copy the zImage and am335x-boneblack.dtb to the BBB
copy zImage from arch/arm/boot to /boot/uboot/ of BBB
copy am335x-boneblack.dtb from arch/arm/boot/dts to /boot/uboot/dtbs
If you replace the existing zImage and am335x-boneblack.dtb with new ones directly and they don't work, you will be in trouble. I stored the new images in a folder in /boot/uboot and manipulated environment variables in uboot to pick the one i wanted.
I know, I could have used tftpserver..
I hope it helps someone. I spent a lot of time on this which should have been very straightforward :(
Yeah, the documentation is really out of date (circa 2011 or early 2012) and very confusing. First, the github/beagleboard/kernel area says it is deprecated and to use beagleboard/linux for the kernel. BUT, it is still be actively used 1) to add patches that have not been accepted to the kernel tree yet and 2) to add kernel configs specifically for the beaglebone devel builds. The bb.org_defconfig in the kernel tree does not turn on some debug stuff.
So.. both github/beagleboard/linux AND github/beagleboard/kernel work for me (3.14) on a BBB. If you want a standard image, use "linux"; if you want a bells-and-whistles image use "kernel".
Also, a more recent cross-compiler is in APT at gcc-arm-linux-gnueabihf. Make sure you have the "hf" (hard floating point unit) version. No need to depend on linaro.
I'll update the docs after I get the project rolling....

Linux wifi backports cross compile

I am trying to backport Linux wifi drivers from 3.11 to linux-omap-l1(2.6.39). I set up the cross compiler on my Ubuntu 11.4 (kernel is 2.6.38-11-generic) and verified that the cross-compiled kernel can run on an ARM processor as expected. I also was able to backport the wifi drivers to this Ubuntu by following the "Usage Guide" section. However, I have problem to cross compile the wifi backports. Here are two attempts I did:
Attempt#1
Following the "Cross compiling" section from the same link above, I set ARCH(=arm), CROSS_COMPILER, KLIB_BUILD(=linux-omap-l1 directory) and KLIB(=linux-omap-l1 directory), ran make defconfig-wifi, then ran make -j4. It finished without any error. However when I check the generated ko files, they are apparently not cross compiled because they look like "rt2x00usb.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped"
Attempt#2
Then I cleaned the old make result and passed the above four macros directly to make as arguments and ran it again. This time it reported many errors complaining of missing printk.h, atomic.h and average.h
Please help with either of the cases above.
Well, I here post the rt2800usb wifi solution for other's reference. The following steps cross-compiled successfully:
Menuconfig linux-omap-l1(2.6.39) kernel to disable Networking Support -> Wireless, build it and boot it to the embedded unit to ensure the readiness
Run “make mrproper” from the backports directory on the build pc (Ubuntu 11.4)
Run the following sript from the build pc. Ensure the KLIB pointed directory pre-exists, otherwise create it
set -a
CROSS_COMPILE="/opt/arm-2009q1/bin/arm-none-linux-gnueabi-"
ARCH=arm
KLIB_BUILD="/home/xxx/linux-omap-l1"
KLIB="/home/xxx/linux-omap-l1/updates"
set +a
make defconfig-wifi
make oldconfig # menuconfig worked here too
make
make install
Copy the compiled binaries and modules into the unit(10.11.2.3)
scp -r /home/xxx/linux-omap-l1/updates/lib/modules/2.6.39.4-00537-g6c21e4a root#10.11.2.3:/lib/modules/2.6.39.4/.
Log into the embedded unit and run “modprobe -v -f rt2800usb”
Download and install rt2800usb firmware to the /lib/firmware if necessary
lsmod to verify the driver can be loaded
insert the usb dongle (the udev rules may need to be created or modified)
use iw to further examine its properties
backports is unable to pickup my kernel config.....mac80211 is set to module in my kernel config, when I search for mac80211 in backport's menu config, it shows disabled. Tried the above....
set -a
CROSS_COMPILE="/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-"
ARCH=arm
KLIB_BUILD="/home/xxx/rpm/BUILD/linux"
KLIB="/home/xxx/rootfs/lib/modules/2.6.35.3-998-ga1cd8a7/updates"
set +a
make defconfig-wifi
make menuconfig
I found this to be sucessfull...
make defconfig-wifi CROSS_COMPILE=/home/xxx/Downloads/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux/bin/arm-linux-gnueabi- ARCH=arm KLIB_BUILD=/home/xxx/Downloads/linux-3.10/ KLIB=/home/xxx/Downloads/rootfs/
make menuconfig CROSS_COMPILE=/home/xxx/Downloads/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux/bin/arm-linux-gnueabi- ARCH=arm KLIB_BUILD=/home/xxx/Downloads/linux-3.10/ KLIB=/home/xxx/Downloads/rootfs/
make CROSS_COMPILE=/home/xxx/Downloads/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux/bin/arm-linux-gnueabi- ARCH=arm KLIB_BUILD=/home/xxx/Downloads/linux-3.10/ KLIB=/home/xxx/Downloads/rootfs/

cl.h not found - how to link in makefile

I have a project which requires opencl. I have installed CUDA and openCL on my machine but when I 'make' my project the following error occurs:
CL/cl.h: No such file or directory
I know that the i can create a hard link (in my unix (ubuntu) system) to fix the problem:
ln -s /usr/include/nvidia-current/CL
But i consider this a quick fix and not the correct solution. I would like to handle this in my makefile (i guess) so that a simple "make" command would compile. How could I do this?
You need to pass an appropriate -I option to the compiler (by setting CPPFLAGS or CFLAGS, for example). -I/usr/include/nvidia-current sounds like it'd work.
I saw this thread from compile opencl program using CL/cl.h file
I installed 7.5 and added below link in /usr/include, it works for my opencl program. looks like CUDA forget to implement this link after the installation.
ln -s /usr/local/cuda-7.5/include/CL /usr/include
Are you using Ubuntu or Debian distro? Then now you can use this package:
sudo apt-get install opencl-headers

Resources