Skip to content

Commit 9e2298e

Browse files
authored
freebsd: fix image build (#1674)
Currently, this patch is tested by built the docker image but haven't test the build of any application upon the docker image. When I use cross to build application, it will create the following Dockerfile in the target directory: ``` FROM ghcr.io/cross-rs/x86_64-unknown-freebsd:main ARG CROSS_DEB_ARCH= ARG CROSS_CMD RUN eval "${CROSS_CMD}" ``` I try to replace the "FROM" sentence to my local build image but when `cross build` is executed, it will recover to ghcr.io again. FreeBSD change the compress algorithm of the packagesite to zstd. Also it change the download filename. Besides fixing the download issue, I update the gcc version to 13
2 parents a6cffa0 + 8775f3b commit 9e2298e

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

.changes/1674.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "fixed",
3+
"description": "use zstd to extract the compressed file as FreeBSD do so. also, bump the gcc version"
4+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ terminate.
220220
| `armv7-unknown-linux-musleabihf` | 1.2.3 | 9.2.0 || 6.1.0 ||
221221
| `i586-unknown-linux-gnu` | 2.31 | 9.4.0 || N/A ||
222222
| `i586-unknown-linux-musl` | 1.2.3 | 9.2.0 || N/A ||
223-
| `i686-unknown-freebsd` | 1.5 | 6.4.0 || N/A | |
223+
| `i686-unknown-freebsd` | 1.6 | 13.3.0 || N/A | |
224224
| `i686-linux-android` [1] | 9.0.8 | 9.0.8 || 6.1.0 ||
225225
| `i686-pc-windows-gnu` | N/A | 9.4 || N/A ||
226226
| `i686-unknown-linux-gnu` | 2.31 | 9.4.0 || 6.1.0 ||
@@ -255,7 +255,7 @@ terminate.
255255
| `x86_64-linux-android` [1] | 9.0.8 | 9.0.8 || 6.1.0 ||
256256
| `x86_64-pc-windows-gnu` | N/A | 9.3 || N/A ||
257257
| `x86_64-pc-solaris` | 1.22.7 | 8.4.0 || N/A | |
258-
| `x86_64-unknown-freebsd` | 1.5 | 6.4.0 || N/A | |
258+
| `x86_64-unknown-freebsd` | 1.6 | 13.3.0 || N/A | |
259259
| `x86_64-unknown-dragonfly` [2] [3] | 6.0.1 | 10.3.0 || N/A | |
260260
| `x86_64-unknown-illumos` | 1.20.4 | 8.4.0 || N/A | |
261261
| `x86_64-unknown-linux-gnu` | 2.31 | 9.4.0 || 6.1.0 ||

docker/freebsd-extras.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ main() {
2121
curl \
2222
dnsutils \
2323
jq \
24-
xz-utils
24+
xz-utils \
25+
zstd
2526

2627
local url=
2728
url=$(fetch_best_freebsd_mirror)

docker/freebsd-install.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ setup_freebsd_packagesite() {
121121
pkg_source=$(freebsd_package_source "${url}")
122122

123123
mkdir -p "${FREEBSD_PACKAGEDIR}"
124-
curl --retry 3 -sSfL "${pkg_source}/packagesite.txz" -O
125-
tar -C "${FREEBSD_PACKAGEDIR}" -xJf packagesite.txz
126-
127-
rm packagesite.txz
124+
curl --retry 3 -sSfL "${pkg_source}/packagesite.tzst" -O
125+
tar -C "${FREEBSD_PACKAGEDIR}" --zstd -xf packagesite.tzst
128126
}
129127

130128
# don't provide the mirror as a positional argument, so it can be optional

docker/freebsd.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ bsd_url="${mirror}/${FREEBSD_ARCH}/${base_release}-RELEASE"
144144

145145
main() {
146146
local binutils=2.40 \
147-
gcc=6.4.0 \
147+
gcc=13.3.0 \
148148
target="${ARCH}-unknown-freebsd${FREEBSD_MAJOR}"
149149

150150
install_packages ca-certificates \
@@ -153,7 +153,8 @@ main() {
153153
make \
154154
wget \
155155
texinfo \
156-
xz-utils
156+
xz-utils \
157+
bzip2
157158

158159
local td
159160
td="$(mktemp -d)"
@@ -188,9 +189,10 @@ main() {
188189
cp "${td}/freebsd/usr/lib/libc++.so.1" "${destdir}/lib"
189190
cp "${td}/freebsd/usr/lib/libc++.a" "${destdir}/lib"
190191
cp "${td}/freebsd/usr/lib/libcxxrt.a" "${destdir}/lib"
192+
cp "${td}/freebsd/usr/lib/libcxxrt.so" "${destdir}/lib"
191193
cp "${td}/freebsd/usr/lib/libcompiler_rt.a" "${destdir}/lib"
192194
cp "${td}/freebsd/usr/lib"/lib{c,util,m,ssp_nonshared,memstat}.a "${destdir}/lib"
193-
cp "${td}/freebsd/usr/lib"/lib{rt,execinfo,procstat}.so.1 "${destdir}/lib"
195+
cp "${td}/freebsd/usr/lib"/lib{rt,execinfo,procstat}.so "${destdir}/lib"
194196
cp "${td}/freebsd/usr/lib"/libmemstat.so.3 "${destdir}/lib"
195197
cp "${td}/freebsd/usr/lib"/{crt1,Scrt1,crti,crtn}.o "${destdir}/lib"
196198
cp "${td}/freebsd/usr/lib"/libkvm.a "${destdir}/lib"
@@ -228,6 +230,7 @@ main() {
228230
--disable-libvtv \
229231
--disable-lto \
230232
--disable-nls \
233+
--disable-multilib \
231234
--enable-languages=c,c++,fortran \
232235
--target="${target}"
233236
make "-j$(nproc)"

xtask/src/target_info.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ case "${target}" in
304304
# the symbol versioning can be found here:
305305
# https://wiki.freebsd.org/SymbolVersioning
306306
version=$(cat /opt/freebsd-version)
307-
if [[ "${version}" =~ ([0-9]+)\.([0-9]+)" ("[A-Za-z]+")" ]]; then
307+
if [[ "${version}" =~ ([0-9]+)\.([0-9]+)" ("[A-Za-z0-9]+")" ]]; then
308308
major_version="${BASH_REMATCH[1]}"
309309
minor_version="${BASH_REMATCH[2]}"
310310
case "${major_version}" in
@@ -329,6 +329,9 @@ case "${target}" in
329329
13)
330330
libc="1.6"
331331
;;
332+
14)
333+
libc="1.7"
334+
;;
332335
*)
333336
echo "Invalid FreeBSD version, got ${major_version}.${minor_version}." 1>&2
334337
exit 1

0 commit comments

Comments
 (0)