Recent

Author Topic: Lazarus Cocoa trunk arithmetic error and access violations in IDE  (Read 3233 times)

MISV

  • Hero Member
  • *****
  • Posts: 633
Using FPCUPdeluxe V1.61j for x86_64-darwin-cocoa "trunk" IDE starts with arithmetic error and gives access violations when doing anything

...

lldb under startup gives errors

Quote
TApplication.HandleException: EIntOverFlow
Arithmetic overflow
  Stack trace:
  $000000010031F007
  $000000010031F066
  $000000010031F1F8
  $000000010031F741
  $00000001003205CB
  $0000000100313349
  $000000010024EC12
  $000000010024DB68
  $000000010022C35F
  $000000010022D948
  $0000000100224562
  $00000001002245C4
  $0000000100224181
  $000000010023E122
  $000000010023AE83
  $000000010005B4A9
  $0000000100060248
...
 
rebuilding IDE gives this access violation error

Quote
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010078bf58 lazarus`SAVEPROJECT(this=0x000000010c1aa6c0, FLAGS=<unavailable>) at sourcefilemanager.pas:4286
   4283   
   4284     // if this is a virtual project then save first the project info file
   4285     // to get a project directory
-> 4286     if Project1.IsVirtual and ([sfSaveToTestDir,sfDoNotSaveVirtualFiles]*Flags=[])
   4287     then begin
   4288       Result:=SaveProjectInfo(Flags);
   4289       if Result in [mrCancel,mrAbort] then exit;
Target 0: (lazarus) stopped.
(lldb)

...

Quote
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000000010078bf58 lazarus`SAVEPROJECT(this=0x000000010c1aa6c0, FLAGS=<unavailable>) at sourcefilemanager.pas:4286
    frame #1: 0x000000010009304f lazarus`DOSAVEPROJECT(this=0x0000000103fce910, FLAGS=<unavailable>) at main.pp:6269
    frame #2: 0x0000000100090d5c lazarus`DOSAVEALL(this=0x0000000103fce910, FLAGS=<unavailable>) at main.pp:5648
    frame #3: 0x0000000100098a7a lazarus`DOBUILDLAZARUSSUB(this=0x0000000103fce910, FLAGS=<unavailable>) at main.pp:7581
    frame #4: 0x000000010009900d lazarus`DOBUILDLAZARUS(this=0x0000000103fce910, FLAGS=<unavailable>) at main.pp:7684
    frame #5: 0x000000010008ca0b lazarus`MNUTOOLBUILDLAZARUSCLICKED(this=0x0000000103fce910, SENDER=0x000000010ad11dc0) at main.pp:4587
    frame #6: 0x00000001004a5d87 lazarus`MENUINTF$_$TIDEMENUITEM_$__$$_MENUITEMCLICK$TOBJECT + 47
    frame #7: 0x00000001004a9b40 lazarus`MENUINTF$_$TIDEMENUCOMMAND_$__$$_MENUITEMCLICK$TOBJECT + 32
    frame #8: 0x00000001002472e1 lazarus`MENUS$_$TMENUITEM_$__$$_CLICK + 273
    frame #9: 0x0000000100247b88 lazarus`MENUS$_$TMENUITEM_$__$$_DOCLICKED$formal + 56
    frame #10: 0x0000000100012b3e lazarus`SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal + 166
    frame #11: 0x00000001002142e9 lazarus`LCLMESSAGEGLUE_$$_DELIVERMESSAGE$TOBJECT$formal$$INT64 + 249
    frame #12: 0x0000000100208b3b lazarus`COCOAWSMENUS$_$TLCLMENUITEMCALLBACK_$__$$_ITEMSELECTED + 59
    frame #13: 0x0000000100208fda lazarus`-[TCocoaMenuItem lclItemSelected:] + 66
    frame #14: 0x00007fff475faa43 AppKit`-[NSApplication(NSResponder) sendAction:to:from:] + 312
    frame #15: 0x00007fff4708f213 AppKit`-[NSMenuItem _corePerformAction] + 323
    frame #16: 0x00007fff4708ef9b AppKit`-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
    frame #17: 0x00007fff47114c7a AppKit`-[NSMenu performActionForItemAtIndex:] + 133
    frame #18: 0x00007fff47114be5 AppKit`-[NSMenu _internalPerformActionForItemAtIndex:] + 94
    frame #19: 0x00007fff47114a15 AppKit`-[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 106
    frame #20: 0x00007fff46fdb2a2 AppKit`NSSLMMenuEventHandler + 882
    frame #21: 0x00007fff48b8a904 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1541
    frame #22: 0x00007fff48b89c4d HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 374
    frame #23: 0x00007fff48b9ef21 HIToolbox`SendEventToEventTarget + 39
    frame #24: 0x00007fff48be83f9 HIToolbox`SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 411
    frame #25: 0x00007fff48c112ee HIToolbox`SendMenuCommandWithContextAndModifiers + 49
    frame #26: 0x00007fff48c112aa HIToolbox`SendMenuItemSelectedEvent + 188
    frame #27: 0x00007fff48c11184 HIToolbox`FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 96
    frame #28: 0x00007fff48c11b26 HIToolbox`MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 559
    frame #29: 0x00007fff48c11866 HIToolbox`_HandleMenuSelection2 + 472
    frame #30: 0x00007fff46fccacf AppKit`_NSHandleCarbonMenuEvent + 244
    frame #31: 0x00007fff47226dde AppKit`_DPSEventHandledByCarbon + 54
    frame #32: 0x00007fff475f85e2 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 914
    frame #33: 0x00000001001eeab3 lazarus`-[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 91
    frame #34: 0x00000001001eeddf lazarus`COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPPROCESSMESSAGES + 103
    frame #35: 0x00000001000693f5 lazarus`FORMS$_$TAPPLICATION_$__$$_HANDLEMESSAGE + 45
    frame #36: 0x0000000100069937 lazarus`FORMS$_$TAPPLICATION_$__$$_RUNLOOP + 79
    frame #37: 0x00000001001ee99f lazarus`-[TCocoaApplication run] + 71
    frame #38: 0x00000001001eed72 lazarus`COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUN$TAPPLICATIONMAINLOOP + 106
    frame #39: 0x00000001000698df lazarus`FORMS$_$TAPPLICATION_$__$$_RUN + 95
    frame #40: 0x00000001000020a6 lazarus`PASCALMAIN at lazarus.pp:153
    frame #41: 0x0000000100021d7c lazarus`FPC_SysEntry + 12
    frame #42: 0x0000000100001dae lazarus`FPC_SYSTEMMAIN + 54
    frame #43: 0x0000000100001df6 lazarus`main(ARGC=1, ARGV=0x00007ffeefbffa50, ARGP=0x00007ffeefbffa60) + 38
    frame #44: 0x0000000100001d54 lazarus`start + 52
