Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#65213 closed defect (fixed)

jemalloc +universal build fails on Mac M1 (Monterey 12.3.1)

Reported by: sudheerhebbale (Sudheer Hebbale) Owned by: Ken <21211439+kencu@…>
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: jemalloc

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Build of jemalloc on Mac M1 (ARM64) fails when tried with the following command

sudo port install jemalloc +universal 

Following error is generated

Error: Failed to configure jemalloc: consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/jemalloc-5.2.1/config.log
Error: Failed to configure jemalloc: configure failure: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port jemalloc failed

Attachments (1)

config.log (46.0 KB) - added by sudheerhebbale (Sudheer Hebbale) 2 years ago.

Download all attachments as: .zip

Change History (10)

Changed 2 years ago by sudheerhebbale (Sudheer Hebbale)

Attachment: config.log added

comment:1 Changed 2 years ago by sudheerhebbale (Sudheer Hebbale)

Summary: Build of jemalloc fails on Mac M1Build of jemalloc fails on Mac M1 (Monterey 12.3.1)

comment:2 Changed 2 years ago by jmroot (Joshua Root)

Description: modified (diff)
Port: jemalloc added
Summary: Build of jemalloc fails on Mac M1 (Monterey 12.3.1)jemalloc +universal build fails on Mac M1 (Monterey 12.3.1)

comment:3 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

The error seems to be error: cannot determine number of significant virtual address bits but before that I also see it's checking whether some assembly instruction works. If the configure script is going to do this sort of thing then having the port use the muniversal portgroup is probably the only way to get a correct universal build.

comment:4 Changed 2 years ago by hmeine (Hans Meine)

I have a similar problem, but am not sure it's the same. For me the build has worked (implicitly as a dependency through sudo port install opencv4 +universal), but I get

Error: Failed to destroot jemalloc: jemalloc-config differs in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/destroot-arm64//opt/local/bin and /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/destroot-ppc-intel//opt/local/bin and cannot be merged

Looking at the two separately built jmealloc-config files, the main difference seems to be the architecture, which is part of many outputs:

--- /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/destroot-arm64/opt/local/bin/jemalloc-config2022-06-16 14:33:05.000000000 +0200
+++ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/destroot-ppc-intel//opt/local/bin/jemalloc-config	2022-06-16 14:33:05.000000000 +0200
@@ -39,7 +39,7 @@
 	echo "2"
 	;;
 --config)
-	echo "--prefix=/opt/local --disable-debug --with-jemalloc-prefix= --host=aarch64-apple-darwin21.5.0 host_alias=aarch64-apple-darwin21.5.0 CC=/usr/bin/clang 'CFLAGS=-pipe -Os -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch arm64 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' 'CPPFLAGS=-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' CXX=/usr/bin/clang++ 'CXXFLAGS=-pipe -Os -std=c++11 -latomic -arch arm64 -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'"
+	echo "--prefix=/opt/local --disable-debug --with-jemalloc-prefix= --host=x86_64-apple-darwin21.5.0 host_alias=x86_64-apple-darwin21.5.0 CC=/usr/bin/clang 'CFLAGS=-pipe -Os -arch x86_64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' 'CPPFLAGS=-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk' CXX=/usr/bin/clang++ 'CXXFLAGS=-pipe -Os -std=c++11 -latomic -arch x86_64 -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'"
 	;;
 --prefix)
 	echo "/opt/local"
@@ -63,16 +63,16 @@
 	echo "/usr/bin/clang"
 	;;
 --cflags)
-	echo "-std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -Wimplicit-fallthrough -O3 -funroll-loops -pipe -Os -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk"
+	echo "-std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -Wimplicit-fallthrough -O3 -funroll-loops -pipe -Os -arch x86_64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk"
 	;;
 --cppflags)
 	echo "-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -D_REENTRANT"
 	;;
 --cxxflags)
-	echo "-Wimplicit-fallthrough -O3 -pipe -Os -std=c++11 -latomic -arch arm64 -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk"
+	echo "-Wimplicit-fallthrough -O3 -pipe -Os -std=c++11 -latomic -arch x86_64 -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk"
 	;;
 --ldflags)
-	echo "-L/opt/local/lib -Wl,-headerpad_max_install_names -arch arm64 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk "
+	echo "-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk "
 	;;
 --libs)
 	echo "-pthread"

I wonder how other universal builds deal with this? (This is the first time I am trying one.)

comment:5 Changed 2 years ago by kencu (Ken)

in general, by removing any arch specific settings; we want base and the build to set those up, not the jemalloc config file.

If there is an arch-specific setting that simply has to be used, then that can be a problem to manage properly and needs special attention. Consumers of the config file might also have to be looked at carefully in such a case.

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:6 Changed 2 years ago by kencu (Ken)

And I'm not sure that -latomic belongs in there. That is usually a gcc-only thing. Surprised it links, actually... guess it must not be on the link line.

comment:7 Changed 2 years ago by kencu (Ken)

the jemalloc port needs some attention. recent commits will need to be reviewed and probably mostly reverted.

Regarding the differences in the config files, look at the icu portfile for an idea about how to strip out the arch specific stuff.

comment:8 Changed 2 years ago by Ken <21211439+kencu@…>

Owner: set to Ken <21211439+kencu@…>
Resolution: fixed
Status: newclosed

In 44412d7dbfb8102f854a0353ce2645893e83dc17/macports-ports (master):

jemalloc: fix universal build

closes: #65213

comment:9 Changed 2 years ago by kencu (Ken)

I don't have an M1 to verify this right now, but this fix works on Intel Monterey, and should work on an M1 too. if not, pls reopen.

Note: See TracTickets for help on using tickets.