Opened 3 years ago
Last modified 13 months ago
#64260 new defect
ld64-127: may not correctly link executables for ppc64
Reported by: | barracuda156 | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | PowerPC, Leopard, ppc64 | Cc: | cooljeanius (Eric Gallager) |
Port: | ld64-127 |
Description
---> Configuring icu for architecture ppc64 Executing: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_icu/icu/work/icu/source-ppc64" && ./configure --prefix=/opt/local --disable-layoutex --disable-samples --enable-static checking for ICU version numbers... release 67.1, library 67.1, unicode version 13.0 checking build system type... powerpc-apple-darwin9.8.0 checking host system type... powerpc-apple-darwin9.8.0 checking whether to build debug libraries... no checking whether to build release libraries... yes checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_icu/icu/work/icu/source-ppc64': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_icu/icu/work/icu/source-ppc64" && ./configure --prefix=/opt/local --disable-layoutex --disable-samples --enable-static Exit code: 1 Error: Failed to configure icu: consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_icu/icu/work/icu/source-ppc64/config.log Error: Failed to configure icu: configure failure: command execution failed
Attachments (3)
Change History (24)
comment:1 follow-up: 2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Changed 3 years ago by barracuda156
Changed 3 years ago by barracuda156
Attachment: | config.log added |
---|
comment:2 Changed 3 years ago by barracuda156
Replying to ryandesign:
Please attach the main.log and config.log so that we can see why it "cannot run C compiled programs".
Sorry for delay, I have attached current logs for icu
now.
comment:3 follow-up: 6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Hmm, config.log says:
configure:3201: checking whether we are cross compiling onfigure:3209: /opt/local/bin/gcc-mp-7 -o conftest -pipe -Os -m64 -Wl,-headerpad_max_install_names -m64 conftest.c >&5 configure:3213: $? = 0 configure:3220: ./conftest ./configure: line 3222: 72533 Segmentation fault ./conftest$ac_cv_exeext configure:3224: $? = 139 configure:3231: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_icu/icu/work/icu/source-ppc64': configure:3233: error: cannot run C compiled programs.
Could you attach the conftest crash log?
comment:4 follow-ups: 5 15 Changed 3 years ago by kencu (Ken)
perhaps try building a simple "hello.c" and "hello.cxx" program with gcc7 as ppc64, and if they can be compiled, run them both to see if they work at all.
Uncharted territory. gcc7 could be totally broken building 64bit ppc code...
comment:5 Changed 3 years ago by barracuda156
Replying to kencu:
perhaps try building a simple "hello.c" and "hello.cxx" program with gcc7 as ppc64, and if they can be compiled, run them both to see if they work at all.
Uncharted territory. gcc7 could be totally broken building 64bit ppc code on darwin...
Hmm, doesn't look good:
36-225:Dev svacchanda$ gcc-mp-7 -arch ppc HelloWorld.c -o HelloWorld HelloWorld.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int] main() { ^~~~ 36-225:Dev svacchanda$ /Users/svacchanda/Dev/HelloWorld hello, world 36-225:Dev svacchanda$ gcc-mp-7 -arch ppc64 HelloWorld.c -o HelloWorld HelloWorld.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int] main() { ^~~~ 36-225:Dev svacchanda$ /Users/svacchanda/Dev/HelloWorld Segmentation fault 36-225:Dev svacchanda$ file /Users/svacchanda/Dev/HelloWorld /Users/svacchanda/Dev/HelloWorld: Mach-O 64-bit executable ppc64 36-225:Dev svacchanda$ gcc -arch ppc64 HelloWorld.c -o HelloWorld 36-225:Dev svacchanda$ /Users/svacchanda/Dev/HelloWorld hello, world 36-225:Dev svacchanda$ file /Users/svacchanda/Dev/HelloWorld /Users/svacchanda/Dev/HelloWorld: Mach-O 64-bit executable ppc64 36-225:Dev svacchanda$
64-bit file made by Apple gcc works, while the one made by Macports gcc7 fails.
- S. Basic program used:
#include <stdio.h> main() { printf("hello, world\n"); }
comment:6 Changed 3 years ago by barracuda156
Replying to ryandesign:
Could you attach the conftest crash log?
I didn't find that log now, but it looks like it's a compiler problem (see below).
Did I screw up gcc7 compilation somehow? I think I tried to make libquadmath build and used custom patches for that. I can build vanilla gcc6 and test if it can produce ppc64 binaries that actually work.
comment:7 follow-ups: 10 13 Changed 3 years ago by kencu (Ken)
first thing I would do is build gcc7 in an isolated way outside macports, with the default multilib left enabled, and see if it is broken building 64 bit then.
If it is, complain to gcc.
If that one works, then it's a macports issue of some kind...
comment:8 Changed 3 years ago by kencu (Ken)
Port: | gcc7 added; icu removed |
---|---|
Summary: | icu fails to configure for ppc64 → gcc7: cannot create executables for ppc64 |
comment:9 follow-up: 12 Changed 3 years ago by kencu (Ken)
I suppose, because building gcc7 is kinda hard and takes some hours on a G5, you might build your hello.c program with debugging code, run it under gdb, and see what you get there...
comment:10 Changed 3 years ago by barracuda156
Replying to kencu:
first thing I would do is build gcc7 in an isolated way outside macports, with the default multilib left enabled, and see if it is broken building 64 bit then.
If it is, complain to gcc.
If that one works, then it's a macports issue of some kind...
I will try that. In the meanwhile I have built gcc6 with Macports (no custom patches), and it fails for ppc64 alike:
36-225:~ svacchanda$ cd /Users/svacchanda/Dev 36-225:Dev svacchanda$ gcc-mp-6 -arch ppc64 HelloWorld.c -o HelloWorld HelloWorld.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int] main() { ^~~~ 36-225:Dev svacchanda$ /Users/svacchanda/Dev/HelloWorld Segmentation fault 36-225:Dev svacchanda$ file /Users/svacchanda/Dev/HelloWorld /Users/svacchanda/Dev/HelloWorld: Mach-O 64-bit executable ppc64 36-225:Dev svacchanda$ gcc-mp-6 -arch ppc HelloWorld.c -o HelloWorld HelloWorld.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int] main() { ^~~~ 36-225:Dev svacchanda$ /Users/svacchanda/Dev/HelloWorld hello, world 36-225:Dev svacchanda$
comment:11 Changed 3 years ago by barracuda156
Port: | gcc6 added |
---|
comment:12 Changed 3 years ago by barracuda156
Replying to kencu:
I suppose, because building gcc7 is kinda hard and takes some hours on a G5, you might build your hello.c program with debugging code, run it under gdb, and see what you get there...
How to make gbd work correctly?
36-225:~ svacchanda$ gdb GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:15:14 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-apple-darwin". (gdb) exec-file /Users/svacchanda/Dev/HelloWorld unable to read unknown load command 0x24 unable to read unknown load command 0x26 warning: A handler for the OS ABI "Darwin" is not built into this configuration of GDB. Attempting to continue with the default powerpc:common64 settings. Architecture of file "/Users/svacchanda/Dev/HelloWorld" does not match user selected architecture.
comment:13 Changed 3 years ago by barracuda156
Replying to kencu:
first thing I would do is build gcc7 in an isolated way outside macports, with the default multilib left enabled, and see if it is broken building 64 bit then.
If it is, complain to gcc.
If that one works, then it's a macports issue of some kind...
It fails to build as universal for me with:
libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/Users/svacchanda/Dev/gcc_all/gcc-7.5.0/build/./isl/.libs -lisl -L/Users/svacchanda/Dev/gcc_all/gcc-7.5.0/build/./gmp/.libs -L/Users/svacchanda/Dev/gcc_all/gcc-7.5.0/build/./mpfr/src/.libs -L/Users/svacchanda/Dev/gcc_all/gcc-7.5.0/build/./mpc/src/.libs -lmpc -lmpfr -lgmp -L./../zlib -lz ld: bl out of range (-19165716 max is +/-16M) from type_lists_compatible_p(tree_node const*, tree_node const*, bool*, bool*) at 0x10126E7F0 in __text_cold of c/c-typeck.o to c_build_qualified_type(tree_node*, int, tree_node*, unsigned long) at 0x100027690 in __text of c/c-typeck.o in type_lists_compatible_p(tree_node const*, tree_node const*, bool*, bool*) from c/c-typeck.o collect2: error: ld returned 1 exit status make[3]: *** [cc1] Error 1 make[3]: *** Waiting for unfinished jobs.... ld: bl out of range (-19486640 max is +/-16M) from toplev::main(int, char**) at 0x1012A8B40 in __text_startup of libbackend.a(toplev.o) to hash_table_higher_prime_index(unsigned long) at 0x1000135E0 in __text of hash-table.o in toplev::main(int, char**) from libbackend.a(toplev.o) collect2: error: ld returned 1 exit status make[3]: *** [cc1obj] Error 1 ld: bl out of range (-19268260 max is +/-16M) from finalization_scalarizer(gfc_symbol*, gfc_symbol*, gfc_expr*, gfc_namespace*) at 0x10133EE80 in __text_cold of fortran/class.o to gfc_get_code(gfc_exec_op) at 0x1000DEC10 in __text of fortran/st.o in finalization_scalarizer(gfc_symbol*, gfc_symbol*, gfc_expr*, gfc_namespace*) from fortran/class.o collect2: error: ld returned 1 exit status make[3]: *** [f951] Error 1 ld: bl out of range (-19401504 max is +/-16M) from mark_inline_variable(tree_node*) at 0x1013DABE0 in __text_cold of cp/decl.o to toplevel_bindings_p() at 0x10015A0E0 in __text of cp/name-lookup.o in mark_inline_variable(tree_node*) from cp/decl.o collect2: error: ld returned 1 exit status make[3]: *** [cc1plus] Error 1 make[2]: *** [all-stage2-gcc] Error 2 make[1]: *** [stage2-bubble] Error 2 make: *** [all] Error 2
Changed 3 years ago by barracuda156
Attachment: | config_gcc7.log added |
---|
Config log of gcc7 (non-Macports)
comment:14 Changed 3 years ago by barracuda156
Another port, fftw-3
, fails to configure due to the same problem:
---> Configuring fftw-3 for architecture ppc64 Executing: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/work/fftw-3.3.10-ppc64" && ./configure --prefix=/opt/local --enable-threads --enable-shared --with-our-malloc --enable-fma checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking build system type... powerpc-apple-darwin9.8.0 checking host system type... powerpc-apple-darwin9.8.0 checking for gcc... /opt/local/bin/gcc-mp-7 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/work/fftw-3.3.10-ppc64': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/work/fftw-3.3.10-ppc64" && ./configure --prefix=/opt/local --enable-threads --enable-shared --with-our-malloc --enable-fma Exit code: 1 Error: Failed to configure fftw-3: consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/work/fftw-3.3.10-ppc64/config.log Error: Failed to configure fftw-3: configure failure: command execution failed Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/main.log for details. Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug. Error: Processing of port fftw-3 failed 36-111:~ svacchanda$ bbedit /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_fftw-3/fftw-3/work/fftw-3.3.10-ppc64/config.log
comment:15 Changed 3 years ago by barracuda156
Replying to kencu:
perhaps try building a simple "hello.c" and "hello.cxx" program with gcc7 as ppc64, and if they can be compiled, run them both to see if they work at all.
Uncharted territory. gcc7 could be totally broken building 64bit ppc code on darwin...
Could it be linker-related problem? Referring to this: https://github.com/classilla/tenfourfox/issues/498#issuecomment-418912902
comment:16 Changed 3 years ago by barracuda156
It appears that with ld64-97
it works correctly:
36-197:Dev svacchanda$ /opt/local/bin/gcc-mp-7 -m64 -o hello64 hello.c 36-197:Dev svacchanda$ file hello64 hello64: Mach-O 64-bit executable ppc64 36-197:Dev svacchanda$ ./hello64 Hello, World 36-197:Dev svacchanda$ /opt/local/bin/gcc-mp-7 -v Using built-in specs. COLLECT_GCC=/opt/local/bin/gcc-mp-7 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/ppc-apple-darwin9/7.5.0/lto-wrapper Target: ppc-apple-darwin9 Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/gcc-7.5.0/configure --prefix=/opt/local --build=ppc-apple-darwin9 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc7 --includedir=/opt/local/include/gcc7 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-7 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-7 --with-gxx-include-dir=/opt/local/include/gcc7/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-tls --with-pkgversion='MacPorts gcc7 7.5.0_3+universal' Thread model: posix gcc version 7.5.0 (MacPorts gcc7 7.5.0_3+universal) 36-197:Dev svacchanda$ port -v installed ld64 The following ports are currently installed: ld64 @3_4+ld64_127 requested_variants='-universal' platform='darwin 9' archs='ppc' date='2021-12-21T12:38:46+0800' ld64 @3_4+ld64_97 (active) requested_variants='+ld64_97-universal' platform='darwin 9' archs='ppc' date='2022-01-09T14:30:09+0800'
https://github.com/iains/darwin-toolchains-start-here/discussions/8#discussioncomment-1967752
comment:18 follow-up: 19 Changed 3 years ago by kencu (Ken)
Port: | ld64-127 added; gcc7 gcc6 removed |
---|---|
Summary: | gcc7: cannot create executables for ppc64 → ld64-127: may not correctly link executables for ppc64 |
There are a couple of reports of trouble properly building ppc64 when ld64-127 is used as the linker.
ld64-97 seems to be working OK.
comment:19 follow-up: 21 Changed 2 years ago by barracuda156
Replying to kencu:
There are a couple of reports of trouble properly building ppc64 when ld64-127 is used as the linker.
ld64-97 seems to be working OK.
This ticket can be closed with: https://github.com/macports/macports-ports/pull/16420
comment:20 Changed 13 months ago by cooljeanius (Eric Gallager)
Cc: | cooljeanius added |
---|
comment:21 Changed 13 months ago by cooljeanius (Eric Gallager)
Replying to barracuda156:
Replying to kencu:
There are a couple of reports of trouble properly building ppc64 when ld64-127 is used as the linker.
ld64-97 seems to be working OK.
This ticket can be closed with: https://github.com/macports/macports-ports/pull/16420
This PR has since been merged.
Please attach the main.log and config.log so that we can see why it "cannot run C compiled programs".