Closed olivluca closed 6 months ago
I upgraded BGRABitmapPack to version 11.6.2 (from the online package manager), same problem.
Hello @olivluca and thanks for popping by.
I admit I don't know what are the changes that would require so many libraries. I can see two ways you could investigate this:
Regards
I don't know if the change comes from lazarus or BGRA (probably the former), but as I discussed on the lazarus mailing list the workaround is to use the nogui widgetset. I tried your suggestion but:
@olivluca
In your first post:
ldd /opt/adam/adam
linux-vdso.so.1 (0x00007ffc6c15b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8caf3c4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8caf3be000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8caf1ea000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8caf3ef000)
The result shows that no graphic dependencies are needed. Is your "adam" program a console program?
Yes, it's an http server.
Hum, without any graphic-rendered things (no use of Lazarus LCL)? Are you using BGRABitmap then only as console program?
If so, indeed strange that all that dependencies are needed. In your lpr-program source, do you have Interfaces, added in your uses section?
If so what if you remove it?
Important too: did you use the -B (build all) parameter when you changed the defines (like -dBGRABITMAP_DONT_USE_LCL, ...)
There was no interfaces unit in the original program that compiled and worked fine with lazarus 2.0.12. I had to add it in order to compile it with lazarus 3.2. I'm only using BGRABitmap to convert any input image (sent by the browser) to jpeg and scale it to a fixed size, it worked fine then and it seems to be working fine, with no extra libraries, with the nogui widgetset.
Important too: did you use the -B (build all) parameter when you changed the defines (like -dBGRABITMAP_DONT_USE_LCL, ...)
of course
I had to add it in order to compile it with lazarus 3.2.
Ha, ok, this is the problem. May I ask you what error you get if you remove Interfaces,?
No, that's not the problem,that's just a symptom: interfaces now is needed because something else is using the currently selected widgetset functions, it wasn't needed in 2020 because nothing pulled in those functions.
The errors are like this one (there are many more functions missing):
Warning: linker: /usr/bin/ld:
/home/luca/Datos/laz_3_2/lcl/lib/LCLBase/3.2.2/x86_64-linux/Default/wsimglist.o:
in function `REGISTERCUSTOMIMAGELISTRESOLUTION':
wsimglist.pp(265,0) Error: linker: undefined reference to
`WSRegisterCustomImageListResolution'
Yes, it is exactly my thinking.
Adding interfaces has for result a big need of dependencies. Now the game is to find what unit needs interfaces suddenly in lazarus 3.2., even if no GUI is used.
In the errors you get, is it only at linking and so compilation is ok? If so, it should be because a unit somewhere in the uses section needs LCL.
Sometimes when opening a old Lazarus project, the new Lazarus version add some code on original source.
Is it in one of your unit in the uses section a LCL dependent unit like: Forms, Controls, Graphics, or Dialogs ?
If so, what removing it ( with Interfaces, too )?
No other change was needed/automatically introduced. I only had to remove the dependency on the LazWebExtra package that is no longer available (though even without it the project compiles just fine). And, yes, compilation is ok (it only fails if I use those defines), linking fails unless I add the Interfaces unit.
(Edit: now I see that LazWebExtra in 2.0.12 was a dummy package with no files, no wonder it isn't needed).
And, yes, compilation is ok (it only fails if I use those defines), linking fails unless I add the Interfaces unit.
So there is somewhere in your code a unit that needs LCL. Could you give the list of units used in your uses sections (before and after implementation)?
In zip file a simple console Lazarus project that uses the nogui package and custom option for compiler -dBGRABITMAP_DONT_USE_LCL :
Here with Lazarus 2.2.6 the compilation + link + run is ok. The result of ldd:
$ ldd /home/fred/project1
linux-vdso.so.1 (0x00007ffc8e3a5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000761e19a38000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x0000761e19a33000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000761e19800000)
/lib64/ld-linux-x86-64.so.2 (0x0000761e19a59000)
Shoot me, BGRABitmap doesn't build here with -dBGRABITMAP_DONT_USE_LCL
No, I prefer to find why it does not work for you. (And not easy without seeing your code...)
Is it a big project with no possibility to give a resume of what units are used?
BGRABitmap doesn't build here with -dBGRABITMAP_DONT_USE_LCL
Not sure that I understood. Are you talking about the bgra_nogui project of my previous post or are you talking about your program (or both)?
In your .lpi file, do you have this ?:
...
<RequiredPackages>
<Item>
<PackageName Value="BGRABitmapPack4NoGUI"/>
</Item>
</RequiredPackages>
....
<Other>
<CustomOptions Value="-dBGRABITMAP_DONT_USE_LCL -B"/>
</Other>
....
Sorry, I dont have other idea at the moment.
Thank you! That was it. The dependency I had (and worked with no extra library) was on the BGRABitmapPack package, not the BGRABitmapPack4NoGUI one. In fact I didn't even know the latter existed (the online package manager only lists the former). No need for any extra options and no need to include the Interfaces unit.
Hi @fredvs,
I hope this message finds you well. I wanted to take a moment to express my appreciation for your assistance in helping @olivluca resolve the compilation issue with their Lazarus project. Your detailed guidance highlighted the use of the BGRABitmapPack4NoGUI package.
@olivluca I am glad your problem was finally solved. Even tough I understand you may not be comfortable sharing your actual program, I gather from this discussion that providing a sample project is always helpful.
Regards
Sure, unfortunately this is an internal piece of code that I cannot share at the moment. By checking the commit history It turns out that when I added BGRABitmap to this project, the nogui package was already available, so my using of the normal package was a mistake even if it worked at the time.
I wrote a project using lazarus 2.0.12 with BGRABitmapPack (V10.6.5 installed from the online package manager) under linux. The compiled project used just a handful of so files:so I could easily move the executable from my development machine to the server
Now, if I try to build the same project with lazarus 2.2 6 (BGRABitmapPack V11.4) or lazarus 3.2 (BGRABitmapPack V11.5.4) it pulls a lot more libraries not available on the server
Considering that both the "ancient" version and the new one have LCL as a dependency, what changed?