Opened 3 years ago

Closed 3 years ago

#62722 closed defect (fixed)

libgpg-error @1.42: does not build universal

Reported by: epavlica Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version:
Keywords: universal bigsur Cc:
Port: libgpg-error

Description

when trying to install libgcrypto +universal variant for intel and m1 processors, the installation fails due to libgpg-error port, which is not available for arm64 architecture.

sudo port install libgcrypt +universal
Warning: The macOS 11.2 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.
--->  Computing dependencies for libgcrypt
Error: Cannot install libgcrypt for the archs 'arm64 x86_64' because
Error: its dependency libgpg-error cannot build for the required archs.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port libgcrypt failed

Note 1: The warning regarding SDK is persisting although I manually installed command-line tools 12.4 and XCode 12.3, accepted license and builded everything successfully (program was working) without +universal flag. Note 2: I attached main.log for xmlsec, which is the package, i need to install and which requires libgcrypt. I have tried many different things, therefore main.log is probably so large.

Attachments (1)

main.log (146.7 KB) - added by epavlica 3 years ago.
Log file

Download all attachments as: .zip

Change History (16)

Changed 3 years ago by epavlica

Attachment: main.log added

Log file

comment:1 Changed 3 years ago by mf2k (Frank Schima)

In the future, please add the port maintainer(s) to Cc (port info --maintainers libgcrypt), if any.

comment:2 Changed 3 years ago by mf2k (Frank Schima)

Owner: set to Schamschula
Port: libgpg-error added
Status: newassigned

comment:3 Changed 3 years ago by kencu (Ken)

at present, that port cannot be built universal on an Intel Mac for arm64/x86_64 due to the fact that it says it needs to be able to run binaries during the build for each system:

devel/libgpg-error/Portfile
46:    merger_must_run_binaries    yes

Whether it still really does need to that, and whether it can be fixed in some way to not need to do that, is an open question.

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

comment:4 in reply to:  3 Changed 3 years ago by epavlica

Thanks for your prompt response. I apologize if the following question is not in place: does this imply that I need to make a dmg package on m1 machine and then install it on intel machine to build my software (not a port) universal, which requires libgcrypt port?

Replying to kencu:

at present, that port cannot be built universal on an Intel Mac due to the fact that it says it needs to be able to run binaries during the build for each system:

devel/libgpg-error/Portfile
46:    merger_must_run_binaries    yes

Whether it still really does need to that, and whether it can be fixed in some way to not need to do that, is an open question.

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

we talked about allowing the Intel Mac to accept a premade universal package from an arm64 system (which could build it +universal as it can run the x86_64 binary during the build).

However, as far as I know, that was in the end not supported, as it was deemed to be just too confusing for people to understand what was going on.

You could try it.

Build libgpg-error +universal on your arm64 Mac, and then move the package into

/opt/local/var/macports/incoming/verified

and then try to get MacPorts to install the binary:

sudo port -v -b install libgpg-error +universal

and there is a chance it will do it. Most likely it will not. If it does not, you can delete perhaps the "mergers_must_run_binaries" line from the Portfile and try again.

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

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

Or -- dig in on the package and see if it is really true that it has to run binaries.

Sometimes these Portfiles were generated more than 10 years ago, and things could well have changed.

Or with motivation, be worked around.

comment:7 in reply to:  6 Changed 3 years ago by epavlica

I will try my best tomorrow as I will get access to m1 and submit the results here.

Replying to kencu:

Or -- dig in on the package and see if it is really true that it has to run binaries.

Sometimes these Portfiles were generated more than 10 years ago, and things could well have changed.

Or with motivation, be worked around.

comment:8 Changed 3 years ago by epavlica

I have been trying to build libgpg-error +universal on my arm64 mac, but it ends with the following error:

...
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//Applications/MacPorts
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin
Command failed: /usr/bin/cmp -s "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error" && /bin/cp -v "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin"
Exit code: 1
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpgrt-config -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin/gpgrt-config
Command failed: /usr/bin/cmp -s "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error-config" && /bin/cp -v "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin"
Exit code: 1
fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't figure out the architecture type of: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config
Command failed: /usr/bin/lipo -create "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error-config" -output "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin/gpg-error-config"
Exit code: 1
error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config is not an object file (not allowed in a library)
error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error-config is not an object file (not allowed in a library)
Command failed: /usr/bin/libtool "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error-config" -o "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin/gpg-error-config"
Exit code: 1
--->  Patching 1-gpg-error-config: s:-arch +[0-9a-zA-Z_]+::g
--->  Patching 2-gpg-error-config: s:-arch +[0-9a-zA-Z_]+::g
--->  Patching 1-gpg-error-config: s:-m32::g
--->  Patching 2-gpg-error-config: s:-m32::g
--->  Patching 1-gpg-error-config: s:-m64::g
--->  Patching 2-gpg-error-config: s:-m64::g
Command failed: /usr/bin/cmp -s "/tmp/muniversal.0ulRlYRA/1-gpg-error-config" "/tmp/muniversal.0ulRlYRA/2-gpg-error-config"
Exit code: 1
Error: Failed to destroot libgpg-error: gpg-error-config differs in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/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_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin and cannot be merged
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libgpg-error/libgpg-error/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port libgpg-error failed

Is this error familiar to anyone? It is comparing different distroot files, but then fails with lipo command.

Many thanks.

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

years ago the port was modified so it could build universal on powerpc systems

https://github.com/macports/macports-ports/commit/c5d009a417a235a0777f101b23b09c19943614ee

You might try just reverting the bulk of that commit and see what happens now building universal for srm/Intel

comment:10 Changed 3 years ago by epavlica

I found that the porting creates x86_64 and arm64 destroot. There are also scripts like gpg-error-config. And lipo fails when it wants to merge both archs together into fat file.

...
DEBUG: system: /usr/bin/lipo -create "/opt/local/var/macports/build/_Users_pavlica_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config" "/opt/local/var/macports/build/_Users_pavlica_ports_devel_libgpg-error/libgpg-error/work/destroot-ppc-intel//opt/local/bin/gpg-error-config" -output "/opt/local/var/macports/build/_Users_pavlica_ports_devel_libgpg-error/libgpg-error/work/destroot//opt/local/bin/gpg-error-config"
fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't figure out the architecture type of: /opt/local/var/macports/build/_Users_pavlica_ports_devel_libgpg-error/libgpg-error/work/destroot-arm64//opt/local/bin/gpg-error-config

Do you maybe have any hint on how to control merge process?

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

Keywords: universal bigsur added
Port: libgcrypt removed
Summary: libgcrypt @1.9.3+universal: dependency libgpg-error cannot build for the required archs (arm64 x86_64)libgpg-error @1.42: does not build universal

comment:13 Changed 3 years ago by kencu (Ken)

I used a similar fix to what I did in icu. It is not, perhaps, beautiful, or elegant, but it is practical and a minimal change from what we have.

% port -v installed libgpg-error
The following ports are currently installed:
  libgpg-error @1.42_0+universal (active) platform='darwin 20' archs='arm64 x86_64' date='2021-05-01T14:22:12-0700'
 % file /opt/local/lib/libgpg-error.dylib
/opt/local/lib/libgpg-error.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/libgpg-error.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libgpg-error.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

I'll throw up a PR for critique.

comment:14 Changed 3 years ago by kencu (Ken)

seems to work, passes 100% of tests.

https://github.com/macports/macports-ports/pull/10866

what is impossible for me to do easily is to try to run the tests as arm64 on an Intel machine (ie test the cross-compiled bits). If anyone knows an elegant way to do that, even involving an Apple M1 machine, please speak up.

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

comment:15 Changed 3 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In 0fc75de09027eee709aad99e57239d1ac89c89e4/macports-ports (master):

libgpg-error: fix universal build on BigSur

only use the muniversal PG on < 10.14

closes: #62722

Note: See TracTickets for help on using tickets.