Recent

Author Topic: running Lazarus under Wine  (Read 13979 times)

garydale

  • New Member
  • *
  • Posts: 17
running Lazarus under Wine
« on: July 22, 2011, 11:26:39 pm »
I was contemplating using Firebird for an application and wanted to ensure it would work with the embedded version available for Windows. I installed Lazarus on Wine v1.3.x on an AMD64 version of Debian/Wheezy. It starts OK but my application raises an External: SIGSEGV exception when I try to run it. This seems to be after the compile completes successfully.

The application (not using Firebird in it yet) runs under Linux and in a WinXP virtual machine so I'm guessing it's probably something about launching an application under Wine.

I'd prefer to use Wine for this as will produce a more portable application (e.g. should run on Linux using Wine) and it's a better development environment (no Windows XP window hogging screen space).

Any ideas on how to get the application to run within Lazarus?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: running Lazarus under Wine
« Reply #1 on: July 24, 2011, 07:35:08 pm »
Lazarus applications are all cross-distribution (the same executable generated with Lazarus works in any distribution) ... providing a wine app instead of a native Linux Lazarus app has no advantage as far as I know.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: running Lazarus under Wine
« Reply #2 on: July 25, 2011, 07:48:48 am »
However, it might be a bit tricky if you want to use Lazarus as an embedded database in Linux; see here http://www.firebirdfaq.org/Firebird-Embedded-Linux-HOWTO.htmlfor details. Note: I don't know how up to date this guide is and have not tried it...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

garydale

  • New Member
  • *
  • Posts: 17
Re: running Lazarus under Wine
« Reply #3 on: July 29, 2011, 12:13:42 am »
felipemdc: The source code might be portable, but the executable is definitely OS specific - actually, in my case, the application doesn't run under Linux although it compiles OK. However, it does run under Wine and on a real Windows virtual machine. And this is with the TDbf component, not Firebird.

The problem is that the Lazarus Run command doesn't launch the executable. It gives the SIGSEGV error I mentioned. Instead I have to manually launch the executable using Wine.

The advantage of having an executable that runs under Wine is that I only need one executable for Linux and Windows. Therefore, and because my application doesn't seem to want to work directly in Linux, I'm using Wine to develop it.

d2010

  • Full Member
  • ***
  • Posts: 235
Re: running Lazarus under Wine
« Reply #4 on: October 22, 2025, 02:42:58 pm »
Please,  I mix delcinfo.exe.delphi7exe with Lazarus4.0Dll because I cannot convert
full source delcinfo.dpr to delcinfo.lpr
 ;D
Devcinfo.exe Win10-,win8, my programe "devcinfo.exe" work  good;
but inside Linux8Wine, I got  the errors:
C:Q1=How to fix Kernel32.dll is missing?
Code: [Select]
[ ? ]  KERNEL32      Error opening file. File not found (?).
C:Q2=The COROGBAR.EN   Error opening file. File not found (?).
 I wad develop COROGBAR.lpr and COROGBAR.dll.
Code: [Select]
[*? ] 
[*? ]  CONINT64.EN   Error opening file. File not found (2).
[*? ]  CONINT64.ENU  Error opening file. File not found (2).
[*? ]  COROGBAR.ENU  Error opening file. File not found (2).
« Last Edit: October 22, 2025, 02:46:38 pm by d2010 »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12562
  • FPC developer.
Re: running Lazarus under Wine
« Reply #5 on: October 22, 2025, 03:36:42 pm »
D2010: I think that is more a question for Wine.

dbannon

  • Hero Member
  • *****
  • Posts: 3607
    • tomboy-ng, a rewrite of the classic Tomboy
Re: running Lazarus under Wine
« Reply #6 on: October 23, 2025, 12:29:36 pm »
Or a question for Delphi ?

Its worth noting that Wine does not guarantee to run any Windows app.

But it does look to me like, in this case, you are making a 32bit windows (lazarus) app ? Are you then running it on a 64bit Linux system running 64bit Wine ?  Are you sure Wine can run 32bit Windows apps on 64bit systems ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

d2010

  • Full Member
  • ***
  • Posts: 235
Re: running Lazarus under Wine
« Reply #7 on: October 23, 2025, 02:29:55 pm »
Or a question for Delphi ?
Its worth noting that Wine does not guarantee to run any Windows app.
But it does look to me like, in this case, you are making a 32bit windows (lazarus) app ? Are you then running it on a 64bit Linux system running 64bit Wine ?  Are you sure Wine can run 32bit Windows apps on 64bit systems ?
Davo
You have right, yes, I got the errors,  at means many bugs, after the remix " Linux64 xor Wine32x xor LazarusX32dll."
 >:(
Can I replace the string"Kernel32.dll with kernel32"? ::)
Can I replace the string"Kernel32.dll with kernel32.so.lib"?
When the programers have wow64 or system32 , then they  use 'kernel32'?
Code: [Select]
function Stub_Eu_multumesc_Ilie2025Lacatusu(var Destination: PtrInt; Exchange, Comparand: PtrInt): PtrInt; stdcall;
  function GetImpl: Pointer;
  const
    cKernel32 = 'KERNEL32'; {do not localize}
    cInterlockedCompareExchange = {$IFDEF CPU64}'InterlockedCompareExchange64'{$ELSE}'InterlockedCompareExchange'{$ENDIF}; {do not localize}
  begin
    Result := GetProcAddress(GetModuleHandle(cKernel32), cInterlockedCompareExchange);
    if Result = nil then begin
      Result := @Impl_InterlockedCompareExchange;
    end;
  end;

begin
  @InterlockedCompareExchange := GetImpl();
  Result := InterlockedCompareExchange(Destination, Exchange, Comparand);
end;

function Stub_GetTickCount64: UInt64; stdcall;
  function GetImpl: Pointer;
  begin
    Result := GetProcAddress(GetModuleHandle('KERNEL32'), 'GetTickCount64'); {do not localize}
    if Result = nil then begin
      Result := @Impl_GetTickCount64;
    end;
  end;

begin
  @GetTickCount64 := GetImpl();
  Result := GetTickCount64();
end;
var
  KernelHandle: THandle;
initialization
begin
  OleAutHandleEu_multumescIlie_lacatusu := SafeLoadLibrary('OLEAUT32.DLL');
  KernelHandle := GetModuleHandle('KERNEL32');
  if KernelHandle <> 0 then
    @GetLongPathName := GetProcAddress(KernelHandle, 'GetLongPathNameW');
end;


« Last Edit: October 23, 2025, 02:34:46 pm by d2010 »

dbannon

  • Hero Member
  • *****
  • Posts: 3607
    • tomboy-ng, a rewrite of the classic Tomboy
Re: running Lazarus under Wine
« Reply #8 on: October 24, 2025, 11:40:35 am »
Can I replace the string"Kernel32.dll with kernel32"? ::)
Can I replace the string"Kernel32.dll with kernel32.so.lib"?

When something asks for, eg kernel32.dll its because it needs to call code that exists in that library. If that library is not available, and cannot be made available (??), you need to find where its called and find some way to work around that need.

If you comment out the code to load the library, probably shortly after you will get a AV when the function (that should be provided by the library) is called. That will tell you, perhaps, what needs to be coded around. But its not going to be easy.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018