(lldb)

...

To further complicate matters for me....

Trying to from terminal using
lazbuild --build-ide= --widgetset="Cocoa"

gives error
Error: (lazbuild) Unable to load package
Unable to open the package "lclextensions_package".
This package was marked for installation.
Lazbuild is non interactive, aborting now.

...

How can I prevent lazbuild from including lclexensions_package?

That error prevents me from trying to solve the latest trunk issue myself :(
« Last Edit: August 27, 2018, 03:02:07 pm by MISV »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #1 on: August 27, 2018, 03:59:30 pm »
that looks the same to me
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #2 on: August 27, 2018, 04:09:38 pm »
Indeed looks similar. Was not sure if to post new.

What annoys me is that lazbuild errors in a strange way as well

Quote
Trying to from terminal using
lazbuild --build-ide= --widgetset="Cocoa"

gives error
Error: (lazbuild) Unable to load package
Unable to open the package "lclextensions_package".
This package was marked for installation.
Lazbuild is non interactive, aborting now.

Otherwise I would simply try fix source myself and see if I could solve the problem.

It is driving me mad that it is hit or miss everytime I get a new trunk :)

If I could fix the lazbuild problem... I could supposedly try apply fixes to e.g. sourcefilemanager.pas myself and then rebuild using lazbuild - right?


