Opened 15 months ago

Last modified 8 months ago

#66901 assigned defect

rust @1.67.0: build fails, due to: failed to build archive: operation not permitted

Reported by: veraciteit Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: mascguy (Christopher Nielsen)
Port: rust

Description

I am trying to build rust on an M1 Mac within a terminal with rosetta enabled. The build fails with the following error message:

:info:build     c Sysroot { compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build Copy "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/rustc-main" to "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/x86_64-apple-darwin/stage1/bin/rustc"
:info:build   < Assemble { target_compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build   > Rustc { target: x86_64-apple-darwin, compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, crates: [] }
:info:build     > Std { target: x86_64-apple-darwin, compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, crates: [] }
:info:build       > StartupObjects { compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, target: x86_64-apple-darwin }
:info:build       < StartupObjects { compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, target: x86_64-apple-darwin }
:info:build       c Assemble { target_compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build       c Libdir { compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, target: x86_64-apple-darwin }
:info:build       c Libdir { compiler: Compiler { stage: 1, host: x86_64-apple-darwin }, target: x86_64-apple-darwin }
:info:build       c Sysroot { compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build       c Sysroot { compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build       c Sysroot { compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build Dirty - ~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/x86_64-apple-darwin/stage1-std
:info:build       c Sysroot { compiler: Compiler { stage: 1, host: x86_64-apple-darwin } }
:info:build Building stage1 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
:info:build running: "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.66.1-x86_64-apple-darwin/cargo/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-Zcheck-cfg=names,values,output" "-Zbinary-dep-depinfo" "-j" "10" "-v" "-v" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
:info:build error: process didn't exit successfully: `~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/bootstrap/debug/rustc -vV` (exit status: 254)
:info:build --- stdout
:info:build Did not run successfully: signal: 6 (SIGABRT)
:info:build "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/x86_64-apple-darwin/stage1/bin/rustc" "-vV" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "-Clinker=~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/compwrap/ld/usr/bin/clang" "-Zunstable-options" "--check-cfg=values(bootstrap)" "-Z" "force-unstable-if-unmarked"
:info:build -------------
:info:build --- stderr
:info:build <jemalloc>: Error allocating TSD
:info:build rustc exited with signal: 6 (SIGABRT)
:info:build command did not execute successfully: "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/cargo-1.66.1-x86_64-apple-darwin/cargo/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-Zcheck-cfg=names,values,output" "-Zbinary-dep-depinfo" "-j" "10" "-v" "-v" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
:info:build expected success, got: exit status: 101
:info:build Traceback (most recent call last):
:info:build   File "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/src/bootstrap/bootstrap.py", line 958, in <module>
:info:build     main()
:info:build   File "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/src/bootstrap/bootstrap.py", line 941, in main
:info:build     bootstrap(help_triggered)
:info:build   File "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/src/bootstrap/bootstrap.py", line 927, in bootstrap
:info:build     run(args, env=env, verbose=build.verbose, is_bootstrap=True)
:info:build   File "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/src/bootstrap/bootstrap.py", line 166, in run
:info:build     raise RuntimeError(err)
:info:build RuntimeError: failed to run: ~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src/build/bootstrap/debug/bootstrap build --stage 2 -j10
:info:build make: *** [all] Error 1
:info:build make: Leaving directory `~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src'
:info:build Command failed:  cd "~/MacPorts/var/macports/build/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/work/rustc-1.67.0-src" && /usr/bin/make -j10 -w all BOOTSTRAP_ARGS="-j10" 
:info:build Exit code: 2
:error:build Failed to build rust: command execution failed
:debug:build Error code: CHILDSTATUS 58090 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See ~/MacPorts/var/macports/logs/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/main.log for details.

Attachments (2)

main.log.tbz2 (8.2 MB) - added by TheErk (Eric) 15 months ago.
Compilation failure log (compressed with tar jcv because original file is about 250MB
main.log.tz2 (293.6 KB) - added by jhfrontz (Jeff Frontz) 12 months ago.
results from "sudo port install rust" on M2/13.2.1

Change History (13)

comment:1 Changed 15 months ago by jmroot (Joshua Root)

Owner: set to MarcusCalhoun-Lopez
Status: newassigned

comment:2 Changed 15 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Please upload the main.log file
(~/MacPorts/var/macports/logs/_Users_dev_MacPorts_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/main.log).

comment:3 Changed 15 months ago by TheErk (Eric)

I have a failure as well when trying to install rustc on M1 with MacOS 13.1

port install rust
--->  Computing dependencies for rust
--->  Fetching archive for rust
--->  Attempting to fetch rust-1.67.0_0.darwin_22.arm64.tbz2 from https://packages.macports.org/rust
--->  Attempting to fetch rust-1.67.0_0.darwin_22.arm64.tbz2 from https://fra.de.packages.macports.org/rust
--->  Attempting to fetch rust-1.67.0_0.darwin_22.arm64.tbz2 from https://mse.uk.packages.macports.org/rust
--->  Building rust
Error: Failed to build rust: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_rust/rust/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port rust failed
Last edited 15 months ago by TheErk (Eric) (previous) (diff)

Changed 15 months ago by TheErk (Eric)

Attachment: main.log.tbz2 added

Compilation failure log (compressed with tar jcv because original file is about 250MB

comment:4 Changed 15 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Thank you for the log.
The problem seems to be multiple :info:build error: failed to build archive: Operation not permitted errors.
I cannot reproduce this on my machine, so it is difficult to know the exact problem, but my best guess is that there is some kind of security setting that is preventing the build.
Can you think of anything about your setup that would cause these issues?

comment:5 Changed 15 months ago by TheErk (Eric)

Not really but now that know what to look for. I'll try to look in that direction.

comment:6 Changed 15 months ago by TheErk (Eric)

Hum, the first error in the log is different:

  80774 :info:build [jemalloc-sys 0.5.0+5.3.0] checking for sched_setaffinity... no
  80775 :info:build error: failed to build archive: No such file or directory
  80776 :info:build Did not run successfully: exit status: 1
No such file or directory

seems to happen before the

operation not permitted

Note that I did port install (and build) a lot of port lately the only one failing seems to be rust. Is there anything very specific to rust build ?

Another information that may be unrelated to my issue but when I was searching for information I found this: https://stackoverflow.com/questions/74877414/rust-project-failing-to-compile-trying-to-link-to-libomp

Last edited 15 months ago by TheErk (Eric) (previous) (diff)

comment:7 Changed 12 months ago by jhfrontz (Jeff Frontz)

Also failing to build on M2 (13.2.1) with no special security settings.

Made changes to Portfile per https://qiita.com/Nanigashi_Uji/items/a6e7c5274bdb9e57bdf6 (Japanese site translated using google translate) and the install rust completed successfully. I have no idea, though, whether the result is a correctly functioning rust compiler.

Last edited 12 months ago by jhfrontz (Jeff Frontz) (previous) (diff)

Changed 12 months ago by jhfrontz (Jeff Frontz)

Attachment: main.log.tz2 added

results from "sudo port install rust" on M2/13.2.1

comment:8 Changed 12 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 12 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

I am glad it is working for you, but I am afraid I do not know why configure.args-append --set=rust.jemalloc is causing problems on your system.
Looking through the main.log, nothing jumps out.
Do you have any thoughts?

comment:10 Changed 8 months ago by mascguy (Christopher Nielsen)

Summary: Error building rustrust @1.67.0: build fails, due to: failed to build archive: operation not permitted
Version: 2.8.1

comment:11 Changed 8 months ago by mascguy (Christopher Nielsen)

Is this still an issue with the latest version of rust, 1.71.1?

Note: See TracTickets for help on using tickets.