Opened 3 months ago

Closed 3 months ago

#62173 closed defect (worksforme)

GMP do not compile under BigSur with Inel computer for ARM64 target

Reported by: cgilles (HumanDynamo) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: gmp

Description

With i cross compile for arm64 with BigSur on a Intel computer, GMP port fail.

maCOS 11.1 ; Xcode 12.3 12C33

MacPorts 2.6.4
Entering shell mode... ("help" for help, "quit" to quit)
[macports/tools] > clean gmp
--->  Cleaning gmp
[macports/tools] > install gmp
--install'.
--->  Fetching distfiles for gmp
--->  Verifying checksums for gmp
--->  Extracting gmp
--->  Applying patches to gmp
--->  Configuring gmp
Error: Failed to configure gmp, consult /opt/digikam.org.arm64/var/macports/build/_opt_digikam.org.arm64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gmp/gmp/work/gmp-6.2.1/config.log
Error: Failed to configure gmp: configure failure: command execution failed
Error: See /opt/digikam.org.arm64/var/macports/logs/_opt_digikam.org.arm64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gmp/gmp/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port gmp failed

my macports.conf configuration file is customized like this :

+no_root -startupitem
startupitem_type none
startupitem_install no
macosx_deployment_target 11.0
build_arch arm64

There is nothing customized in variants.conf.

Log file is attached.

Attachments (2)

main.log (9.1 KB) - added by cgilles (HumanDynamo) 3 months ago.
GMP compilation trace
config.log (10.8 KB) - added by cgilles (HumanDynamo) 3 months ago.
GMP config trace

Download all attachments as: .zip

Change History (14)

Changed 3 months ago by cgilles (HumanDynamo)

Attachment: main.log added

GMP compilation trace

comment:1 in reply to:  description Changed 3 months ago by ryandesign (Ryan Schmidt)

Replying to cgilles:

Error: Failed to configure gmp, consult /opt/digikam.org.arm64/var/macports/build/_opt_digikam.org.arm64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gmp/gmp/work/gmp-6.2.1/config.log

Please attach the above file.

comment:2 Changed 3 months ago by cgilles (HumanDynamo)

main.log file is already attached...

comment:3 Changed 3 months ago by ryandesign (Ryan Schmidt)

But the config.log, which will tell us why it failed, is not.

Changed 3 months ago by cgilles (HumanDynamo)

Attachment: config.log added

GMP config trace

comment:4 Changed 3 months ago by kencu (Ken)

Not certain what we are going to do here. Might have to build the universal version on the arm64 machine, and let the Intel systems download it.

This is another one that tries to run test software during the configuration and/or build, and that doesn't work on an Intel system.

87	configure:5940: /usr/bin/clang -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -arch arm64 -O2 -pedantic -fomit-frame-pointer -m64 -I/opt/digikam.org.arm64/include conftest.c >&5
88	configure:5943: $? = 0
89	configure:5948: ./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest
90	./configure: line 5949: ./a.out: Bad CPU type in executable

comment:5 Changed 3 months ago by cgilles (HumanDynamo)

Ken,

Look the story from users mailing list for details about the context, and why i post this report here:

https://lists.macports.org/pipermail/macports-users/2021-January/049416.html

Best

Gilles Caulier

comment:6 Changed 3 months ago by jmroot (Joshua Root)

True cross-compiling (where the build machine can't run the built binaries) has a good chance of not working in general. Sometimes it takes extra configure parameters or toolchain files, and sometimes it just can't work without a major refactor of the way a project's build system is set up. We historically have not actively pursued this, and I wouldn't blame any maintainer for not wanting to put in the effort in to support it. Universal builds are better supported because the build machine can usually run at least one of the archs.

comment:7 Changed 3 months ago by kencu (Ken)

It is likely going to be much easier to build this +universal on an Apple Silicon machine, which can run both archs (via Rosetta2). (same with cmake +universal, and any others that need to run things during the build).

If we could get that built and on the buildbot, everyone could download it.

I don't know if we can build it +universal on an Intel system, but I'll take a look this weekend.

comment:8 Changed 3 months ago by cgilles (HumanDynamo)

Thanks for the feedback.

Do you mean that i need to buy a Silicon computer to be able to compile a arm64 only target ?

Or if i cross compile with universal, aka x86_64 + arm64 machine codes in targets, i will able to complete a compilation of all ports without failure ?

In this last case, it will be trivial to strip x86_64 symbols at end to only obtain pure arm64 binaries ? Or this solution is not the right way definitively ?

Best

Gilles Caulier

comment:9 Changed 3 months ago by jmroot (Joshua Root)

It's worth trying +universal on Intel, sure. I think muniversal makes some attempt to supply the right --host parameter to autoconf-based configure scripts to trigger an appropriate cross-compilation mode.

comment:10 Changed 3 months ago by kencu (Ken)

well, I had no troubles -- didn't touch a single thing in the Portfile, and the universal gmp built through on BigSur Intel as is:

macOS 11.1 20C69
Xcode 12.4 12D4e
% uname -a
Darwin 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64

 % port -v installed gmp
The following ports are currently installed:
  gmp @6.2.1_0 platform='darwin 20' archs='x86_64' date='2020-12-27T18:45:26-0800'
  gmp @6.2.1_0+universal (active) platform='darwin 20' archs='arm64 x86_64' date='2021-01-29T17:12:05-0800'

% port contents gmp
Port gmp contains:
  /opt/local/include/gmp.h
  /opt/local/include/gmpxx.h
  /opt/local/lib/libgmp.10.dylib
  /opt/local/lib/libgmp.a
  /opt/local/lib/libgmp.dylib
  /opt/local/lib/libgmpxx.4.dylib
  /opt/local/lib/libgmpxx.a
  /opt/local/lib/libgmpxx.dylib
  /opt/local/lib/pkgconfig/gmp.pc
  /opt/local/lib/pkgconfig/gmpxx.pc
  /opt/local/share/info/gmp.info
  /opt/local/share/info/gmp.info-1
  /opt/local/share/info/gmp.info-2

% file /opt/local/lib/libgmp.dylib
/opt/local/lib/libgmp.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
/opt/local/lib/libgmp.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libgmp.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

comment:11 Changed 3 months ago by kencu (Ken)

I don't think you should be setting your build_arch to arm64 in macports.conf.

That could be your problem -- and you don't have to do that, I think. Just build things +universal, and we'll fix up what needs to be fixed up along the way.

comment:12 Changed 3 months ago by kencu (Ken)

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.