Trenatos

  • Hero Member
  • *****
  • Posts: 508
  • Software developer - Open source contributor
    • MarcusFernstrom.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #3 on: August 27, 2018, 04:59:59 pm »
I can't remember the exact locations for that..

But you can search for the lclextensions_package as a string

https://superuser.com/questions/162999/how-to-find-files-with-certain-text-in-the-terminal/163002

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #4 on: August 27, 2018, 08:17:39 pm »
Thank you - had good luck using mdfind "lclextensions" and removing all references in makefiles. But I must be missing something since I still get he same error. I will try a reboot

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #5 on: August 27, 2018, 09:04:28 pm »
There... lazbuild successfully run... and arithmetic issue went away as well

Trenatos

  • Hero Member
  • *****
  • Posts: 508
  • Software developer - Open source contributor
    • MarcusFernstrom.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #6 on: August 27, 2018, 09:26:57 pm »
Yeah it's a PITA, wish there was a commandline tool for managing packages.

Code: Pascal  [Select]
  1. lazpack --remove="lclextensions_package"

I don't have enough time at the moment.. When I do, this might come into being, as I've run into it several times as well.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #7 on: August 28, 2018, 02:13:17 pm »
There... lazbuild successfully run... and arithmetic issue went away as well
hmm, what does it mean? The issue is caused due to some package being installed?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #8 on: August 28, 2018, 03:22:14 pm »
There... lazbuild successfully run... and arithmetic issue went away as well
hmm, what does it mean? The issue is caused due to some package being installed?

I am surprised myself. I do not know. But next time the problem appears I will start code/fixing lldb debug it and try see if I can figure it out.

I am wondering if it may be something with the default/last project and package dependencies being loaded upon startup. Maybe if there is a mismatch somehow between what is available and what is being attempted loaded.

I wish I could give better answer. But next time I will try run some extended tests

Trenatos

  • Hero Member
  • *****
  • Posts: 508
  • Software developer - Open source contributor
    • MarcusFernstrom.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #9 on: August 28, 2018, 05:06:09 pm »
skalogryz, in my experience here's what happens (I've done this several times now)

I use fpcupdeluxe to install latest trunk of fpc and laz. (No extra packages or anything)

When I try starting laz, I get the arithmetic error.

I go to terminal and run lazbuild, it succeeds.

Laz starts properly.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #10 on: August 28, 2018, 05:14:51 pm »
I use fpcupdeluxe to install latest trunk of fpc and laz. (No extra packages or anything)
...
I go to terminal and run lazbuild, it succeeds.
Someone needs to figure out the difference between the products of fpcupdeluxe build and lazbuild.

It might be that fpcupdeluxe makes Lazarus IDE (bundle) to run through startlazarus tool, while lazbuild opens lazarus binary directly.
It's hard to say.

At least that would be the first thing I'd try to look into the contents and configuration of "lazarus.app" bundle.

PS: please don't ask me to install and use fpcupdeluxe.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

xinyiman

  • Hero Member
  • *****
  • Posts: 1957
    • Lazarus and Free Pascal italian community
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #11 on: August 28, 2018, 08:32:39 pm »
I have the problem too. But analyzing part of the command result

lazbuild --build-ide = --widgetset = "Cocoa"

I think he tries to install automatically the packages I installed on another version of lazarus. I think it's a bug, why should not fpcupdeluxe all act in the same subfolder? How can I tell him to rebuild lazarus without reinstalling the packages installed in the other version?

