[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [builders/tor-browser-build] 04/08: Bug 40591: Fix Rust 1.60 on Debian Jessie
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch main
in repository builders/tor-browser-build.
commit 3ad4275c64354edb556efaaed6b5d2009b136666
Author: Pier Angelo Vendrame <pierov@xxxxxxxxxxxxxx>
AuthorDate: Fri Aug 5 14:26:13 2022 +0200
Bug 40591: Fix Rust 1.60 on Debian Jessie
Enable jemalloc when we built it.
Fixes also bug 40592: reuse the LLVM we already build.
---
projects/cbindgen/build | 3 +++
projects/rust/build | 32 ++++++++++++++++++++++++------
projects/rust/config | 52 +++++++++++++++++++++++++++----------------------
3 files changed, 58 insertions(+), 29 deletions(-)
diff --git a/projects/cbindgen/build b/projects/cbindgen/build
index ee54a09..c572f46 100644
--- a/projects/cbindgen/build
+++ b/projects/cbindgen/build
@@ -5,6 +5,9 @@ builddir=/var/tmp/build/[% project %]
mkdir -p $distdir/[% project %]
tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/rust') %]
export PATH="/var/tmp/dist/rust/bin:$PATH"
+[% IF c("var/linux") -%]
+ export LD_LIBRARY_PATH="/var/tmp/dist/rust/lib:$LD_LIBRARY_PATH"
+[% END -%]
mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
diff --git a/projects/rust/build b/projects/rust/build
index c0877b3..d5b600e 100644
--- a/projects/rust/build
+++ b/projects/rust/build
@@ -4,16 +4,27 @@ distdir=/var/tmp/dist/[% project %]
mkdir -p $distdir
tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
export PATH="/var/tmp/dist/cmake/bin:$PATH"
-tar -C /var/tmp/dist -xf [% c('input_files_by_name/ninja') %]
-export PATH=/var/tmp/dist/ninja:$PATH
-tar -C /var/tmp/dist -xf [% c('input_files_by_name/previous_rust') %]
-cd /var/tmp/dist/rust-[% c('var/previous_version') %]-x86_64-unknown-linux-gnu
-./install.sh --prefix=$distdir-rust-old
-export PATH="$distdir-rust-old/bin:$PATH"
+tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
+export PATH=/var/tmp/dist/binutils/bin:$PATH
+tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust_prebuilt') %]
+cd /var/tmp/dist/rust-[% c('version') %]-x86_64-unknown-linux-gnu
+./install.sh --prefix=$distdir-rust-prebuilt
+export PATH="$distdir-rust-prebuilt/bin:$PATH"
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% IF c("var/linux") || c("var/android") || c("var/windows") -%]
+ # See the config file for more details on why we do that also on Windows
+ tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/clang') %]
+ export PATH=/var/tmp/dist/clang/bin:$PATH
+[% END -%]
[% IF c("var/linux") -%]
[% pc('python', 'var/setup', { python_tarfile => c('input_files_by_name/python') }) %]
+ export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"
+ export CC=clang
+ export CXX=clang++
+ export CFLAGS='--gcc-toolchain=/var/tmp/dist/gcc'
+ export CXXFLAGS='--gcc-toolchain=/var/tmp/dist/gcc'
+ export RUSTFLAGS="-L/var/tmp/dist/gcc/lib64"
[% END -%]
[% IF c("var/osx") %]
@@ -48,6 +59,15 @@ cd build
make -j[% c("num_procs") %]
make install
cd /var/tmp/dist
+
+[% IF c("var/linux") -%]
+ # When we compile some Rust-only projects such as cbindgen, we do not include
+ # the C/C++ compilers and their modern libstdc++ library.
+ # For simplicity, we keep it also with Rust, and add it to LD_LIBRARY_PATH
+ # if needed.
+ cp gcc/lib64/libstdc++.so* rust/lib/
+[% END -%]
+
[% c('tar', {
tar_src => [ project ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
diff --git a/projects/rust/config b/projects/rust/config
index 5360be3..83f794c 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -1,23 +1,17 @@
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
-version: '[% c("var/current_version") %]'
+version: '1.60.0'
container:
use_container: 1
-var:
- current_version: 1.60.0
- previous_version: 1.59.0
-
targets:
android:
var:
- current_version: 1.60.0
- previous_version: 1.59.0
arch_deps:
- libssl-dev
- pkg-config
- zlib1g-dev
- configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,armv7-linux-androideabi,thumbv7neon-linux-androideabi,aarch64-linux-android,i686-linux-android,x86_64-linux-android --set=target.armv7-linux-androideabi.cc=armv7a-linux-androideabi16-clang --set=target.armv7-linux-androideabi.ar=armv7a-linux-androideabi-ar --set=target.thumbv7neon-linux-androideabi.cc=armv7a-linux-androideabi16-clang --set [...]
+ configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,armv7-linux-androideabi,thumbv7neon-linux-androideabi,aarch64-linux-android,i686-linux-android,x86_64-linux-android --set=target.armv7-linux-androideabi.cc=armv7a-linux-androideabi16-clang --set=target.armv7-linux-androideabi.ar=armv7a-linux-androideabi-ar --set=target.thumbv7neon-linux-a [...]
linux:
var:
@@ -39,25 +33,28 @@ targets:
#
# `--enable-extended` to build not only rustc but cargo as well
#
- # `--enable-llvm-static-stdcpp` to take a libstdc++ on Jessie into account
- # which is too old and if used gives undefined reference errors
- #
# `--release-channel=stable` to just include stable features in the
# compiler
#
# `--sysconfdir=etc` to avoid install failures as |make install| wants to
# write to /etc otherwise
#
+ # `--llvm-root=/var/tmp/dist/clang` to avoid building LLVM again while
+ # building Rust
+ #
+ # --set rust.jemalloc to use jemalloc. This option is used also in the
+ # prebuilt binaries, and without it the build never ends on Debian Jessie
+ # (see tor-browser-build#40591)
+ #
# the `target` triple to explicitly specify the architecture and platform
# for the compiler/std lib. Ideally, it should not be needed unless one is
# cross-compiling, but compiling `alloc_jemalloc` fails without that in a
# 32bit container. "--host=x86_64-unknown-linux-gnu" is used in its
# configure script in this case.
- # `--set=` to explicitly specify the C compiler. We need to compile the
- # bundled LLVM and it wants to use `cc`. However, we don't have that in
- # our compiled GCC resulting in weird errors due to C and C++ compiler
- # version mismatch. We avoid that with this configure option.
- configure_opt: --enable-local-rust --enable-vendor --enable-extended --enable-llvm-static-stdcpp --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set=target.x86_64-unknown-linux-gnu.cc=gcc --set=target.i686-unknown-linux-gnu.cc=gcc
+ #
+ # Finally, we tell Rust to use some tools from LLVM, like the prebuilt
+ # binaries do.
+ configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib --set target.i686-unknown-linux-gnu.linker=clang --set target.i686-unknown-linux-gnu.ar=llvm-ar --set target. [...]
osx-x86_64:
var:
@@ -65,7 +62,7 @@ targets:
- libssl-dev
- pkg-config
- zlib1g-dev
- configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,x86_64-apple-darwin --set=target.x86_64-apple-darwin.cc=x86_64-apple-darwin-clang
+ configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/macosx-toolchain/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,x86_64-apple-darwin --set=target.x86_64-apple-darwin.cc=x86_64-apple-darwin-clang --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib
windows:
var:
@@ -73,23 +70,32 @@ targets:
- libssl-dev
- pkg-config
- zlib1g-dev
- configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,[% c("arch") %]-pc-windows-gnu
+ # See tor-browser-build#29320
+ compiler: mingw-w64
+ configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/clang --target=x86_64-unknown-linux-gnu,[% c("arch") %]-pc-windows-gnu --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib
input_files:
- project: container-image
+ - name: binutils
+ project: binutils
- project: cmake
name: cmake
- - project: ninja
- name: ninja
- project: '[% c("var/compiler") %]'
name: '[% c("var/compiler") %]'
- - URL: 'https://static.rust-lang.org/dist/rustc-[% c("var/current_version") %]-src.tar.gz'
+ - project: clang
+ name: clang
+ # On Windows we the basic Clang without additional Windows stuff because we
+ # want to be sure GCC is used to compile Rust (Rust has a hard depedency on
+ # libgcc, and the GNU/LLVM is a tier 3 platform supported only for x86_64).
+ # macOS does not need Clang because it comes already with its compiler.
+ enable: '[% c("var/linux") || c("var/android") || c("var/windows") %]'
+ - URL: 'https://static.rust-lang.org/dist/rustc-[% c("version") %]-src.tar.gz'
name: rust
sig_ext: asc
file_gpg_id: 1
gpg_keyring: rust.gpg
- - URL: 'https://static.rust-lang.org/dist/rust-[% c("var/previous_version") %]-x86_64-unknown-linux-gnu.tar.xz'
- name: previous_rust
+ - URL: 'https://static.rust-lang.org/dist/rust-[% c("version") %]-x86_64-unknown-linux-gnu.tar.xz'
+ name: rust_prebuilt
sig_ext: asc
file_gpg_id: 1
gpg_keyring: rust.gpg
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits