libvips / build-win64-mxe

79 stars 15 forks source link

Can't install rust without being root #38

Closed ReeseMurdock closed 2 years ago

ReeseMurdock commented 2 years ago

First, I just really want to thank you for this project. It really makes my life so much easier.

I am building web, static, and x86_64 on Ubuntu for Windows (wsl2). If I change the top level build.sh so that I am root in the docker instance, "-u $(id -u):$(id -g) \" changed to "-u 0", then I can build the entire project without issue. If I leave it, then I get a failure in the build/install of rust_x86_64-pc-linux-gnu. This happens on every version of build-win64-mxe including V8.12.1.

rust_x86_64-pc-linux-gnu log file:

make[1]: Entering directory '/data/mxe' == General overrides: /data/overrides.mk [plugin] /data/plugins/mozjpeg/ [plugin] /data/plugins/zlib-ng/ [plugin] /data/plugins/llvm-mingw/ [plugin] /data/plugins/proxy-libintl/ uname -a Linux 20822bf1c700 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 GNU/Linux git log --pretty=tformat:"%H - %s [%ar] [%d]" -1 02852a7b690aa411ce2a2089deea25a7292a33d6 - update curl [2 weeks ago] [ (HEAD -> master)] lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true autoconf --version 2>/dev/null | head -1 autoconf (GNU Autoconf) 2.69 automake --version 2>/dev/null | head -1 automake (GNU automake) 1.16.1 gcc --version gcc (Debian 8.3.0-6) 8.3.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ --version g++ (Debian 8.3.0-6) 8.3.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

python --version Python 2.7.16 perl --version 2>&1 | head -3

This is perl 5, version 28, subversion 1 (v5.28.1) built for x86_64-linux-gnu-thread-multi (with 65 registered patches, see perl -V for more detail) rm -rf '/data/mxe/tmp-rust-x86_64-pc-linux-gnu' mkdir -p '/data/mxe/tmp-rust-x86_64-pc-linux-gnu' mkdir -p '/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src' mkdir -p '/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build' # disable wine with readonly directory # see https://github.com/mxe/mxe/issues/841 mkdir -p '/data/mxe/tmp-rust-x86_64-pc-linux-gnu/readonly' chmod 0555 '/data/mxe/tmp-rust-x86_64-pc-linux-gnu/readonly' cd '/data/mxe/tmp-rust-x86_64-pc-linux-gnu' && tar xzf '/data/mxe/pkg/rustc-nightly-src.tar.gz' cd '/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src' (cd '/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src' && patch -p1 -u) < /data/plugins/llvm-mingw/patches/rust-1-fixes.patch patching file compiler/rustc_target/src/spec/aarch64_pc_windows_gnu.rs patching file compiler/rustc_target/src/spec/mod.rs patching file compiler/rustc_target/src/spec/thumbv7a_pc_windows_gnu.rs patching file compiler/rustc_target/src/spec/windows_gnu_base.rs patching file compiler/rustc_target/src/spec/windows_gnu_base.rs patching file src/bootstrap/dist.rs patching file vendor/compiler_builtins/build.rs patching file vendor/compiler_builtins/src/arm.rs patching file library/panic_unwind/src/gcc.rs patching file library/unwind/src/libunwind.rs # x86_64-pc-linux-gnu -> x86_64-unknown-linux-gnu # Disable LTO, panic strategy and optimization settings while # we bootstrap Rust # Unexport target specific compiler / linker flags cd '/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build' && /data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/configure --prefix='/data/mxe/usr/x86_64-pc-linux-gnu' --release-channel=nightly --enable-extended --tools=cargo,src --disable-docs --disable-codegen-tests --python='/usr/bin/python' --llvm-root='/data/mxe/usr/x86_64-pc-linux-gnu' --set target.x86_64-unknown-linux-gnu.cc='/data/mxe/usr/x86_64-pc-linux-gnu/bin/clang' --set target.x86_64-unknown-linux-gnu.cxx='/data/mxe/usr/x86_64-pc-linux-gnu/bin/clang++' --set target.x86_64-unknown-linux-gnu.linker='/data/mxe/usr/x86_64-pc-linux-gnu/bin/clang' --set target.x86_64-unknown-linux-gnu.ar='/data/mxe/usr/x86_64-pc-linux-gnu/bin/llvm-ar' --set target.x86_64-unknown-linux-gnu.ranlib='/data/mxe/usr/x86_64-pc-linux-gnu/bin/llvm-ranlib' configure: processing command line configure: configure: install.prefix := /data/mxe/usr/x86_64-pc-linux-gnu configure: rust.channel := nightly configure: build.extended := True configure: build.tools := ['cargo', 'src'] configure: build.docs := False configure: rust.codegen-tests := False configure: build.python := /usr/bin/python configure: target.x86_64-unknown-linux-gnu.llvm-config := /data/mxe/usr/x86_64-pc ... configure: target.x86_64-unknown-linux-gnu.cc := /data/mxe/usr/x86_64-pc-linux-gn ... configure: target.x86_64-unknown-linux-gnu.cxx := /data/mxe/usr/x86_64-pc-linux-g ... configure: target.x86_64-unknown-linux-gnu.linker := /data/mxe/usr/x86_64-pc-linu ... configure: target.x86_64-unknown-linux-gnu.ar := /data/mxe/usr/x86_64-pc-linux-gn ... configure: target.x86_64-unknown-linux-gnu.ranlib := /data/mxe/usr/x86_64-pc-linu ... configure: build.configure-args := ['--prefix=/data/mxe/usr/x86_64-pc-linux-gnu', ... configure: configure: writing config.toml in current directory configure: configure: run python /data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/x.py --help configure: # Enable networking while we build Rust from source. Assumes # that the Rust build is reproducible. # Build Rust cd '/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build' && /usr/bin/python /data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/x.py build -j '6' -v rustup not detected: [Errno 2] No such file or directory: 'rustc': 'rustc' falling back to auto-detect downloading https://static.rust-lang.org/dist/2021-10-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz running: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppgwgz63w https://static.rust-lang.org/dist/2021-10-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz ##O=- # #

### 1.9% ############### 7.7% ########################### 13.7% ####################################### 19.8% #################################################### 26.2% ################################################################ 32.5% ############################################################################# 38.6% ######################################################################################### 45.0% ###################################################################################################### 51.4% ################################################################################################################### 57.6% ################################################################################################################################ 64.1% ############################################################################################################################################ 70.5% ########################################################################################################################################################## 77.2% ######################################################################################################################################################################### 85.0% ########################################################################################################################################################################################## 93.0% ######################################################################################################################################################################################################## 100.0% verifying /tmp/tmppgwgz63w moving /tmp/tmppgwgz63w to /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz extracting /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/self-contained extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-beta_rt.asan.a extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-beta_rt.lsan.a extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-beta_rt.msan.a extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-beta_rt.tsan.a extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b92887cb5c3a6560.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-82d7e1aea79178a0.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-10649d22c3dd6711.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-7a5a8397b4091d82.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-8113a8dddc641303.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-48eb7baa80925983.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libprofiler_builtins-b4ded4ffdc1a3034.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-8cfe50d4bd4d4645.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-24814b3706f62e96.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-88c4d85fe493b0a6.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-c8bc39dac3997df6.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-7644b5a5bed1a877.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-37758a72615c6b77.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-39ff8e5704da2fd7.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-53ce4f77bc440228.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-8b06cab7314e09a8.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3724b6bc011014fa.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-4e43df503c40a34b.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-4dbed51e1ce1454b.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-64139d71c3bbeeeb.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-f69b58e7ca42553e.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6c2c561a8181be5e.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-53dff7998de87b8e.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-b0191dd58367adae.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-4d997b51b1a49b1f.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e3710285bec6b63f.rlib extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/manifest.in extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-c8bc39dac3997df6.so extracting rust-std-beta-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-4d997b51b1a49b1f.so downloading https://static.rust-lang.org/dist/2021-10-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz running: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpu2icavx7 https://static.rust-lang.org/dist/2021-10-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz

0.0% # 0.8% ####### 3.6% ############## 7.1% ##################### 10.5% ########################### 14.0% ################################## 17.4% ########################################## 21.0% ################################################ 24.3% ####################################################### 27.8% ############################################################## 31.4% ##################################################################### 34.8% ############################################################################ 38.1% ################################################################################### 41.7% ###################################################################################### 43.3% ############################################################################################# 46.8% #################################################################################################### 50.3% ########################################################################################################### 53.8% ################################################################################################################## 57.1% ######################################################################################################################## 60.3% ############################################################################################################################## 63.4% ##################################################################################################################################### 66.7% ########################################################################################################################################### 69.7% ################################################################################################################################################## 73.0% ######################################################################################################################################################### 76.5% ################################################################################################################################################################ 80.2% ####################################################################################################################################################################### 83.7% ############################################################################################################################################################################## 87.1% #################################################################################################################################################################################### 90.2% ########################################################################################################################################################################################### 93.6% ################################################################################################################################################################################################# 96.9% ######################################################################################################################################################################################################## 100.0% verifying /tmp/tmpu2icavx7 moving /tmp/tmpu2icavx7 to /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz extracting /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz extracting rustc-beta-x86_64-unknown-linux-gnu/rustc extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc/rust extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/man extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/man/man1 extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/man/man1/rustdoc.1 extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/man/man1/rustc.1 extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld64 extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc/rust/LICENSE-APACHE extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc/rust/COPYRIGHT extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc/rust/LICENSE-MIT extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin/rust-gdb extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin/rust-lldb extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin/rustdoc extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin/rustc extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-lld extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/share/doc/rust/README.md extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/bin/rust-gdbgui extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/manifest.in extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/libstd-c8bc39dac3997df6.so extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/libLLVM-13-rust-1.57.0-beta.so extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/librustc_driver-24f36aeef90a945b.so extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/libtest-4d997b51b1a49b1f.so extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-llvm-dwp extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/lldb_commands extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/gdb_lookup.py extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/lldb_lookup.py extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/rust_types.py extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/gdb_providers.py extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/lldb_providers.py extracting rustc-beta-x86_64-unknown-linux-gnu/rustc/lib/rustlib/etc/gdb_load_rust_pretty_printers.py downloading https://static.rust-lang.org/dist/2021-10-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz running: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmpvwxffcnn https://static.rust-lang.org/dist/2021-10-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz

#### 2.0% ################################ 16.1% ########################################################################## 37.1% ################################################################################################################################ 64.1% ############################################################################################################################################################################# 86.8% ######################################################################################################################################################################################################## 100.0% verifying /tmp/tmpvwxffcnn moving /tmp/tmpvwxffcnn to /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz extracting /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz extracting cargo-beta-x86_64-unknown-linux-gnu/cargo extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/libexec extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/etc extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/etc/bash_completion.d extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc/cargo extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/zsh extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/zsh/site-functions extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/bin extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-metadata.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-doc.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-rustdoc.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-rustc.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-pkgid.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-build.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-tree.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-package.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-generate-lockfile.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-update.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-bench.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-search.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-fetch.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-publish.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-check.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-yank.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-install.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-uninstall.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-clean.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-login.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-version.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-run.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-help.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-owner.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-vendor.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-locate-project.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-verify-project.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-init.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-test.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-new.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/man/man1/cargo-fix.1 extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc/cargo/LICENSE-APACHE extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc/cargo/LICENSE-MIT extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc/cargo/LICENSE-THIRD-PARTY extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/doc/cargo/README.md extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/libexec/cargo-credential-1password extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/manifest.in extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/etc/bash_completion.d/cargo extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/bin/cargo extracting cargo-beta-x86_64-unknown-linux-gnu/cargo/share/zsh/site-functions/_cargo downloading https://static.rust-lang.org/dist/2021-10-23/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz running: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmp7wx6nyma https://static.rust-lang.org/dist/2021-10-23/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz

## 1.5% ################################### 17.8% ######################################################################################################### 52.8% ################################################################################################################################################################################### 89.6% ######################################################################################################################################################################################################## 100.0% verifying /tmp/tmp7wx6nyma moving /tmp/tmp7wx6nyma to /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-23/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz extracting /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/cache/2021-10-23/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share/doc extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share/doc/rustfmt extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/bin extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share/doc/rustfmt/LICENSE-APACHE extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share/doc/rustfmt/LICENSE-MIT extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/share/doc/rustfmt/README.md extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/manifest.in extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/bin/cargo-fmt extracting rustfmt-nightly-x86_64-unknown-linux-gnu/rustfmt-preview/bin/rustfmt running: /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/Cargo.toml --verbose error: failed to get cc as a dependency of package bootstrap v0.0.0 (/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap)

Caused by: failed to create directory /.cargo/registry/index/github.com-1ecc6299db9ec823

Caused by: Permission denied (os error 13) Traceback (most recent call last): File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/x.py", line 27, in bootstrap.main() File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1260, in main bootstrap(help_triggered) File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1231, in bootstrap build.build_bootstrap() File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 989, in build_bootstrap run(args, env=env, verbose=self.verbose) File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 144, in run raise RuntimeError(err) RuntimeError: failed to run: /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/Cargo.toml --verbose make[1]: *** [Makefile:878: build-only-rust_x86_64-pc-linux-gnu] Error 1 make[1]: Leaving directory '/data/mxe'

real 0m38.401s user 0m23.623s sys 0m16.338s

kleisauke commented 2 years ago

Hi @Topochicho,

I'm glad that this project is useful.

Caused by: failed to create directory /.cargo/registry/index/github.com-1ecc6299db9ec823

Interesting, that should not happen. This directory stores the local cache of Cargo's registry index and git checkouts of crates. By default these are stored under $HOME/.cargo. So I think somehow the HOME environment variable is not set correctly on WSL2.

I see this when I use Podman (rootless) on my Fedora PC:

$ podman run --rm -it --userns=keep-id -u $(id -u):$(id -g) --entrypoint "bash" libvips-build-win-mxe
kleisauke@d1195f3183c5:~$ echo $HOME
/data

I think probably the most logical option would be to remove this non-root build requirement: https://github.com/libvips/build-win64-mxe/blob/e03a405ae91b0b48b8a9e4f09367a03a60f0bff0/build.sh#L75-L78

And remove the inheritance of the current UID and GID as well: https://github.com/libvips/build-win64-mxe/blob/e03a405ae91b0b48b8a9e4f09367a03a60f0bff0/build.sh#L149

