Opened 7 years ago

Closed 7 years ago

#13309 closed bug (fixed)

Jam segfault on --host-only build.

Reported by: kallisti5 Owned by: bonefish
Priority: normal Milestone: Unscheduled
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Attempting to perform a host-only build (for the tools) results in a segfault from Jam on Fedora 25 x86_64 and Ubuntu 16.10 x86_64.

debug:

>>>>|>>>>|>>>>|>>>>|>>>>|>> set TARGET_DEBUG_5_LOCATE_TARGET  = add-ons/kernel/cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set LOCATE_TARGET  = /home/kallisti5/Code/haiku/generated.tools/objects/common/add-ons/kernel/cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set LOCATE_SOURCE  = /home/kallisti5/Code/haiku/generated.tools/objects/common/add-ons/kernel/cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set SEARCH_SOURCE  = /home/kallisti5/Code/haiku/src/add-ons/kernel/cpu /home/kallisti5/Code/haiku/generated.tools/objects/common/add-ons/kernel/cpu /home/kallisti5/Code/haiku/generated.tools/objects/linux/x86_64/common/add-ons/kernel/cpu add-ons/kernel/cpu 
>>>>|>>>>|>>>>|>>>>|>>> SubInclude HAIKU_TOP src add-ons kernel cpu 
>>>>|>>>>|>>>>|>>>>|>>>>| ConfigObject HAIKU_TOP src add-ons kernel cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> local config  = __config__ 
>>>>|>>>>|>>>>|>>>>|>>>>|>> FGrist root HAIKU_TOP src add-ons kernel cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> local grist  = root!HAIKU_TOP!src!add-ons!kernel!cpu 
>>>>|>>>>|>>>>|>>>>|>>>>| local config  = <root!HAIKU_TOP!src!add-ons!kernel!cpu>__config__ 
>>>>|>>>>|>>>>|>>>>|>>>>| set __configured  = 
>>>>|>>>>|>>>>|>>>>|>>>>| on <root!HAIKU_TOP!src!add-ons!kernel!cpu>__config__ 
>>>>|>>>>|>>>>|>>>>|>>>>| set config  = <root>__config__ 
>>>>|>>>>|>>>>|>>>>|>>>>| local oldSubDirTokens  = src add-ons kernel cpu 
>>>>|>>>>|>>>>|>>>>|>>>>| on <root>__config__ 
>>>>|>>>>|>>>>|>>>>|>>>>| FDirName /home/kallisti5/Code/haiku src add-ons kernel cpu Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>>|>> local _i  = 
>>>>|>>>>|>>>>|>>>>|>>>>|>> local _s  = . 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku/src 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku/src/add-ons 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku/src/add-ons/kernel 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku/src/add-ons/kernel/cpu 
>>>>|>>>>|>>>>|>>>>|>>>>|>> set _s  = /home/kallisti5/Code/haiku/src/add-ons/kernel/cpu/Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>>| include /home/kallisti5/Code/haiku/src/add-ons/kernel/cpu/Jamfile 
Segmentation fault (core dumped)
(gdb) run -q \<build\>package
Starting program: /usr/local/bin/jam -q \<build\>package
Starting build of type regular ... 
AddHaikuImagePackages: package bash not available! 
AddHaikuImagePackages: package coreutils not available! 
AddHaikuImagePackages: package curl not available! 
AddHaikuImagePackages: package freetype not available! 
AddHaikuImagePackages: package icu not available! 
AddHaikuImagePackages: package libsolv not available! 
AddHaikuImagePackages: package zlib not available! 
AddHaikuImagePackages: package gcc_syslibs not available! 
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/config_manager/arch/Jamfile: No such file or directory
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/isa/arch/Jamfile: No such file or directory
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/pci/arch/Jamfile: No such file or directory

Program received signal SIGSEGV, Segmentation fault.
0x000055555555ec34 in file_time ()

Attachments (1)

gdb.txt (4.8 MB ) - added by kallisti5 7 years ago.
bt of jam compiled with -g

Change History (11)

comment:1 by kallisti5, 7 years ago

reproduction steps:

mkdir generated.tools && cd generated.tools
../configure --host-only
jam -q \<build\>package
<segfault>

comment:2 by pulkomandy, 7 years ago

backtrace, please...

by kallisti5, 7 years ago

Attachment: gdb.txt added

bt of jam compiled with -g

comment:3 by kallisti5, 7 years ago

valgrind is interesting...

