[MacPorts] #68185: rust: source build fails when running under rosetta 2

MacPorts noreply at macports.org
Sat Oct 21 16:56:40 UTC 2023


#68185: rust: source build fails when running under rosetta 2
---------------------+--------------------
  Reporter:  lukaso  |      Owner:  (none)
      Type:  defect  |     Status:  new
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:
Resolution:          |   Keywords:
      Port:  rust    |
---------------------+--------------------

Comment (by lukaso):

 I have tried with adding that check to my Portfile. Rust now builds
 successfully.

 Here's the specific bit:

 {{{
 if { ${os.platform} eq "darwin" && ${os.major} > 14 } {
     # check if running in rosetta2 and don't set jemalloc if so
     try {
         set in_rosetta2 [exec sysctl -n sysctl.proc_translated]
         if { ${in_rosetta2} == 0 } {
             configure.args-append   --set=rust.jemalloc
             ui_debug "proc_translated = 0. Enabling jemalloc."
         } else {
             ui_debug "proc_translated = 1. Disabling jemalloc."
             depends_build-append        port:libatomic_ops
         }
     } catch {
         ui_debug "proc_translated errored. Disabling jemalloc."
         depends_build-append        port:libatomic_ops
         # Handle non-zero return of proc_translated gracefully, optionally
 log the error.
     }
     if { ${os.arch} eq "arm" } {
         configure.args-append   --set=rust.jemalloc
         # specify the number of significant virtual address bits in
 jmalloc
         # the configure script calls cpuid, but it does not work properly
 on Rosetta 2
         # see
 https://github.com/jemalloc/jemalloc/issues/1997#issuecomment-1041589117
         build.env.x86_64-append     JEMALLOC_SYS_WITH_LG_VADDR=48
         destroot.env.x86_64-append  JEMALLOC_SYS_WITH_LG_VADDR=48
     }
 }
 }}}

 I have run into a different error later in the build, but this is a start.

-- 
Ticket URL: <https://trac.macports.org/ticket/68185#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list