Since these binaries are supposed to be safely buildable by root users as well (MXE's SHA256 checksums for tarballs and disabled network for the build process enforces this). I just did this with commit https://github.com/libvips/build-win64-mxe/commit/025fed291b6710625933e22fde3a6608242758b4. Let me know if this works for you.

ReeseMurdock commented 2 years ago

This is something like what I have been doing. However, not everyone at my work has admin on their machines, and even fewer have sudo on the Linux machines, so that is a problem. The build will still work if the script is run by a non-admin, but it creates permissions issues with some of the files being owned by root.

I have added 2 lines to the end of build-win64-mxe/build.sh - A call to change the owner using docker: docker run --rm -t -u 0 -v $PWD/build:/data --entrypoint /bin/bash libvips-build-win-mxe -c "chown -Rh $(id -u):$(id -g) *" And a chmod to open permissions: chmod -Rf 777 *

Unfortunately, not only is this a gross hack, but it is not even a %100 solution. If the Docker instance is stopped for some reason, it leaves the files in a mixed permissions state. I could add these commands to the top of build-win64-mxe/build.sh in addition to the bottom, however I was trying to push this into our automated build system, and it chokes on the files with root permissions before my script even gets called.

However, I also understand that this is not going to be a common problem for most people, so I appreciate you looking at it. I will keep plugging away at it, but if you have any additional suggestions, I would appreciate them.

kleisauke commented 2 years ago

I could not reproduce the build error with these steps on my Windows PC:

  1. Install Docker Desktop from the official website.
  2. Ensure the WSL distribution runs in WSL 2 mode.
    PS> wsl.exe -l -v
      NAME                   STATE           VERSION
    * docker-desktop         Running         2
      Ubuntu                 Running         1
      docker-desktop-data    Running         2
    PS> wsl.exe --set-version Ubuntu 2
  3. In Docker Desktop, go to Settings -> Resources -> WSL Integration and select Ubuntu to enable the Docker-WSL integration on. After that, click Apply & Restart.
  4. Build Windows x64 static binaries for libvips on Ubuntu using WSL.

    # Upgrade the current packages
    $ sudo apt update && sudo apt upgrade
    
    # Verify that Docker is working
    $ docker version
    
    # Build Windows binaries (first-time build takes a long time, LLVM and Rust must be built from source)
    $ git clone https://github.com/libvips/build-win64-mxe.git
    $ cd build-win64-mxe/
    $ ./build.sh web x86_64 static
  5. Inspect \\wsl$\Ubuntu\home\<username>\build-win64-mxe\build\vips-dev-w64-web-8.12.1-static.zip.

But you're right, somehow this makes the tarball owned by root, I see this:

$ ls -l build/vips-dev-w64-web-8.12.1-static.zip
-rw-r--r-- 1 root root 25083334 Dec  1 13:22 build/vips-dev-w64-web-8.12.1-static.zip

AFAIK, this was not a issue with Podman in rootless mode, let me investigate this further.

kleisauke commented 2 years ago

Oh, I could reproduce that build error on WSL when the current UID and GID are inherited (-u $(id -u):$(id -g)). I'm testing this patch now:

diff --git a/build/plugins/llvm-mingw/rust.mk b/build/plugins/llvm-mingw/rust.mk
index 1111111..2222222 100644
--- a/build/plugins/llvm-mingw/rust.mk
+++ b/build/plugins/llvm-mingw/rust.mk
@@ -52,6 +52,10 @@ define $(PKG)_BUILD_$(BUILD)
     # that the Rust build is reproducible.
     $(eval export MXE_ENABLE_NETWORK := 1)

+    # Ensure that the downloaded build dependencies of Cargo are
+    # stored in the build directory.
+    $(eval export CARGO_HOME := $(BUILD_DIR)/.cargo)
+
     # Build Rust
     cd '$(BUILD_DIR)' && \
         $(PYTHON) $(SOURCE_DIR)/x.py build -j '$(JOBS)' -v
kleisauke commented 2 years ago

Seems to work! It seems that inheriting the current UID and GID also resolves the ownership issue when building with Docker:

$ ls -l build/vips-dev-w64-web-8.12.1-static.zip
-rw-r--r-- 1 kleisauke kleisauke 25083334 Dec  1 16:07 build/vips-dev-w64-web-8.12.1-static.zip

I'll include this fix in the next version bump cycle (planned for tomorrow).

ReeseMurdock commented 2 years ago

Excellent! I have already incorporated your patch and pushed it to our automated build system. I will let you know in a few hours how it worked on my end.

ReeseMurdock commented 2 years ago

The automated build system failed on building/install rust again, although at a different spot. I am rebuilding from scratch, under WSL2/ubuntu, to see if this issue is unique to our build system or something that I am doing wrong.

In case you would like to take a look at the current failure - Due to it's size, I have attached the log file rather that pasting the entire thing: rust_x86_64-pc-linux-gnu.log

But here is what I believe is the relevant portion:

Dist cargo-nightly-x86_64-unknown-linux-gnu running: "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/x86_64-unknown-linux-gnu/stage0-tools-bin/fabricate" "generate" "--image-dir" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/image" "--component-name=cargo" "--rel-manifest-dir=rustlib" "--legacy-manifest-dirs=rustlib,cargo" "--product-name=Rust" "--success-message=cargo installed." "--package-name=cargo-nightly-x86_64-unknown-linux-gnu" "--non-installed-overlay" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/overlay" "--output-dir" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/dist" "--work-dir" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu" finished in 8.771 seconds < Cargo { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } Install cargo stage2 (Some(TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None })) running: "sh" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/cargo-nightly-x86_64-unknown-linux-gnu/install.sh" "--prefix=/data/mxe/usr/x86_64-pc-linux-gnu" "--sysconfdir=/etc" "--datadir=/data/mxe/usr/x86_64-pc-linux-gnu/share" "--docdir=/data/mxe/usr/x86_64-pc-linux-gnu/share/doc/rust" "--bindir=/data/mxe/usr/x86_64-pc-linux-gnu/bin" "--libdir=/data/mxe/usr/x86_64-pc-linux-gnu/lib" "--mandir=/data/mxe/usr/x86_64-pc-linux-gnu/share/man" "--disable-ldconfig" install: creating uninstall script at /data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/uninstall.sh install: installing component 'cargo' cp: cannot create regular file '/etc/bash_completion.d/cargo': Permission denied chmod: cannot access '/etc/bash_completion.d/cargo': No such file or directory install: error: file creation failed. see logs at '/data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/install.log'

command did not execute successfully: "sh" "/data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/cargo-nightly-x86_64-unknown-linux-gnu/install.sh" "--prefix=/data/mxe/usr/x86_64-pc-linux-gnu" "--sysconfdir=/etc" "--datadir=/data/mxe/usr/x86_64-pc-linux-gnu/share" "--docdir=/data/mxe/usr/x86_64-pc-linux-gnu/share/doc/rust" "--bindir=/data/mxe/usr/x86_64-pc-linux-gnu/bin" "--libdir=/data/mxe/usr/x86_64-pc-linux-gnu/lib" "--mandir=/data/mxe/usr/x86_64-pc-linux-gnu/share/man" "--disable-ldconfig" expected success, got: exit status: 1

