Recent

Author Topic: [CLOSED] External limitation  (Read 5886 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
[CLOSED] External limitation
« on: May 12, 2023, 06:58:41 pm »
Hello.

New spring so I try it again.
Some hope for this?:
https://gitlab.com/freepascal.org/fpc/source/-/issues/32367

Thanks.

Fre;D
« Last Edit: May 19, 2023, 05:24:28 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Thaddy

  • Hero Member
  • *****
  • Posts: 16407
  • Censorship about opinions does not belong here.
Re: External limitation
« Reply #1 on: May 12, 2023, 07:49:17 pm »
Versioning on libraries is almost never a good idea, unless you need to link against a specific older version.
Almost always just a breaking API change.
If not, remove the versioning.
There is nothing wrong with being blunt. At a minimum it is also honest.

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #2 on: May 12, 2023, 08:06:23 pm »
Versioning on libraries is almost never a good idea, unless you need to link against a specific older version.
Almost always just a breaking API change.
If not, remove the versioning.

I know it is not the best argument but gcc, clang even Kylix allow it.
And sometime it is needed, even if it is a bad idea for you.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 8127
Re: External limitation
« Reply #3 on: May 13, 2023, 09:52:13 am »
I think that this can usefully be xrefed to https://forum.lazarus.freepascal.org/index.php/topic,58888.msg478808.html#msg478808 where somebody points out that

Quote
Maybe not related but, fpc using "external", does not allow "extended" so extension ( libc.so.6 vs libc.so ).

Forty years ago, I wouldn't have given a damn about the behaviour of an inferior language such as gcc or compilers implemented by clang. But these days anybody who says that we can blithely disregard industry expectations is, quite frankly, off his rocker.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #4 on: May 13, 2023, 02:50:27 pm »
I think that this can usefully be xrefed to https://forum.lazarus.freepascal.org/index.php/topic,58888.msg478808.html#msg478808 where somebody points out that

Quote
Maybe not related but, fpc using "external", does not allow "extended" so extension ( libc.so.6 vs libc.so ).

Forty years ago, I wouldn't have given a damn about the behaviour of an inferior language such as gcc or compilers implemented by clang. But these days anybody who says that we can blithely disregard industry expectations is, quite frankly, off his rocker.

MarkMLl

Yes, I agree, I should not give gcc or clang as example.
But Xylix, who was part of Delphi project ( and Delphi is the God of fpc ) can be (maybe)  a valid argument.  ;)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8783
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: External limitation
« Reply #5 on: May 14, 2023, 09:59:29 am »
The .so[.x[.y[.z]]] are usually just symlinks, the real file is the unversioned one. I suggest using dynamic loading if a specific version is required. As it's dynamic, the linker won't know anything about it and thus, will not remove anything.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8127
Re: External limitation
« Reply #6 on: May 14, 2023, 10:47:45 am »
The .so[.x[.y[.z]]] are usually just symlinks, the real file is the unversioned one. I suggest using dynamic loading if a specific version is required. As it's dynamic, the linker won't know anything about it and thus, will not remove anything.

Debian disagrees

Code: Text  [Select][+][-]
  1. lrwxrwxrwx 1 root root       21 Dec  9 19:43 libcairo.so -> libcairo.so.2.11600.0
  2. lrwxrwxrwx 1 root root       21 Dec  9 19:43 libcairo.so.2 -> libcairo.so.2.11600.0
  3. -rw-r--r-- 1 root root  1187432 Dec  9 19:43 libcairo.so.2.11600.0
  4.  

That's the standard pattern, and it's always been like that.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #7 on: May 14, 2023, 01:48:37 pm »
The .so[.x[.y[.z]]] are usually just symlinks, the real file is the unversioned one. I suggest using dynamic loading if a specific version is required. As it's dynamic, the linker won't know anything about it and thus, will not remove anything.

Hello.

Of course loadlibrary() can be used but the thing here is about "external".
I really do not understand that opposition to enable something that is needed  (read all the answers of the issue of first post ).

But ok, I have my own patched fpc-ootb, I use it for years, it works perfectly and solve all my problems.
So, no problem for me, stay blind.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 8127
Re: External limitation
« Reply #8 on: May 14, 2023, 01:54:15 pm »
Of course loadlibrary() can be used

It can't if the file you're trying to load is a linker script, see my other posting.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #9 on: May 14, 2023, 02:06:01 pm »
Of course loadlibrary() can be used

It can't if the file you're trying to load is a linker script, see my other posting.

MarkMLl

