Opened 3 years ago

Closed 2 years ago

#64485 closed defect (fixed)

libffi fails to build on 10.6.8 for ppc (under Rosetta) – solution found

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: powerpc Cc:
Port: libffi

Description

libtool: link: /usr/bin/gcc-4.2 -dynamiclib  -o .libs/libffi.8.dylib  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/.libs/tramp.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o   -L/opt/powerpc/lib  -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc -Wl,-headerpad_max_install_names -arch ppc   -install_name  /opt/powerpc/lib/libffi.8.dylib -compatibility_version 10 -current_version 10.0 -Wl,-single_module
Undefined symbols:
  "_ffi_prep_closure_loc", referenced from:
      _ffi_prep_closure in prep_cif.o
  "_ffi_prep_cif_machdep", referenced from:
      _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_raw_closure_loc", referenced from:
      _ffi_prep_raw_closure in raw_api.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [libffi.la] Error 1
make[3]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make: *** [all] Error 2
make: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2'
Command failed:  cd "/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2" && /usr/bin/make -j8 -w all 
Exit code: 2
Error: Failed to build libffi: command execution failed
Error: See /opt/powerpc/var/macports/logs/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/main.log for details.

Attachments (1)

main.log (71.3 KB) - added by barracuda156 3 years ago.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by barracuda156

Attachment: main.log added

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

There are many occurrences of "x86" in the log, suggesting to me that the build system needs more than just -arch flags to tell it what architectures to build for.

The port already uses the muniversal portgroup and includes these lines to assist with that process for ppc64:

array set merger_host {
    ppc64 powerpc-apple-darwin
}

Try changing this to:

array set merger_host {
    ppc powerpc-apple-darwin
    ppc64 powerpc-apple-darwin
}

comment:2 in reply to:  1 Changed 3 years ago by barracuda156

Replying to ryandesign:

There are many occurrences of "x86" in the log, suggesting to me that the build system needs more than just -arch flags to tell it what architectures to build for.

Yeah, I noticed that, but could not figure out how to fix it. I got only ppc as build arch in settings, I even tried to specify it directly when calling sudo port -v install, to no effect.

The port already uses the muniversal portgroup and includes these lines to assist with that process for ppc64:

array set merger_host {
    ppc64 powerpc-apple-darwin
}

Try changing this to:

array set merger_host {
    ppc powerpc-apple-darwin
    ppc64 powerpc-apple-darwin
}

Tried, same failure:

libtool: link: /usr/bin/gcc-4.2 -dynamiclib  -o .libs/libffi.8.dylib  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/.libs/tramp.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o   -L/opt/powerpc/lib  -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc -Wl,-headerpad_max_install_names -arch ppc   -install_name  /opt/powerpc/lib/libffi.8.dylib -compatibility_version 10 -current_version 10.0 -Wl,-single_module
Undefined symbols:
  "_ffi_prep_closure_loc", referenced from:
      _ffi_prep_closure in prep_cif.o
  "_ffi_prep_cif_machdep", referenced from:
      _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_raw_closure_loc", referenced from:
      _ffi_prep_raw_closure in raw_api.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [libffi.la] Error 1
make[3]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2/x86_64-apple-darwin10.8.0'
make: *** [all] Error 2
make: Leaving directory `/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2'
Command failed:  cd "/opt/powerpc/var/macports/build/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/work/libffi-3.4.2" && /usr/bin/make -j8 -w all 
Exit code: 2
Error: Failed to build libffi: command execution failed
Error: See /opt/powerpc/var/macports/logs/_opt_powerpc_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libffi/libffi/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port libffi failed
Sergey-Fedorovs-Mac-mini:bin svacchanda$ 

comment:3 in reply to:  1 Changed 3 years ago by barracuda156

Replying to ryandesign:

Can we set --build=powerpc-apple-darwin10, --with-ld= and --with-as= directly? I have built gcc10 on this system for ppc (via Rosetta), basic packages must work – but they don't...

comment:4 in reply to:  1 Changed 3 years ago by barracuda156

Replying to ryandesign:

Ok, I have found a way to make needed settings and build it:

Sergey-Fedorovs-Mac-mini:~ svacchanda$ port -v installed libffi
The following ports are currently installed:
  libffi @3.4.2_2 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-01-23T07:45:23+0800'

Here is what I added to the port file (probably an overkill, but something of these worked):

configure.args-append       CC_FOR_BUILD="gcc-4.2 -arch ppc" \
                            CFLAGS_FOR_BUILD="-arch ppc" \
                            --build=powerpc-apple-darwin10 \
                            --with-ld=/usr/bin/ld \
                            --with-as=/usr/bin/as

comment:5 Changed 3 years ago by barracuda156

Summary: libffi fails to build on 10.6.8 for ppc (under Rosetta)libffi fails to build on 10.6.8 for ppc (under Rosetta) – solution found

comment:6 Changed 3 years ago by barracuda156

  1. S. If it is added as an option conditional on building on 10.6 Intel/Rosetta, this would fix the problem for others who may wish to do that. (Problem does not arise on 10.6 PPC, there libffi builds as-is.)

comment:8 Changed 2 years ago by barracuda156

Owner: set to barracuda156
Resolution: fixed
Status: newclosed

In b9dbccce898e56482aa17d0359b280f18e18f7d7/macports-ports (master):

libffi: fix build on Rosetta
Fixes: #64485

Note: See TracTickets for help on using tickets.