Code: Pascal  [Select]
  1. /Developer/lazarus/components/lazcontrols/lvlgraphctrl.pas(477,37) Hint: (5024) Parameter "Sender" not used
  2. /Developer/lazarus/components/lazcontrols/lvlgraphctrl.pas(474,31) Hint: (5024) Parameter "Sender" not used
  3. /Developer/lazarus/components/lazcontrols/lvlgraphctrl.pas(498,36) Hint: (5024) Parameter "DC" not used
  4. (9001) Assembling (pipe) /Developer/lazarus/components/synedit/units/i386-darwin/cocoa/synedithighlighterfoldbase.s
  5. (9001) Assembling (pipe) /Developer/lazarus/components/synedit/units/i386-darwin/cocoa/synhighlighterpas.s
  6. (3104) Compiling synregexpr.pas
  7. (9001) Assembling (pipe) /Developer/lazarus/components/lazcontrols/lib/i386-darwin/cocoa/lvlgraphctrl.s
  8. (3104) Compiling extendedtabcontrols.pas
  9. /Developer/lazarus/components/lazcontrols/extendedtabcontrols.pas(24,32) Hint: (5024) Parameter "Proc" not used
  10. /Developer/lazarus/components/lazcontrols/extendedtabcontrols.pas(24,58) Hint: (5024) Parameter "Root" not used
  11. /Developer/lazarus/components/lazcontrols/extendedtabcontrols.pas(138,30) Hint: (5024) Parameter "Sender" not used
  12. (3104) Compiling lclextensions_package.pas
  13. (3104) Compiling delphicompat.pas
  14. /Users/ngit/Documents/Lazarus_Componenti/lclextensions-0.6/delphicompat.pas(137,2) Fatal: (2013) Cannot open include file "uses.inc"
  15. Fatal: (1018) Compilation aborted
  16. Error: (lazarus) Compile package lclextensions_package 0.6: stopped with exit code 256
  17. /Developer/lazarus/components/synedit/synregexpr.pas(3168,62) Hint: (5057
  18. Error: (lazarus) Compile package rx 1.0: terminated
  19. /Developer/lazarus/components/la
  20. Error: (lazarus) Compile package SynEdit 1.0: terminated
  21. Error: (lazarus) Compile package LazControls 1.0.1: terminated
  22. Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 256"
  23. Error: (lazarus) Building IDE: Compile AutoInstall Packages failed.
  24.  
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

VTwin

  • Hero Member
  • *****
  • Posts: 785
  • Former Turbo Pascal 3 user
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #12 on: August 29, 2018, 02:56:32 am »
I've been using SVN successfully, this works for me:

Code: Pascal  [Select]
  1. user$ cd laz_trunk
  2. user$ svn update
  3. user$ make clean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64
  4. user$ open lazarus.app --args "--pcp=~/.laz-trunk"

Borrowed from Phil and another post. I am no expert, and maybe there is a better way, but it is working.

EDIT: I've been deleting the directory:

\laz_trunk\units\x86_64-darwin

prior to this to force update of Cocoa components.
« Last Edit: August 29, 2018, 03:03:20 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.13.6: Lazarus 2.0 (2.0.7) fixes svn 62148 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.4 (64 bit on VBox)
fpc 3.0.4

VTwin

  • Hero Member
  • *****
  • Posts: 785
  • Former Turbo Pascal 3 user
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #13 on: August 29, 2018, 03:44:00 am »
I'm currently getting SIGSEV error when closing a complex application in Cocoa. This does not happen on other platforms, and was not happening a few days ago (I'm now on 58796). I can't figure out where it is happening, setting breakpoints I oddly end up in "carbonprivate.pp".  %)
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.13.6: Lazarus 2.0 (2.0.7) fixes svn 62148 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.4 (64 bit on VBox)
fpc 3.0.4

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Lazarus Cocoa trunk arithmetic error and access violations in IDE
« Reply #14 on: August 29, 2018, 04:28:04 am »
try to go back to r58774:
Code: [Select]
svn update -r 58774and see if it helps
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz