pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/60439: lang/gcc12 fails to build on NetBSD/macppc 11.0_RC6 but succeeds on 10.0



>Number:         60439
>Category:       pkg
>Synopsis:       lang/gcc12 fails to build on NetBSD/macppc 11.0_RC6 but succeeds on 10.0
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 10 21:25:00 +0000 2026
>Originator:     Havard Eidnes
>Release:        NetBSD 11.0_RC6
>Organization:
	I try...
>Environment:
System: NetBSD bramley.urc.uninett.no 11.0_RC6 NetBSD 11.0_RC6 (BRAMLEY) #3: Thu Jul  9 23:46:40 CEST 2026  he%bramley.urc.uninett.no@localhost:/usr/obj/sys/arch/macppc/compile/BRAMLEY macppc
Architecture: powerpc
Machine: macppc
>Description:
	The lang/gcc12 package fails to build on NetBSD/macppc 11.0_RC6,
	while it succeeds on 10.0.

	The build log contains, after 1:53h wallclock time on this system:

checking whether we are cross compiling... configure: error: in `/usr/pkgsrc/lang/gcc12/work/build/powerpc--netbsd/soft-float/libgcc':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
gmake[2]: *** [Makefile:22318: configure-stage1-target-libgcc] Error 1

	The config.log file in work/build/powerpc--netbsd/soft-float/libgcc
	ends with

configure:3748: checking whether we are cross compiling
configure:3756: /usr/pkgsrc/lang/gcc12/work/build/./gcc/xgcc -B/usr/pkgsrc/lang/gcc12/work/build/./gcc/ -B/usr/pkg/gcc12/powerpc--netbsd/bin/ -B/usr/pkg/gcc12/powerpc--netbsd/lib/ -isystem /usr/pkg/gcc12/powerpc--netbsd/include -isystem /usr/pkg/gcc12/powerpc--netbsd/sys-include -fno-checking  -msoft-float -fPIC -mstrict-align -o conftest -g -O2 -I/usr/include  -Wl,-zrelro conftest.c  >&5
configure:3760: $? = 0
configure:3767: ./conftest
[1]   Abort trap              ./conftest${ac_cv_exeext}
configure:3771: $? = 134
configure:3778: error: in `/usr/pkgsrc/lang/gcc12/work/build/powerpc--netbsd/soft-float/libgcc':
configure:3782: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

	and inspecting around line 3748 in the configure script reveals
	the conftest.c contents to be

#include <stdio.h>
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
 return ferror (f) || fclose (f) != 0;

  ;
  return 0;
}

	Re-doing the build as above does indeed produce an executable
	which just exits with "Abort":

$ ./conftest
[1]   Abort trap              ./conftest
$ 

	Doing ktrace -i of the program reveals almost nothing:

$ ktrace -i ./conftest
[1]   Abort trap              ktrace -i ./conftest
$ kdump
 25558  25558 ktrace   EMUL  "netbsd"
 25558  25558 ktrace   CALL  execve(0xfffdd6c6,0xfffdd1cc,0xfffdd1d4)
 25558  25558 ktrace   NAMI  "/usr/pkgsrc/lang/gcc12/work/build/powerpc--netbsd/soft-float/libgcc/./conftest"
 25558  25558 ktrace   NAMI  "/usr/libexec/ld.elf_so"
$ 

	Running ut under gdb makes it succeed:

$ gdb -q conftest
Reading symbols from conftest...
(gdb) run
Starting program: /usr/pkgsrc/lang/gcc12/work/build/powerpc--netbsd/soft-float/libgcc/conftest 
[Inferior 1 (process 14924) exited normally]
(gdb) quit
$ 

	Changing the "m" PaX flag also makes it succeed:

$ paxctl conftest
No PaX flags.
$ paxctl +m conftest
$ paxctl conftest
PaX flags:
  m: mprotect(2) restrictions, explicit disable
$ ./conftest
$ echo $?
0
$ 

	Looking at the program headers with "readelf -a" shows
	among other things:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x01800034 0x01800034 0x00100 0x00100 R   0x4
  INTERP         0x000134 0x01800134 0x01800134 0x00017 0x00017 R   0x1
      [Requesting program interpreter: /usr/libexec/ld.elf_so]
  LOAD           0x000000 0x01800000 0x01800000 0x00c20 0x00c20 R E 0x10000
  LOAD           0x00fec8 0x0181fec8 0x0181fec8 0x0014c 0x0024c RWE 0x10000
  DYNAMIC        0x00ff48 0x0181ff48 0x0181ff48 0x000b8 0x000b8 RW  0x4
  NOTE           0x00014c 0x0180014c 0x0180014c 0x0002c 0x0002c R   0x4
  GNU_EH_FRAME   0x000a70 0x01800a70 0x01800a70 0x0003c 0x0003c R   0x4
  GNU_RELRO      0x00fec8 0x0181fec8 0x0181fec8 0x00138 0x00138 R   0x1

	while the same program compiled with basically the same options
	by the in-tree compiler results in a slight difference:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x01800034 0x01800034 0x00100 0x00100 R   0x4
  INTERP         0x000134 0x01800134 0x01800134 0x00017 0x00017 R   0x1
      [Requesting program interpreter: /usr/libexec/ld.elf_so]
  LOAD           0x000000 0x01800000 0x01800000 0x00d04 0x00d04 R E 0x10000
  LOAD           0x00febc 0x0181febc 0x0181febc 0x00170 0x001b0 RW  0x10000
  DYNAMIC        0x00ff3c 0x0181ff3c 0x0181ff3c 0x000b8 0x000b8 RW  0x4
  NOTE           0x00014c 0x0180014c 0x0180014c 0x0002c 0x0002c R   0x4
  GNU_EH_FRAME   0x000b38 0x01800b38 0x01800b38 0x00044 0x00044 R   0x4
  GNU_RELRO      0x00febc 0x0181febc 0x0181febc 0x00144 0x00144 R   0x1

	Notice that the first one has a segment with both 'W' and 'E'
	flags set, which looks wrong.

	Doing the two builds with '-v' option reveals that the package
	uses its own collect2 program to link:

 /usr/pkgsrc/lang/gcc12/work/build/./gcc/collect2 -plugin /usr/pkgsrc/lang/gcc12/work/build/./gcc/liblto_plugin.so -plugin-opt=/usr/pkgsrc/lang/gcc12/work/build/./gcc/lto-wrapper -plugin-opt=-fresolution=/tmp//ccG9V0da.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.elf_so -o conftest /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/pkg/gcc12/powerpc--netbsd/lib/soft-float -L/usr/pkgsrc/lang/gcc12/work/build/./gcc -L/usr/pkg/gcc12/powerpc--netbsd/lib -R/usr/pkg/gcc12/powerpc--netbsd/lib/soft-float -R/usr/pkg/gcc12/lib/soft-float -zrelro /tmp//ccFtnYVI.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/crtend.o /usr/lib/crtn.o

	while the in-tree compiler uses 'ld':

 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper -plugin-opt=-fresolution=/tmp//cceKrxcm.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.elf_so -o conftest.in-tree-gcc /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o -zrelro /tmp//cctmwYeg.o --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o /usr/lib/crtn.o

	But still, why the inside-gcc collect2 does what it does
	I do not know.

	And ... I'm also surprised that this package successfully
	builds on NetBSD/macppc 10.0.

	"Help!"

>How-To-Repeat:
	See above.
>Fix:
	Would be nice.



Home | Main Index | Thread Index | Old Index