beefytech / Beef

Beef Programming Language
http://www.beeflang.org
Other
2.51k stars 130 forks source link

Build failing on macOS: Segfault BeefBoot #1535

Open BuzzwordChief opened 2 years ago

BuzzwordChief commented 2 years ago

While trying to build Beef for macOS from source I ran into a Segfault with BeefBoot.

Info:

Output:

bc ~/opt/Beef/bin % ./build.sh
Starting build.sh
Building from from /Users/bc/opt/Beef/bin
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bc/opt/Beef/jbuild_d
Consolidate compiler generated dependencies of target hunspell
[  5%] Built target hunspell
Consolidate compiler generated dependencies of target BeefySysLib
[ 74%] Built target BeefySysLib
Consolidate compiler generated dependencies of target IDEHelper
[ 93%] Built target IDEHelper
Consolidate compiler generated dependencies of target BeefBoot
[ 94%] Built target BeefBoot
Consolidate compiler generated dependencies of target BeefRT
[100%] Built target BeefRT
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bc/opt/Beef/jbuild
Consolidate compiler generated dependencies of target hunspell
[  5%] Built target hunspell
Consolidate compiler generated dependencies of target BeefySysLib
[ 74%] Built target BeefySysLib
Consolidate compiler generated dependencies of target IDEHelper
[ 93%] Built target IDEHelper
Consolidate compiler generated dependencies of target BeefBoot
[ 94%] Built target BeefBoot
Consolidate compiler generated dependencies of target BeefRT
[100%] Built target BeefRT
Building BeefBuild_bootd
[******************************]
TIMING: Beef compiling: 45.8s
WARNING: BF0168: The variable 'llvmDir' is assigned but its value is never used at line 637:13 in /Users/bc/opt/Beef/IDE/src/BuildContext.bf
     String llvmDir = "";     
            ^
Errors: 0. Warnings: 1.
Linking BeefBuild_bootd...ld: can't write output file: BeefBuild_bootd for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FAIL: Exit code returned: 1

./build.sh: line 73: 51645 Segmentation fault: 11  ../../jbuild_d/Debug/bin/BeefBoot --out="BeefBuild_bootd" --src=../src --src=../../BeefBuild/src --src=../../BeefLibs/corlib/src --src=../../BeefLibs/Beefy2D/src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="./libBeefRT_d.a ./libIDEHelper_d.$LIBEXT ./libBeefySysLib_d.$LIBEXT $(< ../../IDE/dist/IDEHelper_libs_d.txt) $LINKOPTS"
bc ~/opt/Beef/bin [139] %
bfiete commented 2 years ago

The can't write output file: BeefBuild_bootd seems like a clue. Some sort of permissions issue?

BuzzwordChief commented 2 years ago

I forgot to delete the executable after I rerun the build script because of the segfault.

bc ~/opt/Beef/bin [139] % ./build.sh
Starting build.sh
Building from from /Users/bc/opt/Beef/bin
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bc/opt/Beef/jbuild_d
Consolidate compiler generated dependencies of target hunspell
[  5%] Built target hunspell
Consolidate compiler generated dependencies of target BeefySysLib
[ 74%] Built target BeefySysLib
Consolidate compiler generated dependencies of target IDEHelper
[ 93%] Built target IDEHelper
Consolidate compiler generated dependencies of target BeefBoot
[ 94%] Linking CXX executable ../Debug/bin/BeefBoot
[ 94%] Built target BeefBoot
Consolidate compiler generated dependencies of target BeefRT
[100%] Built target BeefRT
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bc/opt/Beef/jbuild
Consolidate compiler generated dependencies of target hunspell
[  5%] Built target hunspell
Consolidate compiler generated dependencies of target BeefySysLib
[ 74%] Built target BeefySysLib
Consolidate compiler generated dependencies of target IDEHelper
[ 93%] Built target IDEHelper
Consolidate compiler generated dependencies of target BeefBoot
[ 94%] Built target BeefBoot
Consolidate compiler generated dependencies of target BeefRT
[100%] Built target BeefRT
Building BeefBuild_bootd
[******************************]
TIMING: Beef compiling: 44.9s
WARNING: BF0168: The variable 'llvmDir' is assigned but its value is never used at line 637:13 in /Users/bc/opt/Beef/IDE/src/BuildContext.bf
     String llvmDir = "";     
            ^
Errors: 0. Warnings: 1.
Linking BeefBuild_bootd...
./build.sh: line 73: 52762 Segmentation fault: 11  ../../jbuild_d/Debug/bin/BeefBoot --out="BeefBuild_bootd" --src=../src --src=../../BeefBuild/src --src=../../BeefLibs/corlib/src --src=../../BeefLibs/Beefy2D/src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="./libBeefRT_d.a ./libIDEHelper_d.$LIBEXT ./libBeefySysLib_d.$LIBEXT $(< ../../IDE/dist/IDEHelper_libs_d.txt) $LINKOPTS"

So there seems to be a problem with BeefBoot...

MrStevns commented 2 years ago

I'm seeing the same and the issue seems to be introduced with 0.43.2, since i'm able to compile, link and run 0.43.1

Here's the stacktrace:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               BeefBoot [39897]
Path:                  /Users/USER/*/BeefBoot
Identifier:            BeefBoot
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        Exited process [37320]
Responsible:           Terminal [1677]
User ID:               501

Date/Time:             2022-09-24 11:03:08.3512 +0200
OS Version:            macOS 12.6 (21G115)
Report Version:        12
Anonymous UUID:        59FD0A45-E1AE-009B-30D4-5F52FCB9080E

Sleep/Wake UUID:       354E3DD3-FF1D-4497-8A18-3CE610360696

Time Awake Since Boot: 91000 seconds
Time Since Wake:       70426 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000000010a
Exception Codes:       0x0000000000000001, 0x000000000000010a
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [39897]

VM Region Info: 0x10a is not in any region.  Bytes before following region: 140737487380214
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      VM_ALLOCATE              7ffffff12000-7ffffff13000 [    4K] r-x/r-x SM=ALI  

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libIDEHelper_d.dylib                   0x11836db6c Beefy::BfMethodInstance::Dispose(bool) + 332 (BfResolvedTypeUtils.cpp:763)
1   libIDEHelper_d.dylib                   0x11836d8f1 Beefy::BfMethodInstance::~BfMethodInstance() + 33 (BfResolvedTypeUtils.cpp:718)
2   libIDEHelper_d.dylib                   0x11836dba5 Beefy::BfMethodInstance::~BfMethodInstance() + 21 (BfResolvedTypeUtils.cpp:717)
3   libIDEHelper_d.dylib                   0x11837282e Beefy::BfMethodInstanceGroup::~BfMethodInstanceGroup() + 126 (BfResolvedTypeUtils.cpp:1737)
4   libIDEHelper_d.dylib                   0x1183729c5 Beefy::BfMethodInstanceGroup::~BfMethodInstanceGroup() + 21 (BfResolvedTypeUtils.cpp:1732)
5   libIDEHelper_d.dylib                   0x1182d501b Beefy::ArrayImpl<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup>, false>::~ArrayImpl() + 75 (Array.h:490)
6   libIDEHelper_d.dylib                   0x1182d4fc8 Beefy::Array<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup> >::~Array() + 24 (Array.h:1106)
7   libIDEHelper_d.dylib                   0x1182d4cd5 Beefy::Array<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup> >::~Array() + 21 (Array.h:1106)
8   libIDEHelper_d.dylib                   0x118373042 Beefy::BfTypeInstance::~BfTypeInstance() + 1650 (BfResolvedTypeUtils.cpp:1771)
9   libIDEHelper_d.dylib                   0x118373225 Beefy::BfTypeInstance::~BfTypeInstance() + 21 (BfResolvedTypeUtils.cpp:1750)
10  libIDEHelper_d.dylib                   0x11837324c Beefy::BfTypeInstance::~BfTypeInstance() + 28 (BfResolvedTypeUtils.cpp:1750)
11  libIDEHelper_d.dylib                   0x117ffc921 Beefy::BfContext::~BfContext() + 1297 (BfContext.cpp:101)
12  libIDEHelper_d.dylib                   0x117ffd0c5 Beefy::BfContext::~BfContext() + 21 (BfContext.cpp:86)
13  libIDEHelper_d.dylib                   0x117f62acb Beefy::BfCompiler::~BfCompiler() + 107 (BfCompiler.cpp:493)
14  libIDEHelper_d.dylib                   0x117f62c35 Beefy::BfCompiler::~BfCompiler() + 21 (BfCompiler.cpp:490)
15  libIDEHelper_d.dylib                   0x117fac577 BfCompiler_Delete + 39 (BfCompiler.cpp:10393)
16  BeefBoot                               0x10277b09e Beefy::BootApp::Compile() + 5278 (BootApp.cpp:959)
17  BeefBoot                               0x1027758a2 main + 1986 (BeefBoot.cpp:112)
18  dyld                                   0x10646e52e start + 462

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000600007547080  rbx: 0x00000001027a4060  rcx: 0x0000000000000101  rdx: 0x00000000000010b0
  rdi: 0x0000600007547080  rsi: 0x0000000000000001  rbp: 0x00007ff7bd78d120  rsp: 0x00007ff7bd78d100
   r8: 0x0000000000000580   r9: 0x0000000000000080  r10: 0x00000000000007fb  r11: 0x000000000000007f
  r12: 0x00000001064e93a0  r13: 0x00007ff7bd78de18  r14: 0x00000001027750e0  r15: 0x00000001064d5010
  rip: 0x000000011836db6c  rfl: 0x0000000000010202  cr2: 0x000000000000010a

Logical CPU:     0
Error Code:      0x00000004 (no mapping for user data read)
Trap Number:     14

Thread 0 instruction stream:
  48 8b 45 e0 48 83 78 58-00 0f 84 3a 00 00 00 48  H.E.H.xX...:...H
  8b 45 e0 48 8b 48 58 48-39 41 28 0f 84 18 00 00  .E.H.HXH9A(.....
  00 48 8d 3d c5 66 5c 04-48 8d 35 ae 64 5c 04 ba  .H.=.f\.H.5.d\..
  f5 02 00 00 e8 11 62 57-04 48 8b 45 e0 48 8b 48  ......bW.H.E.H.H
  58 48 c7 41 28 00 00 00-00 48 8b 45 e0 48 83 78  XH.A(....H.E.H.x
  70 00 0f 84 22 00 00 00-48 8b 45 e0 48 8b 48 70  p..."...H.E.H.Hp
 [0f]be 51 09 83 e2 f7 48-8b 48 70 88 51 09 48 8b  ..Q....H.Hp.Q.H. <==
  48 70 48 89 cf e8 2a 00-00 00 48 83 c4 20 5d c3  HpH...*...H.. ].
  0f 1f 40 00 55 48 89 e5-48 83 ec 10 48 89 7d f8  ..@.UH..H...H.}.
  48 8b 7d f8 e8 2b fd ff-ff 48 83 c4 10 5d c3 0f  H.}..+...H...]..
  1f 44 00 00 55 48 89 e5-48 83 ec 60 48 89 7d f8  .D..UH..H..`H.}.
  48 8b 45 f8 8b 48 0c 83-c1 ff 89 48 0c 83 78 0c  H.E..H.....H..x.

Binary Images:
       0x117eb8000 -        0x11d3f3fff libIDEHelper_d.dylib (*) <2d9782e4-2ced-35d2-aac3-a74f4f469f8a> /Users/USER/*/libIDEHelper_d.dylib
       0x102770000 -        0x10277ffff BeefBoot (*) <72290bcf-b4f2-3cae-bc7c-58a12235e32a> /Users/USER/*/BeefBoot
       0x106469000 -        0x1064d4fff dyld (*) <71febccd-d9dc-3599-9971-2b3407c588a8> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=631.0M resident=0K(0%) swapped_out_or_unallocated=631.0M(100%)
Writable regions: Total=6.7G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=6.7G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        1 
MALLOC                             6.5G      199 
MALLOC guard page                   16K        4 
MALLOC_NANO (reserved)           256.0M        1         reserved VM address space (unallocated)
ObjC additional data                15K        1 
STACK GUARD                       56.0M        1 
Stack                             8192K        1 
VM_ALLOCATE                          8K        2 
__DATA                             988K       47 
__DATA_CONST                      3830K       40 
__DATA_DIRTY                        66K       24 
__LINKEDIT                       534.6M        9 
__TEXT                            96.3M       50 
dyld private memory               2048K        3 
shared memory                        8K        1 
===========                     =======  ======= 
TOTAL                              7.4G      384 
TOTAL, minus reserved VM space     7.2G      384 

-----------
Full Report
-----------

{"app_name":"BeefBoot","timestamp":"2022-09-24 11:03:08.00 +0200","app_version":"","slice_uuid":"72290bcf-b4f2-3cae-bc7c-58a12235e32a","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.6 (21G115)","incident_id":"FB9A77B9-36AC-459E-A9CC-643E74A25ABE","name":"BeefBoot"}
{
  "uptime" : 91000,
  "procLaunch" : "2022-09-24 11:01:10.8296 +0200",
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro12,1",
  "procStartAbsTime" : 90907780578068,
  "coalitionID" : 2362,
  "osVersion" : {
    "train" : "macOS 12.6",
    "build" : "21G115",
    "releaseType" : "User"
  },
  "captureTime" : "2022-09-24 11:03:08.3512 +0200",
  "incident" : "FB9A77B9-36AC-459E-A9CC-643E74A25ABE",
  "bug_type" : "309",
  "pid" : 39897,
  "procExitAbsTime" : 91025298127568,
  "cpuType" : "X86-64",
  "procName" : "BeefBoot",
  "procPath" : "\/Users\/USER\/*\/BeefBoot",
  "parentProc" : "Exited process",
  "parentPid" : 37320,
  "coalitionName" : "com.apple.Terminal",
  "crashReporterKey" : "59FD0A45-E1AE-009B-30D4-5F52FCB9080E",
  "responsiblePid" : 1677,
  "responsibleProc" : "Terminal",
  "wakeTime" : 70426,
  "sleepWakeUUID" : "354E3DD3-FF1D-4497-8A18-3CE610360696",
  "sip" : "enabled",
  "vmRegionInfo" : "0x10a is not in any region.  Bytes before following region: 140737487380214\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  \n      VM_ALLOCATE              7ffffff12000-7ffffff13000 [    4K] r-x\/r-x SM=ALI  ",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0x000000000000010a","rawCodes":[1,266],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x000000000000010a"},
  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":39897},
  "vmregioninfo" : "0x10a is not in any region.  Bytes before following region: 140737487380214\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  \n      VM_ALLOCATE              7ffffff12000-7ffffff13000 [    4K] r-x\/r-x SM=ALI  ",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":542001,"instructionState":{"instructionStream":{"bytes":[72,139,69,224,72,131,120,88,0,15,132,58,0,0,0,72,139,69,224,72,139,72,88,72,57,65,40,15,132,24,0,0,0,72,141,61,197,102,92,4,72,141,53,174,100,92,4,186,245,2,0,0,232,17,98,87,4,72,139,69,224,72,139,72,88,72,199,65,40,0,0,0,0,72,139,69,224,72,131,120,112,0,15,132,34,0,0,0,72,139,69,224,72,139,72,112,15,190,81,9,131,226,247,72,139,72,112,136,81,9,72,139,72,112,72,137,207,232,42,0,0,0,72,131,196,32,93,195,15,31,64,0,85,72,137,229,72,131,236,16,72,137,125,248,72,139,125,248,232,43,253,255,255,72,131,196,16,93,195,15,31,68,0,0,85,72,137,229,72,131,236,96,72,137,125,248,72,139,69,248,139,72,12,131,193,255,137,72,12,131,120,12],"offset":96}},"threadState":{"r13":{"value":140702012464664},"rax":{"value":105553239240832},"rflags":{"value":66050},"cpu":{"value":0},"r14":{"sourceLine":36,"value":4336341216,"sourceFile":"BeefBoot.cpp","symbol":"main","symbolLocation":0},"rsi":{"value":1},"r8":{"value":1408},"cr2":{"value":266},"rdx":{"value":4272},"r10":{"value":2043},"r9":{"value":128},"r15":{"value":4400697360,"symbolLocation":0,"symbol":"dyld4::sConfigBuffer"},"rbx":{"value":4336533600},"trap":{"value":14,"description":"(no mapping for user data read)"},"err":{"value":4},"r11":{"value":127},"rip":{"value":4701215596,"matchesCrashFrame":1},"rbp":{"value":140702012461344},"rsp":{"value":140702012461312},"r12":{"value":4400780192,"symbolLocation":0,"symbol":"_NSConcreteStackBlock"},"rcx":{"value":257},"flavor":"x86_THREAD_STATE","rdi":{"value":105553239240832}},"queue":"com.apple.main-thread","frames":[{"imageOffset":4938604,"sourceLine":763,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfMethodInstance::Dispose(bool)","imageIndex":0,"symbolLocation":332},{"imageOffset":4937969,"sourceLine":718,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfMethodInstance::~BfMethodInstance()","imageIndex":0,"symbolLocation":33},{"imageOffset":4938661,"sourceLine":717,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfMethodInstance::~BfMethodInstance()","imageIndex":0,"symbolLocation":21},{"imageOffset":4958254,"sourceLine":1737,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfMethodInstanceGroup::~BfMethodInstanceGroup()","imageIndex":0,"symbolLocation":126},{"imageOffset":4958661,"sourceLine":1732,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfMethodInstanceGroup::~BfMethodInstanceGroup()","imageIndex":0,"symbolLocation":21},{"imageOffset":4313115,"sourceLine":490,"sourceFile":"Array.h","symbol":"Beefy::ArrayImpl<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup>, false>::~ArrayImpl()","imageIndex":0,"symbolLocation":75},{"imageOffset":4313032,"sourceLine":1106,"sourceFile":"Array.h","symbol":"Beefy::Array<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup> >::~Array()","imageIndex":0,"symbolLocation":24},{"imageOffset":4312277,"sourceLine":1106,"sourceFile":"Array.h","symbol":"Beefy::Array<Beefy::BfMethodInstanceGroup, Beefy::AllocatorCLib<Beefy::BfMethodInstanceGroup> >::~Array()","imageIndex":0,"symbolLocation":21},{"imageOffset":4960322,"sourceLine":1771,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfTypeInstance::~BfTypeInstance()","imageIndex":0,"symbolLocation":1650},{"imageOffset":4960805,"sourceLine":1750,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfTypeInstance::~BfTypeInstance()","imageIndex":0,"symbolLocation":21},{"imageOffset":4960844,"sourceLine":1750,"sourceFile":"BfResolvedTypeUtils.cpp","symbol":"Beefy::BfTypeInstance::~BfTypeInstance()","imageIndex":0,"symbolLocation":28},{"imageOffset":1329441,"sourceLine":101,"sourceFile":"BfContext.cpp","symbol":"Beefy::BfContext::~BfContext()","imageIndex":0,"symbolLocation":1297},{"imageOffset":1331397,"sourceLine":86,"sourceFile":"BfContext.cpp","symbol":"Beefy::BfContext::~BfContext()","imageIndex":0,"symbolLocation":21},{"imageOffset":699083,"sourceLine":493,"sourceFile":"BfCompiler.cpp","symbol":"Beefy::BfCompiler::~BfCompiler()","imageIndex":0,"symbolLocation":107},{"imageOffset":699445,"sourceLine":490,"sourceFile":"BfCompiler.cpp","symbol":"Beefy::BfCompiler::~BfCompiler()","imageIndex":0,"symbolLocation":21},{"imageOffset":1000823,"sourceLine":10393,"sourceFile":"BfCompiler.cpp","symbol":"BfCompiler_Delete","imageIndex":0,"symbolLocation":39},{"imageOffset":45214,"sourceLine":959,"sourceFile":"BootApp.cpp","symbol":"Beefy::BootApp::Compile()","imageIndex":1,"symbolLocation":5278},{"imageOffset":22690,"sourceLine":112,"sourceFile":"BeefBoot.cpp","symbol":"main","imageIndex":1,"symbolLocation":1986},{"imageOffset":21806,"symbol":"start","symbolLocation":462,"imageIndex":2}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4696276992,
    "size" : 89374720,
    "uuid" : "2d9782e4-2ced-35d2-aac3-a74f4f469f8a",
    "path" : "\/Users\/USER\/*\/libIDEHelper_d.dylib",
    "name" : "libIDEHelper_d.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4336320512,
    "size" : 65536,
    "uuid" : "72290bcf-b4f2-3cae-bc7c-58a12235e32a",
    "path" : "\/Users\/USER\/*\/BeefBoot",
    "name" : "BeefBoot"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4400254976,
    "size" : 442368,
    "uuid" : "71febccd-d9dc-3599-9971-2b3407c588a8",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 140703188791296,
  "size" : 19331678208,
  "uuid" : "73669942-bd8a-3e40-951f-7fbe07b51cb8"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=631.0M resident=0K(0%) swapped_out_or_unallocated=631.0M(100%)\nWritable regions: Total=6.7G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=6.7G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nKernel Alloc Once                    8K        1 \nMALLOC                             6.5G      199 \nMALLOC guard page                   16K        4 \nMALLOC_NANO (reserved)           256.0M        1         reserved VM address space (unallocated)\nObjC additional data                15K        1 \nSTACK GUARD                       56.0M        1 \nStack                             8192K        1 \nVM_ALLOCATE                          8K        2 \n__DATA                             988K       47 \n__DATA_CONST                      3830K       40 \n__DATA_DIRTY                        66K       24 \n__LINKEDIT                       534.6M        9 \n__TEXT                            96.3M       50 \ndyld private memory               2048K        3 \nshared memory                        8K        1 \n===========                     =======  ======= \nTOTAL                              7.4G      384 \nTOTAL, minus reserved VM space     7.2G      384 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000198
    }
  ],
  "experiments" : [
    {
      "treatmentId" : "5b729754-3882-4560-826f-9c0bc27d77c6",
      "experimentId" : "6192fb082171a2330e561df0",
      "deploymentId" : 400000035
    }
  ]
}
}
MrStevns commented 2 years ago

I traced the problem back to 676e7988fb5176ca4ed45dc13ba80f08e3d8ceca, still not sure what's causing it precisely but it should hopefully make it easier to find the root cause and make a fix.

bfiete commented 2 years ago

Hm. Everything seems pretty innocent there...

MrStevns commented 2 years ago

I've nailed the problem down to being the "delete event" in PoxisCommon.cpp. Although the solution is of course not, to not delete the event but i've gotten as far as to checkout master and remove that single change and it compiles and links. This will probably be my workaround for now, even if it leaks memory...

I hope this gives you a clue @bfiete as to what the underlying issue might be. Let me know if you need more information or want me to try something out.

BFP_EXPORT void BFP_CALLTYPE BfpEvent_Release(BfpEvent* event)
{
    pthread_cond_destroy(&event->mCondVariable);
    pthread_mutex_destroy(&event->mMutex);
-  delete event;
}
bfiete commented 2 years ago

Have you ever tried valgrind? You could try that. In the 'dist' directory: valgrind --leak-check=yes --error-exitcode=1 ./BeefBuild -workspace=../../BeefBuild

And just to verify - this is completely standard clean build of Beef + LLVM, you didn't do anything "unusual"? It's very uncommon for there to be a crash issue on macOS that doesn't occur on Linux (even under valgrind).

MrStevns commented 2 years ago

Have you ever tried valgrind? You could try that. In the 'dist' directory: valgrind --leak-check=yes --error-exitcode=1 ./BeefBuild -workspace=../../BeefBuild

I know valgrind although I haven't used it in years, Afaik valgrind hasn't been working on macOS since 10.12 and i'm on 12.6 currently. I tried running the old build i had but it's not working correctly...

valgrind --leak-check=yes --error-exitcode=1 ./BeefBuild -workspace=../../BeefBuild
==75929== Memcheck, a memory error detector
==75929== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==75929== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright info
==75929== Command: ./BeefBuild -workspace=../../BeefBuild
==75929== 
==75929== Invalid read of size 1
==75929==    at 0x100F95B89: __chkstk_darwin_probe (in /usr/lib/dyld)
==75929==    by 0x100F453EE: dyld4::ProcessConfig::PathOverrides::forEachInsertedDylib(void ( block_pointer)(char const*, bool&)) const (in /usr/lib/dyld)
==75929==    by 0x100F419C7: dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) (in /usr/lib/dyld)
==75929==    by 0x100F414E3: (below main) (in /usr/lib/dyld)
==75929==  Address 0x1057f2f0c is on thread 1's stack
==75929==  148 bytes below stack pointer
==75929== 
dyld[75929]: Library not loaded: '/usr/lib/libSystem.B.dylib'
  Referenced from: '/Users/mrstevns/Github-Projects/Beef-mychanges/IDE/dist/BeefBuild'
  Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file), '/usr/local/lib/libSystem.B.dylib' (no such file)
--75929-- WARNING: unhandled amd64-darwin syscall: unix:521
--75929-- You may be able to write your own handler.
--75929-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--75929-- Nevertheless we consider this a bug.  Please report
--75929-- it at http://valgrind.org/support/bug_reports.html.
--75929-- WARNING: unhandled amd64-darwin syscall: unix:520
--75929-- You may be able to write your own handler.
--75929-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--75929-- Nevertheless we consider this a bug.  Please report
--75929-- it at http://valgrind.org/support/bug_reports.html.
==75929== valgrind: Unrecognised instruction at address 0x100f98a99.
==75929==    at 0x100F98A99: abort_with_payload_wrapper_internal (in /usr/lib/dyld)
==75929==    by 0x100F98AA3: abort_with_payload (in /usr/lib/dyld)
==75929==    by 0x100F46698: dyld4::halt(char const*) (in /usr/lib/dyld)
==75929==    by 0x100F425B4: dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) (in /usr/lib/dyld)
==75929==    by 0x100F414E3: (below main) (in /usr/lib/dyld)
==75929== Your program just tried to execute an instruction that Valgrind
==75929== did not recognise.  There are two possible reasons for this.
==75929== 1. Your program has a bug and erroneously jumped to a non-code
==75929==    location.  If you are running Memcheck and you just saw a
==75929==    warning about a bad jump, it's probably your program's fault.
==75929== 2. The instruction is legitimate but Valgrind doesn't handle it,
==75929==    i.e. it's Valgrind's fault.  If you think this is the case or
==75929==    you are not sure, please let us know and we'll try to fix it.
==75929== Either way, Valgrind will now raise a SIGILL signal which will
==75929== probably kill your program.
==75929== 
==75929== Process terminating with default action of signal 4 (SIGILL)
==75929==  Illegal opcode at address 0x100F98A99
==75929==    at 0x100F98A99: abort_with_payload_wrapper_internal (in /usr/lib/dyld)
==75929==    by 0x100F98AA3: abort_with_payload (in /usr/lib/dyld)
==75929==    by 0x100F46698: dyld4::halt(char const*) (in /usr/lib/dyld)
==75929==    by 0x100F425B4: dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) (in /usr/lib/dyld)
==75929==    by 0x100F414E3: (below main) (in /usr/lib/dyld)
==75929== 
==75929== HEAP SUMMARY:
==75929==     in use at exit: 0 bytes in 0 blocks
==75929==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==75929== 
==75929== All heap blocks were freed -- no leaks are possible
==75929== 
==75929== For lists of detected and suppressed errors, rerun with: -s
==75929== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

And just to verify - this is completely standard clean build of Beef + LLVM, you didn't do anything "unusual"? It's very uncommon for there to be a crash issue on macOS that doesn't occur on Linux (even under valgrind).

Yes it's a standard clean build of beef + LLVM.