Skip to content

Commit fa819ef

Browse files
authored
Merge pull request #1 from arduino/bump-deps
Bump deps
2 parents 47fd24e + d2430b9 commit fa819ef

File tree

493 files changed

+62370
-110485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

493 files changed

+62370
-110485
lines changed

Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
2323
pkg-config \
2424
tar \
2525
unzip \
26+
llvm \
2627
&& rm -rf /var/lib/apt/lists/*
2728
# Install toolchains in /opt
2829
RUN curl downloads.arduino.cc/tools/internal/toolchains.tar.gz | tar -xz "opt"
2930
# install proper arm toolchains (already present in the toolchains.tar.gz archive)
3031
# curl -L 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz' | tar -xJC /opt && \
3132
# curl -L 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz' | tar -xJC /opt
3233

33-
RUN cd /opt/osxcross \
34-
git pull \
35-
# use a specific version of osxcross (it does not have tags)
36-
git checkout da2c3d4ff604458a931b08b3af800c5a454136de \
37-
UNATTENDED=1 SDK_VERSION=10.15 ./build.sh
34+
RUN cd /opt/osxcross && \
35+
git pull && \
36+
# use a specific version of osxcross (it does not have tags), this commit has the automatic install of compiler_rt libraries
37+
git checkout b875d7c1360c8ff2077463d7a5a12e1cff1cc683 && \
38+
UNATTENDED=1 SDK_VERSION=10.15 ./build.sh && \
39+
ENABLE_COMPILER_RT_INSTALL=1 SDK_VERSION=10.15 ./build_compiler_rt.sh
3840
# Set toolchains paths
3941
# arm-linux-gnueabihf-gcc -> linux_arm
4042
# aarch64-linux-gnu-gcc -> linux_arm64
@@ -59,6 +61,7 @@ RUN CROSS_COMPILE=x86_64-ubuntu16.04-linux-gnu /opt/lib/build_libs.sh && \
5961
FROM ubuntu:latest
6062
# Copy all the installed toolchains and compiled libs
6163
COPY --from=build /opt /opt
64+
COPY --from=build /usr/lib/llvm-10/lib/clang/10.0.0 /usr/lib/llvm-10/lib/clang/10.0.0
6265
ENV TZ=Europe/Rome
6366
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
6467
apt-get update && \

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Docker crossbuild
22

3-
This docker container has been created to allow us to easily crosscompile the c++ tools starting from this repo. The idea comes from [multiarch/crossbuild](https://github.com/multiarch/crossbuild), but this container unfortunately is outdated, the apt sources are no longer available.
3+
This docker container has been created to allow us to easily crosscompile our c++ tools. The idea comes from [multiarch/crossbuild](https://github.com/multiarch/crossbuild), but that container unfortunately is outdated and the apt sources are no longer available.
44

55
## Starting Image
6-
The starting image is [ubuntu:latest](https://hub.docker.com/_/ubuntu) (The ubuntu:latest tag points to the "latest LTS", since that's the version recommended for general use.) at the time of writing latest points to Ubuntu 20.04 focal.
6+
The starting image is [ubuntu:latest](https://hub.docker.com/_/ubuntu) (The ubuntu:latest tag points to the "latest LTS", since that's the version recommended for general use.) at the time of writing latest points to Ubuntu 22.04 jammy.
77

88
The starting image is only marginally important, since internally we use manually installed toolchains.
99

@@ -18,21 +18,20 @@ Inside that archive there are:
1818

1919
Regarding the two ubuntu toolchains: in the beginning we tried to use the ones shipped with 12.04 but they caused some build errors because they were too old, so we upgraded to 16.04 ones. They are created using [crosstool-ng](https://github.com/crosstool-ng/crosstool-ng).
2020

21-
2221
Apparently, osxcross does not have tags or version so we checkout a specific commit in order to have a pinned environment.
2322

2423
The last toolchain required to crosscompile for windows is `mingw-w64` and it's installed through `apt` along with other useful packages.
2524

26-
Once the toolchains are installed in `/opt` we add the binaries to the `PATH` env variable, to easily call them in the CI.
25+
Once the toolchains are installed in `/opt` we add the binaries to the `PATH` env variable, to easily use them in the CI.
2726

2827
## Copying and Building Libraries
29-
As explained in the other [`README.md`](deps/README.md) there are some libraries that needs to be compiled. This is achieved by copying `deps/` directory inside `/opt/lib/` in the container and then by using [`build_libs.sh`](deps/build_libs.sh) script [here](Dockerfile#L47-L55)
28+
As explained in the other [`README.md`](deps/README.md) there are some libraries that needs to be compiled, in order to create static binaries. This is achieved by copying `deps/` directory inside `/opt/lib/` in the container and then by using [`build_libs.sh`](deps/build_libs.sh) script [here](Dockerfile#L53-L59)
3029

3130
## Multi-stage build
32-
To reduce the overall dimesion of the docker image we used the [multi-stage build](https://learnk8s.io/blog/smaller-docker-images).
31+
To reduce the overall dimension of the docker image we used the [multi-stage build](https://learnk8s.io/blog/smaller-docker-images). But the image still 8GB.
3332

3433
## How to build and use the container
3534
Usefull commands you can use:
36-
- `docker build -t ghcr.io/arduino/crossbuild:<version> docker/` to build the container
35+
- `docker build -t ghcr.io/arduino/crossbuild:<version> .` to build the container
3736
- `docker push ghcr.io/arduino/crossbuild:<version>` to push the image to [github remote registry](https://docs.github.com/en/packages/guides/container-guides-for-github-packages)
38-
- `docker run -it --name crossbuild -v $PWD:/workdir ghcr.io/arduino/crossbuild:<version>` to get a shell inside the container and use the toolchains available inside (like the CI does).
37+
- `docker run -it --name crossbuild -v $PWD:/workdir ghcr.io/arduino/crossbuild:<version>` to get a shell inside the container and use the toolchains available inside (just like the CI does).

deps/README.md

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,18 @@
11
# Dependencies
2-
The `deps/` folder contains the dependencies used to build and link statically `picotool` and `elf2uf2`: the libraries `libusb` and `libudev`.
3-
The `deps/` folder contains also a bash script used by the docker container to successfully build them with different toolchains and with different targets.
4-
This way they are already compiled and usable by the CI during the building/linking phase!
2+
The `deps/` folder contains the library dependencies used to build and link statically tools, like `picotool` and `elf2uf2` (the libraries `libusb` and `libudev`...).
3+
The `deps/` folder contains also a bash script used by the [Dockerfile](../Dockerfile) to successfully build them with different toolchains and with different targets.
4+
This way they are ready when used by the CI during the building/linking phase!
55

6-
They come respectively from [here](https://github.com/arduino/OpenOCD-build-script/tree/static/libusb-1.0.20)
7-
and from [here](https://github.com/gentoo/eudev)
6+
They come from:
7+
- https://github.com/gentoo/eudev
8+
- https://github.com/libusb/hidapi
9+
- https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz/
10+
- https://www.intra2net.com/en/developer/libftdi/index.php
11+
- https://github.com/libusb/libusb
12+
- https://github.com/libusb/libusb-compat-0.1
13+
- https://ftp.gnu.org/gnu/ncurses/
14+
- https://ftp.gnu.org/gnu/readline/
815

916
## `build_libs.sh`
10-
`build_libs.sh` is used by the [Dockerfile](../Dockerfile#L49-L55):
17+
`build_libs.sh` is used by the [Dockerfile](../Dockerfile#L53-L59):
1118
Basically during the docker build phase the libraries are compiled with every toolchain available in the Docker container. Other libraries can be added, the [`build_libs.sh`](build_libs.sh) script needs to be adapted, but the Dockerfile should be ok.
12-
13-
## libusbudev
14-
libusbudev is the result of merging the two `.a` files with a command line tool called `ar`. This is done to ease the linking phase done by the [CI](.github/workflows/release.yml#L87) passing a single static library. See `LIBUSBUDEV` env variable [here](../../.github/workflows/release.yml#L67) and [here](../../.github/workflows/release.yml#L71).
15-
For macos is not required to merge the two libraries because libudev is not a requirement, so macos uses `libusb.a` only: thus the distinction between the two platforms. Infact libusb for mac is the last one built in the [Dockerfile](../Dockerfile#L55).
16-
17-
`libusbudev.a` is created by the `build_libs.sh` the directory structure created is the following:
18-
19-
```
20-
/opt/lib/
21-
|-- aarch64-linux-gnu
22-
| |-- libudev
23-
| |-- libusb
24-
| `-- libusbudev.a
25-
|-- arm-linux-gnueabihf
26-
| |-- libudev
27-
| |-- libusb
28-
| `-- libusbudev.a
29-
|-- build_libs.sh
30-
|-- eudev-3.2.10
31-
|-- i686-ubuntu16.04-linux-gnu
32-
| |-- libudev
33-
| |-- libusb
34-
| `-- libusbudev.a
35-
|-- i686-w64-mingw32
36-
| |-- libudev
37-
| |-- libusb
38-
| `-- libusbudev.a
39-
|-- libusb-1.0.20
40-
`-- x86_64-ubuntu16.04-linux-gnu
41-
|-- libudev
42-
|-- libusb
43-
`-- libusbudev.a
44-
```
45-
46-
The original `libusb.a` is available in `/opt/lib/libusb-1.0.20/libusb/.libs/libusb-1.0.a`
47-
and `libudev.a` is available in `/opt/lib/eudev-3.2.10/src/libudev/.libs/libudev.a`

deps/build_libs.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export CXX=$CROSS_COMPILER++
1212
CROSS_COMPILER=$CC
1313
CROSS_COMPILER_CXX=$CXX
1414
fi
15-
cd /opt/lib/libusb-1.0.20
15+
cd /opt/lib/libusb-1.0.26
1616
export LIBUSB_DIR=`pwd`
17-
./configure --prefix=${PREFIX} --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
17+
./configure --prefix=${PREFIX} --with-pic --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
1818
make distclean
19-
./configure --prefix=${PREFIX} --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
20-
make
19+
./configure --prefix=${PREFIX} --with-pic --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
20+
make -j$(nproc)
2121
make install
2222

2323
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
@@ -36,12 +36,12 @@ else
3636
export LIBUSB_1_0_CFLAGS=-I${PREFIX}/include/libusb-1.0
3737
export LIBUSB_1_0_LIBS="-L${PREFIX}/lib -lusb-1.0"
3838
fi
39-
cd /opt/lib/libusb-compat-0.1.5
39+
cd /opt/lib/libusb-compat-0.1.7
4040
export LIBUSB0_DIR=`pwd`
4141
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure --prefix=${PREFIX} --enable-static --disable-shared --host=${CROSS_COMPILE}
4242
make distclean
4343
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" ./configure --prefix=${PREFIX} --enable-static --disable-shared --host=${CROSS_COMPILE}
44-
make
44+
make -j$(nproc)
4545
make install
4646
fi
4747

@@ -59,15 +59,15 @@ if [[ $CROSS_COMPILE == "x86_64-apple-darwin13" ]]; then
5959
fi
6060

6161
cmake -DCMAKE_C_COMPILER=$CROSS_COMPILER -DCMAKE_CXX_COMPILER=$CROSS_COMPILER_CXX -DCMAKE_INSTALL_PREFIX="$PREFIX" $CMAKE_EXTRA_FLAG -DLIBUSB_INCLUDE_DIR="$PREFIX/include/libusb-1.0" -DLIBFTDI_LIBRARY_DIRS="$PREFIX/lib" -DLIBUSB_LIBRARIES="usb-1.0" ../
62-
make
62+
make -j$(nproc)
6363
make install
6464

6565
cd /opt/lib/libelf-0.8.13
6666
export LIBELF_DIR=`pwd`
6767
./configure --disable-shared --host=$CROSS_COMPILE --prefix=${PREFIX}
6868
make distclean
6969
./configure --disable-shared --host=$CROSS_COMPILE --prefix=${PREFIX}
70-
make
70+
make -j$(nproc)
7171
make install
7272

7373
echo "*****************"
@@ -82,15 +82,15 @@ export NCURSES_DIR=`pwd`
8282
./configure $EXTRAFLAGS --disable-shared --without-debug --without-ada --with-termlib --enable-termcap --without-manpages --without-progs --without-tests --host=$CROSS_COMPILE --prefix=${PREFIX}
8383
make distclean
8484
./configure $EXTRAFLAGS --disable-shared --without-debug --without-ada --with-termlib --enable-termcap --without-manpages --without-progs --without-tests --host=$CROSS_COMPILE --prefix=${PREFIX}
85-
make
85+
make -j$(nproc)
8686
make install.libs
8787

8888
cd /opt/lib/readline-8.0
8989
export READLINE_DIR=`pwd`
9090
./configure --prefix=$PREFIX --disable-shared --host=$CROSS_COMPILE
9191
make distclean
9292
./configure --prefix=$PREFIX --disable-shared --host=$CROSS_COMPILE
93-
make
93+
make -j$(nproc)
9494
make install-static
9595

9696
if [[ $CROSS_COMPILE != "i686-w64-mingw32" && $CROSS_COMPILE != "x86_64-apple-darwin13" ]] ; then
@@ -100,16 +100,16 @@ cd /opt/lib/eudev-3.2.10
100100
make distclean
101101
./autogen.sh
102102
./configure --enable-static --disable-gudev --disable-introspection --disable-shared --disable-blkid --disable-kmod --disable-manpages --prefix=$PREFIX --host=${CROSS_COMPILE}
103-
make
103+
make -j$(nproc)
104104
make install
105105
fi
106106

107-
cd /opt/lib/hidapi
107+
cd /opt/lib/hidapi-0.12.0
108108
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
109109
./bootstrap
110110
./configure --prefix=$PREFIX --enable-static --disable-shared --host=$CROSS_COMPILE
111111
make distclean
112112
./bootstrap
113113
./configure --prefix=$PREFIX --enable-static --disable-shared --host=$CROSS_COMPILE
114-
make
114+
make -j$(nproc)
115115
make install

deps/hidapi-0.12.0/.appveyor.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
os: Visual Studio 2015
2+
3+
environment:
4+
matrix:
5+
- BUILD_ENV: msbuild
6+
arch: x64
7+
- BUILD_ENV: msbuild
8+
arch: Win32
9+
- BUILD_ENV: cygwin
10+
11+
for:
12+
-
13+
matrix:
14+
only:
15+
- BUILD_ENV: msbuild
16+
17+
build_script:
18+
- cmd: msbuild .\windows\hidapi.sln /p:Configuration=Release /p:Platform=%arch% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
19+
20+
-
21+
matrix:
22+
only:
23+
- BUILD_ENV: cygwin
24+
25+
install:
26+
- cmd: C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --packages autoconf,automake
27+
28+
build_script:
29+
- cmd: C:\cygwin64\bin\bash -exlc "cd $APPVEYOR_BUILD_FOLDER; ./bootstrap; ./configure; make"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)