docker-raspberry-pi-cross-compiler icon indicating copy to clipboard operation
docker-raspberry-pi-cross-compiler copied to clipboard

Update Raspbian image?

Open aeppert opened this issue 9 years ago • 12 comments

The default Raspbian image that is present has grown rather old, especially with regard to repositories underlying it. There needs to be an automated mechanism for updating the image.

aeppert avatar Nov 18 '16 21:11 aeppert

Do you mean the sysroot that is pulled in from https://github.com/sdhibit/docker-rpi-raspbian ? I believe that image gets built on a raspberry pi, so might be tricky to build in docker.

I've added an apt-get upgrade step to the Dockerfile to upgrade the raspbian packages.

Does that do what you need @aeppert ?

sdt avatar Nov 19 '16 06:11 sdt

That certainly helps.

Has there been a change in the sysroot though for installing gcc, etc for raspbian? I noticed rpdo, which seems to call the appropriate gcc if I do "rpxc rpdo gcc", however otherwise the sysroot seems to be wrong?

aeppert avatar Nov 23 '16 22:11 aeppert

When you say "raspbian image", are you referring to the cross-compile toolchain?

ie. this https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64

sdt avatar Nov 23 '16 22:11 sdt

Correct. I want to be able to use the raspbian cross-compiler toolchain that was installed via "install-raspbian gcc" when I built a new image based on your example.

On Wed, Nov 23, 2016 at 5:18 PM, Stephen Thirlwall <[email protected]

wrote:

When you say "raspbian image", are you referring to the cross-compile toolchain?

ie. this https://github.com/raspberrypi/tools/tree/master/ arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sdt/docker-raspberry-pi-cross-compiler/issues/21#issuecomment-262643777, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6UgNv1KGAFJCYNyFANMPgZpN4ZCEeks5rBLuvgaJpZM4K285n .

aeppert avatar Nov 23 '16 22:11 aeppert

I made a bunch of changes a while back to make rpxc work properly with full-blown autotools/configure/make projects. I've just realised that's made doing simple things less simple.

If you're just trying to cross-compile some of your own code, here's an example.

  1. Save this as hw.c
#include <stdio.h>
int main() {
    printf("Hello, world!\n");
    return 0;
}
  1. Compile this with: rpxc arm-linux-gnueabihf-gcc -o hw hw.c

  2. Copy hw to your raspberry pi and run it.

This uses the x64-native cross compiler. The install-raspbian command is more intended for installing somelib-dev type packages as build-time dependencies.

You could also create a Makefile like below and then just run rpxc make

CC=${CROSS_COMPILE}gcc
hw: hw.c
    $(CC) -o hw hw.c

sdt avatar Nov 23 '16 22:11 sdt

Ah perfect. So I was on the right path, but wanted to make sure I wasn't over complicating things myself.

On Nov 23, 2016, at 5:53 PM, Stephen Thirlwall [email protected] wrote:

I made a bunch of changes a while back to make rpxc work properly with full-blown autotools/configure/make projects. I've just realised that's made doing simple things less simple.

If you're just trying to cross-compile some of your own code, here's an example.

Save this as hw.c #include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } Compile this with: rpxc arm-linux-gnueabihf-gcc -o hw hw.c

Copy hw to your raspberry pi and run it.

This uses the x64-native cross compiler. The install-raspbian command is more intended for installing somelib-dev type packages as build-time dependencies.

You could also create a Makefile like below and then just run rpxc make

CC=${CROSS_COMPILE}gcc hw: hw.c $(CC) -o hw hw.c — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

aeppert avatar Nov 23 '16 23:11 aeppert

One more note - have you generated Raspbian Debian packages via this docker image and the inclusive raspbian image?

On Nov 23, 2016, at 5:53 PM, Stephen Thirlwall [email protected] wrote:

I made a bunch of changes a while back to make rpxc work properly with full-blown autotools/configure/make projects. I've just realised that's made doing simple things less simple.

If you're just trying to cross-compile some of your own code, here's an example.

Save this as hw.c #include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } Compile this with: rpxc arm-linux-gnueabihf-gcc -o hw hw.c

Copy hw to your raspberry pi and run it.

This uses the x64-native cross compiler. The install-raspbian command is more intended for installing somelib-dev type packages as build-time dependencies.

You could also create a Makefile like below and then just run rpxc make

CC=${CROSS_COMPILE}gcc hw: hw.c $(CC) -o hw hw.c — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

aeppert avatar Nov 24 '16 01:11 aeppert

I haven't.

sdt avatar Nov 24 '16 01:11 sdt

Cross-compiler is working appropriately. However, I am failing, painfully, to get the newly built image with the requisite Raspbian libraries for what I am trying to build (I modified the rpxc script to point to my new Docker image too). How do I point the cross-compiler to the sysroot inside the docker image? Failing that, I will just have to build them freestanding, which brings me 180degrees back to the way I use to build cross-compilers anyway.

aeppert avatar Dec 01 '16 16:12 aeppert

Could you make a gist or something of what you're trying to do?

sdt avatar Dec 03 '16 01:12 sdt

Just getting back to this after months on another project. Do you have an example exercising the Raspbian packages installed? I absolutely need to link against those and have a host of them installed, including libpcap, as a definitive example I need to link against. My final binary will be hosted on Raspbian and I will end up putting together a .deb for it all.

aeppert avatar Feb 06 '17 05:02 aeppert

Both the axel and qtbase examples link against raspbian packages.

https://github.com/sdt/docker-raspberry-pi-cross-compiler/blob/master/example/axel/Dockerfile https://github.com/sdt/docker-raspberry-pi-cross-compiler/blob/master/example/qtbase/Dockerfile

Do you have a repo or gist or something I could look at?

sdt avatar Feb 07 '17 06:02 sdt