$ valgrind jam -q \<build\>package
==15351== Memcheck, a memory error detector
==15351== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==15351== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==15351== Command: jam -q \<build\>package
==15351== 
Starting build of type regular ... 
AddHaikuImagePackages: package bash not available! 
AddHaikuImagePackages: package coreutils not available! 
AddHaikuImagePackages: package curl not available! 
AddHaikuImagePackages: package freetype not available! 
AddHaikuImagePackages: package icu not available! 
AddHaikuImagePackages: package libsolv not available! 
AddHaikuImagePackages: package zlib not available! 
AddHaikuImagePackages: package gcc_syslibs not available! 
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/config_manager/arch/Jamfile: No such file or directory
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/isa/arch/Jamfile: No such file or directory
/home/kallisti5/Code/haiku/src/add-ons/kernel/bus_managers/pci/arch/Jamfile: No such file or directory
==15351== Stack overflow in thread #1: can't grow stack to 0xffe801000
==15351== 
==15351== Process terminating with default action of signal 11 (SIGSEGV)
==15351==  Access not within mapped region at address 0xFFE801FC8
==15351== Stack overflow in thread #1: can't grow stack to 0xffe801000
==15351==    at 0x1142AC: jcache (in /usr/local/bin/jam)
==15351==  If you believe this happened as a result of a stack
==15351==  overflow in your program's main thread (unlikely but
==15351==  possible), you can try to increase the size of the
==15351==  main thread stack using the --main-stacksize= flag.
==15351==  The main thread stack size used in this run was 8388608.
==15351== Stack overflow in thread #1: can't grow stack to 0xffe801000
==15351== 
==15351== Process terminating with default action of signal 11 (SIGSEGV)
==15351==  Access not within mapped region at address 0xFFE801FC0
==15351== Stack overflow in thread #1: can't grow stack to 0xffe801000
==15351==    at 0x4A276C0: _vgnU_freeres (in /usr/lib/valgrind/vgpreload_core-amd64-linux.so)
==15351==  If you believe this happened as a result of a stack
==15351==  overflow in your program's main thread (unlikely but
==15351==  possible), you can try to increase the size of the
==15351==  main thread stack using the --main-stacksize= flag.
==15351==  The main thread stack size used in this run was 8388608.
==15351== 
==15351== HEAP SUMMARY:
==15351==     in use at exit: 38,121,591 bytes in 1,001,187 blocks
==15351==   total heap usage: 1,679,302 allocs, 678,115 frees, 65,237,832 bytes allocated
==15351== 
==15351== LEAK SUMMARY:
==15351==    definitely lost: 24 bytes in 1 blocks
==15351==    indirectly lost: 0 bytes in 0 blocks
==15351==      possibly lost: 0 bytes in 0 blocks
==15351==    still reachable: 38,121,567 bytes in 1,001,186 blocks
==15351==         suppressed: 0 bytes in 0 blocks
==15351== Rerun with --leak-check=full to see details of leaked memory
==15351== 
==15351== For counts of detected and suppressed errors, rerun with: -v
==15351== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

comment:4 by pulkomandy, 7 years ago

Looks like infinite recursion? What does strace say? My guess is we have some $(ARCH) variable, and some Jamfile tries to include currentDir/$(ARCH)/Jamfile and ends up including itself. Rather blind guess, but if that's the case, we could trace open() calls and see which Jamfile could be doing something like that.

comment:5 by kallisti5, 7 years ago

The jam debug output shows it? :-)

/home/kallisti5/Code/haiku/src/add-ons/kernel/cpu/Jamfile
/home/kallisti5/Code/haiku/src/add-ons/kernel/cpu//Jamfile

TARGET_KERNEL_ARCH ?

comment:6 by kallisti5, 7 years ago

I disabled the add-on when doing host-only builds:

diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index cdf1a3c..6a616ab 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -123,6 +123,7 @@ for architecture in $(HAIKU_PACKAGING_ARCHS) {
 # TODO: Might not be needed anymore.
 if $(HAIKU_HOST_BUILD_ONLY) = 1 {
        HAIKU_GCC_VERSION = 0 0 0 ;
+       TARGET_KERNEL_ARCH = x86 ;
 }
 
 if $(HAIKU_PACKAGING_ARCH) {

Ran into another loop:

>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>>>|>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>>|>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>>|>>>>|>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 
>>>>|>>>>|>>>>|>>>>|>>>>|>>>>|>>>> include /home/kallisti5/Code/haiku/src/libs/libunwind/Jamfile 

That one is "TARGET_ARCH"

Version 0, edited 7 years ago by kallisti5 (next)

comment:7 by kallisti5, 7 years ago

It appears to be due to the lack of ArchitectureSetup running because HAIKU_PACKAGING_ARCHS is empty. ArchitectureSetup won't run with a dummy arch because it validates the cross compiler :-| how did this stuff ever work post-pm?

comment:8 by kallisti5, 7 years ago

woot. pretty sure I fixed it. Running build tests on other platforms before pushing.

Last edited 7 years ago by kallisti5 (previous) (diff)

in reply to:  1 comment:9 by idefix, 7 years ago

Replying to kallisti5:

reproduction steps:

mkdir generated.tools && cd generated.tools
../configure --host-only
jam -q \<build\>package
<segfault>

What happens if you try:

mkdir generated.tools && cd generated.tools
../configure --host-only --target=host
jam -q \<build\>package

That fixed building bfs_fuse on linux for me, see ticket:12248.

Last edited 7 years ago by idefix (previous) (diff)

comment:10 by kallisti5, 7 years ago

Resolution: fixed
Status: newclosed

resolved (correctlyish) via hrev50957 :-)

--target=host isn't needed anymore. That might make more sense than --host-only... however --host-only sets a bunch of flags --target=host doesn't... so for now we fix the issue without reworking the host target.

Note: See TracTickets for help on using tickets.