Traceback (most recent call last): File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/x.py", line 27, in bootstrap.main() File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1260, in main bootstrap(help_triggered) File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1246, in bootstrap run(args, env=env, verbose=build.verbose, is_bootstrap=True) File "/data/mxe/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 144, in run raise RuntimeError(err) RuntimeError: failed to run: /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/bootstrap/debug/bootstrap install --keep-stage 1 -j 6 -v make[1]: *** [Makefile:878: build-only-rust_x86_64-pc-linux-gnu] Error 1 make[1]: Leaving directory '/data/mxe'

This log file reerences /data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/install.log, so here it is:

$ umask 022 && mkdir -p "/data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib" $ echo "3" > "/data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/rust-installer-version" install: creating uninstall script at /data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/uninstall.sh $ cp /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/cargo-nightly-x86_64-unknown-linux-gnu/install.sh /data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/uninstall.sh install: installing component 'cargo' $ echo "cargo" >> "/data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/components" $ umask 022 && mkdir -p "/etc/bash_completion.d" install: copying file /etc/bash_completion.d/cargo $ cp /data/mxe/tmp-rust-x8664-pc-linux-gnu/rustc-nightly-src.build/build/tmp/tarball/cargo/x86_64-unknown-linux-gnu/cargo-nightly-x86_64-unknown-linux-gnu/cargo/etc/bash_completion.d/cargo /etc/bash_completion.d/cargo $ chmod 644 /etc/bash_completion.d/cargo install: error: file creation failed. see logs at '/data/mxe/usr/x86_64-pc-linux-gnu/lib/rustlib/install.log'

FYI, our automated build system is azure devops and I am pointing to a locally virtualized Ubuntu 20.04.3 LTS build client.

kleisauke commented 2 years ago

It seems Rust installs the system configuration files by default in /etc. https://github.com/rust-lang/rust/blob/f04a2f4b8e89eac1119061ea2055d33c97e618b4/config.toml.example#L338

I think I already fixed that with commit https://github.com/libvips/build-win64-mxe/commit/025fed291b6710625933e22fde3a6608242758b4.

diff --git a/build/plugins/llvm-mingw/rust.mk b/build/plugins/llvm-mingw/rust.mk
index 1111111..2222222 100644
--- a/build/plugins/llvm-mingw/rust.mk
+++ b/build/plugins/llvm-mingw/rust.mk
@@ -34,6 +34,7 @@ define $(PKG)_BUILD_$(BUILD)

     cd '$(BUILD_DIR)' && $(SOURCE_DIR)/configure \
         --prefix='$(PREFIX)/$(BUILD)' \
+        --sysconfdir='etc' \
         --release-channel=nightly \
         --enable-extended \
         --tools=cargo,src \
ReeseMurdock commented 2 years ago

That worked. It now builds in both WSL and my automated build pipeline.

Thank you very much.

kleisauke commented 2 years ago

The above patch has landed as commit https://github.com/libvips/build-win64-mxe/commit/f624cf3f3c531296503ffde067037cf88bdb00d8. Thanks for reporting this!

jet082 commented 5 months ago

I can confirm that this problem still remains as of the latest commit.

Skip cloning, MXE already exists at /data/mxe
[ignore settings.mk]
== General overrides: /data/overrides.mk
[plugin]      /data/plugins/zlib-ng/
[plugin]      /data/plugins/llvm-mingw/
[plugin]      /data/plugins/proxy-libintl/
[build]       cargo-c                  x86_64-pc-linux-gnu

Failed to build package cargo-c for target x86_64-pc-linux-gnu!
------------------------------------------------------------
error: failed to create directory `/.cargo/registry/cache/index.crates.io-6f17d22bba15001f`
Caused by:
  Permission denied (os error 13)
make[1]: *** [Makefile:914: build-only-cargo-c_x86_64-pc-linux-gnu] Error 101
make[1]: Leaving directory '/data/mxe'
real    0m30.505s
user    0m3.154s
sys     0m0.893s
------------------------------------------------------------
[log]      /data/mxe/log/cargo-c_x86_64-pc-linux-gnu

make: *** [Makefile:902: /data/mxe/usr/x86_64-pc-linux-gnu/installed/cargo-c] Error 1

Changing the user line in build.sh mentioned above does fix it though (but I also needed to run a chown root -R on build/mxe to fix 'dubious ownership' problems)

kleisauke commented 5 months ago

@jet082 Should be fixed with commit 4746248b99abc45af4306094576832b2c783ecc2. Thanks for reporting this!