Recent

Author Topic: How to debug a package  (Read 6230 times)

PizzaProgram

  • New Member
  • *
  • Posts: 18
  • ...developing Delphi apps since 25 years.
How to debug a package
« on: December 20, 2013, 10:27:24 am »
Hi,
 I would like to change from Delphi, so I've installed Lazarus yesterday.
After installing MWA's IBX for Laz. The IDE keeps telling me after restart:

[IBX is unable to locate the Firebird Library - have you remembered to install it?]
... and no new component tabs are visible.
There is no logical explanation, why does not find it!   %)

- Tried to install every Firebird server + client version (2.1-32/64 2.5-32/64)
- placed fbclient.dll into the system dir
- placed fbclient.dll into c:\Lazarus dir ...
... after 20 hours of trying and searching the forum I'm out of ideas...

So I would like to stop and debug the loading process of Lazarus, to see, why doesn't it find it?
Is it possible ?
« Last Edit: December 20, 2013, 10:51:57 am by PizzaProgram »
x86_64-win64 --Win7 PRO 64bit HUN

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: How to debug a package
« Reply #1 on: December 20, 2013, 11:00:38 am »
the easy way out to grep the components directory for the message and follow the crams from there to where this message is raised and see what is the reason.

the long winded way is to open the lazarus.lpi <lazarus installation directory>\IDE folder compile it and run it. These should help you debug the IDE I don't know if it will auto load your package or you might require to add code to loaded manually.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to debug a package
« Reply #2 on: December 20, 2013, 12:40:43 pm »
Assuming you followed IBX installation instructions... and you must have otherwise you hadn't spent 20 hours on it...

You can use sysinternals process monitor to follow the files the program is trying to open, including firebird dlls etc.

Please install the matching bitness Firebird libraries - e.g. 32 bit if you have a 32 bit compiler (recommended unless you run FPC trunk instead of FPC 2.6.x). No need to install the other version for FPC/Lazarus.

I would suggest installing the Laz libs in your system32 directory (or syswow64 if on 64 bit windows using 32 bit library) but the ibx guys probably have some instructions for that.
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

PizzaProgram

  • New Member
  • *
  • Posts: 18
  • ...developing Delphi apps since 25 years.
Re: How to debug a package
« Reply #3 on: December 20, 2013, 02:32:40 pm »
the easy way out to grep the components directory for the message and follow the crams from there to where this message is raised and see what is the reason.

YES, I've done that, and it should find the dll file in 4 different ways... That's why I really don't understand, what is the problem...
Also I've rewrote the registry-finding way, so 32 bit can be loaded too:
Code: [Select]
unit IBIntf;
...
procedure LoadIBLibrary;
...
    if FileExists(InstallDir + FIREBIRD_CLIENT) then
    begin
      //assume firebird.conf and firebird.msg in same dir
      SetEnvironmentVariable('FIREBIRD',PChar(InstallDir));
      dllPathName := InstallDir +FIREBIRD_CLIENT;
      Result := LoadLibrary(dllPathName)
    end
    else
    //Use Registry key if it exists to locate library
    begin
      with TRegistry.Create do
      try
        RootKey := HKEY_LOCAL_MACHINE;
        if OpenKey('SOFTWARE\Firebird Project\Firebird Server\Instances',false) then
        begin
          if ValueExists('DefaultInstance') then
          begin
            dllPathName := ReadString('DefaultInstance')  + 'bin' + DirectorySeparator + FIREBIRD_CLIENT;
            if FileExists(dllPathName) then
            begin
              Result := LoadLibrary(dllPathName);
              Exit
            end
          end
        end else begin
          if OpenKey('SOFTWARE\Wow6432Node\Firebird Project\Firebird Server\Instances',false) then
                  begin
                    if ValueExists('DefaultInstance') then
                    begin
                      dllPathName := ReadString('DefaultInstance')  + 'bin' + DirectorySeparator + FIREBIRD_CLIENT;
                      if FileExists(dllPathName) then
                      begin
                        Result := LoadLibrary(dllPathName);
                        Exit
                      end
                    end
          end
        end
      finally
        Free
      end;

      //Otherwise see if Firebird client is in path
      //and rely on registry for location of firebird.conf and firebird.msg
      Result := LoadLibrary(FIREBIRD_CLIENT);
      if Result <= HINSTANCE_ERROR then
         //well maybe InterBase is present...
         Result := LoadLibrary(IBASE_DLL);
    end
  end;
x86_64-win64 --Win7 PRO 64bit HUN

PizzaProgram

  • New Member
  • *
  • Posts: 18
  • ...developing Delphi apps since 25 years.
Re: How to debug a package
« Reply #4 on: December 20, 2013, 02:35:38 pm »
...
Please install the matching bitness Firebird libraries - e.g. 32 bit if you have a 32 bit compiler (recommended unless you run FPC trunk instead of FPC 2.6.x). No need to install the other version for FPC/Lazarus.

I would suggest installing the Laz libs in your system32 directory (or syswow64 if on 64 bit windows using 32 bit library) but the ibx guys probably have some instructions for that.

I will uninstall the 64bit Lazarus, and try the 32bit stable...
 Is it possible to compile 64bit exe from a 32bit Laz ? Or would you recommend to use the trunc version?
x86_64-win64 --Win7 PRO 64bit HUN

PizzaProgram

  • New Member
  • *
  • Posts: 18
  • ...developing Delphi apps since 25 years.
Re: How to debug a package [Solved by change to 32bit]
« Reply #5 on: December 20, 2013, 03:06:15 pm »
I've just installed the 32bit version of Lazarus stable, and it has no problem any more with IBX.
x86_64-win64 --Win7 PRO 64bit HUN

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6821
  • Debugger - SynEdit - and more
    • wiki
Re: How to debug a package
« Reply #6 on: December 21, 2013, 01:04:29 pm »
Lazarus 1.2 RC1 has a add on for compiling a 64 bit app, from the 32 bit ide.

If your app uses the dll, you will then need the correct dll for your app.

PizzaProgram

  • New Member
  • *
  • Posts: 18
  • ...developing Delphi apps since 25 years.
Re: How to debug a package
« Reply #7 on: December 27, 2013, 11:24:21 am »
I've done some further testing, and installed Lazarus64 back,
and COPYed the whole Firebird-Embedded 64bit version into C:\lazarus

IT WORKED TOO !
 (While 32bit server was running on the same mashine, and not 64bit)

So the solution for IBX 64 is to copy the whole Embedded version, not just the client FBCLIENT.DLL
____________________
But I'll stay at 32bit 1.2RC1 now, because wasn't sure about 64bit may causing the other issues...
Although couldn't find yet how to compile it to 64bit from this 32bit iDE?
... would be nice to put that to the FAQ !
x86_64-win64 --Win7 PRO 64bit HUN

 

TinyPortal © 2005-2018