Cross Win32->x86_64-linux works but Win64->x86_64-linux don't lazarus / 1-Linux ---------------------------------------------------------------------- marius.maximus · 2014-08-28 20:49 I use fpcup to build Lazarus+FPC for windows32 and for windows 64 bit I have identical x86_64-linux binutils and indentical libs (from debian Jessie 64 bit) My fpcup settings settings.ini Quote[windows32] fpcdir=d:\developmentX32\fpc fpcurl=http://svn.freepascal.org/svn/fpc/trunk lazdir=d:\developmentX32\lazarus lazurl=http://svn.freepascal.org/svn/lazarus/trunk/ primary-config-path=d:\developmentX32\configlazarus binutilsdir=d:\developmentX32\fpcbootstrap fpcbootstrapdir=d:\developmentX32\fpcbootstrap noconfirm=true keeplocalchanges=true only=FPC,lazarus,lazbuild [windows32_linux_x86_64] fpcopt="-g -gl -O1" lazopt="-g -gl -O1"  fpcdir=d:\developmentX32\fpc fpcurl=http://svn.freepascal.org/svn/fpc/trunk binutilsdir=d:\developmentX32\fpcbootstrap fpcbootstrapdir=d:\developmentX32\fpcbootstrap cputarget=x86_64 ostarget=linux verbose=1 only=FPCCleanOnly,FPCBuildOnly [windows64] fpcdir=d:\developmentX64\fpc fpcurl=http://svn.freepascal.org/svn/fpc/trunk lazdir=d:\developmentX64\lazarus lazurl=http://svn.freepascal.org/svn/lazarus/trunk/ primary-config-path=d:\developmentX64\configlazarus binutilsdir=d:\developmentX64\fpcbootstrap fpcbootstrapdir=d:\developmentX64\fpcbootstrap noconfirm=true keeplocalchanges=true only=FPC,lazarus,lazbuild [windows64_linux_x86_64] fpcopt="-g -gl -O1" lazopt="-g -gl -O1"  fpcdir=d:\developmentX64\fpc fpcurl=http://svn.freepascal.org/svn/fpc/trunk binutilsdir=d:\developmentX64\fpcbootstrap fpcbootstrapdir=d:\developmentX64\fpcbootstrap cputarget=x86_64 ostarget=linux verbose=1 only=FPCCleanOnly,FPCBuildOnly I created new application and compile it on win32 and win64 cross to linux_x86_64 In both lazarus version cross compilation works OK  to linux_x86_64 . But only from 32bits (win32) lazarus application works OK, When I try run application created from (win64) lazarus I see on linux console: Quotex@debian:~$ ./project2 [FORMS.PP] ExceptionOccurred   Sender=EInvalidOp   Exception=Invalid floating point operation   Stack trace:   $00000000005A1EF1 line 1043 of gtk2/gtk2widgetset.inc   $00000000004550F4 line 444 of include/application.inc   $000000000041E1A1 line 17 of project2.lpr TApplication.HandleException Invalid floating point operation   Stack trace:   $00000000005A1EF1 line 1043 of gtk2/gtk2widgetset.inc   $00000000004550F4 line 444 of include/application.inc   $000000000041E1A1 line 17 of project2.lpr Exception at 00000000005A1EF1: EInvalidOp: Invalid floating point operation.   ldd return identical result for both files readelf return identical result for both files size is identical ---------------------------------------------------------------------- marius.maximus · 2014-08-29 22:24 In my opinion 32bit Lazarus and 64bit Lazarus should generate identical application But 64bit  is different  I found solution: Add SetExceptionMask(GetExceptionMask+ [exInvalidOp]); Before Application.Initialize;    Without this "fix" I have exception in function Code: [Select]procedure TGtk2WidgetSet.AppInit(var ScreenInfo: TScreenInfo); begin   InitKeyboardTables;   { Compute pixels per inch variable }   ScreenInfo.PixelsPerInchX :=     RoundToInt(gdk_screen_width / (GetScreenWidthMM / 25.4));   ScreenInfo.PixelsPerInchY :=     RoundToInt(gdk_screen_height / (GetScreenHeightMM / 25.4));   ScreenInfo.ColorDepth := gdk_visual_get_system^.depth;   {$if defined(cpui386) or defined(cpux86_64)}   // needed otherwise some gtk theme engines crash with division by zero   {$IFNDEF DisableGtkDivZeroFix}     {$IFDEF windows}       Set8087CW($133F);     {$ELSE}       SetExceptionMask(GetExceptionMask + [exZeroDivide,exInvalidOp]);     {$ENDIF}   {$ENDIF}   {$ifend} end;      in line start with "ScreenInfo.PixelsPerInchX := ...." In my opinion it is BUG , this is correct version Code: [Select]procedure TGtk2WidgetSet.AppInit(var ScreenInfo: TScreenInfo); begin   {$if defined(cpui386) or defined(cpux86_64)}   // needed otherwise some gtk theme engines crash with division by zero   {$IFNDEF DisableGtkDivZeroFix}     {$IFDEF windows}       Set8087CW($133F);     {$ELSE}       SetExceptionMask(GetExceptionMask + [exZeroDivide,exInvalidOp]);     {$ENDIF}   {$ENDIF}   {$ifend}   InitKeyboardTables;   { Compute pixels per inch variable }   ScreenInfo.PixelsPerInchX :=     RoundToInt(gdk_screen_width / (GetScreenWidthMM / 25.4));   ScreenInfo.PixelsPerInchY :=     RoundToInt(gdk_screen_height / (GetScreenHeightMM / 25.4));   ScreenInfo.ColorDepth := gdk_visual_get_system^.depth; end;      I submit small BUG  http://mantis.freepascal.org/view.php?id=26649