That .so issue ( https://gitlab.com/freepascal.org/fpc/source/-/issues/32367 ) is exactly what is wrong with fpc.
Something that even Florian agree to fix is not done because some people dont see or dont care of problems of others.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 8127
Re: External limitation
« Reply #10 on: May 14, 2023, 03:02:43 pm »
That .so issue ( https://gitlab.com/freepascal.org/fpc/source/-/issues/32367 ) is exactly what is wrong with fpc.
Something that even Florian agree to fix is not done because some people dont see or dont care of problems of others.

No, you miss my point. libc.so is now a linker script, and LoadLibrary() /cannot/ handle it.

I came across this years ago when libusb v0.1 was deprecated and Debian replaced the original file with a linker script, but now it appears to be mainstream.

This is emphatically /not/ an FPC architectural problem, unlike .so.6 etc. which is (since as far as unix is concerned a dot has no special significance in a filename).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #11 on: May 14, 2023, 03:23:54 pm »
Hello Mark.

Ok I miss your point.
My point is that with actual-no patched fpc, at linking, fpc allows to use only libX11.so.

But libX11.so is not given by default in mainly all distros, you need to install it via sudo apt-get install libx11-dev (that will install tons of absolutely no needed files for fpc) or create a symlink to libX11.so.6.

So you need to annoy the end-user to install libx11-dev or create a symlink to be able to run the application.

With the fpc patched that I use, fpc links libX11.so.6 and so no need to oblige users to do boring things to run the application from the release.
« Last Edit: May 14, 2023, 04:03:34 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 8127
Re: External limitation
« Reply #12 on: May 14, 2023, 04:56:22 pm »
With the fpc patched that I use, fpc links libX11.so.6 and so no need to oblige users to do boring things to run the application from the release.

Except that if some forthcoming distro version puts a link script in libX11.so rather than making it into a symlink, you'll still be screwed.

However that one is strictly a library issue, rather than affecting FPC's build architecture or its ability to parse external symbol names.

Added:

As of Debian 11 and 12, these .so files are actually linker scripts:

Code: Text  [Select][+][-]
  1. ./usr/lib/x86_64-linux-gnu/libncurses.so: ASCII text
  2. ./usr/lib/x86_64-linux-gnu/libc.so: ASCII text
  3. ./usr/lib/x86_64-linux-gnu/libncursesw.so: ASCII text
  4. ./usr/lib/x86_64-linux-gnu/libusb.so: ASCII text
  5. ./usr/lib/x86_64-linux-gnu/libtermcap.so: ASCII text
  6. ./usr/lib/x86_64-linux-gnu/libm.so: ASCII text
  7. ./usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so: ASCII text
  8. /usr/local/altera/14.1/quartus/linux64/libtbb.so: ASCII text
  9. /usr/local/altera/14.1/quartus/linux64/libtbbmalloc.so: ASCII text
  10. /usr/local/altera/14.1/quartus/linux64/libtbbmalloc_proxy.so: ASCII text
  11.  

There's several in that lot where LoadLibrary() could usefully be used to pull something in dynamically, so that a program can either fail with a useful error message or could continue with some option disabled (e.g. an app which talks to Arduino-scale backend devices over multiple link types, of which USB is the least significant).

The precise path of the libgcc_s.so file varies with compiler version. The fact that this technique is being used on non-Debian binaries such as the Altera FPGA stuff shown above is particularly worrying.

MarkMLl
« Last Edit: May 15, 2023, 10:11:25 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5815
  • Compiler Developer
Re: External limitation
« Reply #13 on: May 14, 2023, 04:58:08 pm »
My point is that with actual-no patched fpc, at linking, fpc allows to use only libX11.so.

But libX11.so is not given by default in mainly all distros, you need to install it via sudo apt-get install libx11-dev (that will install tons of absolutely no needed files for fpc) or create a symlink to libX11.so.6.

That is how it's supposed to be on Linux. Every C or C++ developer has to do the same.

So you need to annoy the end-user to install libx11-dev or create a symlink to be able to run the application.

Wrong. You need to install the -dev package only for compilation, it's not required for running, because the linker will store the real name of the library in the binary.

Fred vS

  • Hero Member
  • *****
  • Posts: 3464
    • StrumPract is the musicians best friend
Re: External limitation
« Reply #14 on: May 14, 2023, 05:28:42 pm »
My point is that with actual-no patched fpc, at linking, fpc allows to use only libX11.so.

But libX11.so is not given by default in mainly all distros, you need to install it via sudo apt-get install libx11-dev (that will install tons of absolutely no needed files for fpc) or create a symlink to libX11.so.6.

That is how it's supposed to be on Linux. Every C or C++ developer has to do the same.

That is exactly the point that we don't agree.

Every C or C++ developer needs (sometime) the -dev package of the library he want to link.
This because gcc or clang needs some files (not only the symlink) like header .h, .a files, ...

But fpc is not a C compiler and all those -dev packages are not for him, he only needs the name of the library to link.

It is maybe supposed to be on Linux but I never saw that law and dont really understand why to impose the limitation to soname.
What will it change for fpc, you can still use the restricted soname, like it is now.

So you need to annoy the end-user to install libx11-dev or create a symlink to be able to run the application.
Wrong. You need to install the -dev package only for compilation, it's not required for running, because the linker will store the real name of the library in the binary.

Yes, of course but I was talking about applications that use fpc (ide for example)  :-X
« Last Edit: May 14, 2023, 05:58:05 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018