Recent

Author Topic: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'  (Read 1145 times)

alpine

  • Hero Member
  • *****
  • Posts: 1263
[SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« on: August 15, 2024, 05:49:25 pm »
I have several C libraries written by me and I'm using them in an Lazarus project as a dynamic *.so files.
I haven't rebuild them for a long time until recently, when a small change was made. Now my Lazarus project build fails with the reason of:
Code: Text  [Select][+][-]
  1. undefined reference to `fcntl@GLIBC_2.28'

dumping the GLIBC syms of the troubled library:
Code: Text  [Select][+][-]
  1. objdump libdatecsd.so -t | grep GLIBC
  2. 00000000       F *UND*  00000000              read@@GLIBC_2.0
  3. 00000000       F *UND*  00000000              printf@@GLIBC_2.0
  4. 00000000       F *UND*  00000000              tcflush@@GLIBC_2.0
  5. 00000000       F *UND*  00000000              clock_gettime@@GLIBC_2.17
  6. 00000000       F *UND*  00000000              cfsetospeed@@GLIBC_2.0
  7. 00000000       F *UND*  00000000              __stack_chk_fail@@GLIBC_2.4
  8. 00000000  w    F *UND*  00000000              __cxa_finalize@@GLIBC_2.1.3
  9. 00000000       F *UND*  00000000              tcsetattr@@GLIBC_2.0
  10. 00000000       F *UND*  00000000              puts@@GLIBC_2.0
  11. 00000000       F *UND*  00000000              open@@GLIBC_2.0
  12. 00000000       F *UND*  00000000              strlen@@GLIBC_2.0
  13. 00000000       F *UND*  00000000              write@@GLIBC_2.0
  14. 00000000       F *UND*  00000000              cfsetispeed@@GLIBC_2.0
  15. 00000000       F *UND*  00000000              atol@@GLIBC_2.0
  16. 00000000       F *UND*  00000000              __isoc99_sscanf@@GLIBC_2.7
  17. 00000000       F *UND*  00000000              fcntl@@GLIBC_2.28
  18. 00000000       F *UND*  00000000              toupper@@GLIBC_2.0
  19. 00000000       F *UND*  00000000              strcasestr@@GLIBC_2.1
  20. 00000000       F *UND*  00000000              sprintf@@GLIBC_2.0
  21. 00000000       F *UND*  00000000              tcgetattr@@GLIBC_2.0
  22. 00000000       F *UND*  00000000              close@@GLIBC_2.0
  23.  

Meanwhile I have upgraded my Ubuntu to 20.04. It was installed as 16.0, after that upgraded to 18.0 and now it is 20.04.

Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 x86_64-linux-gtk2
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
GLIBC version 2.31

If it can make a difference - my target is 32-bit, i.e. with -m32 option for gcc and -P386 option for FPC.

Somebody have a clue?
« Last Edit: August 16, 2024, 08:35:20 pm by alpine »
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

alpine

  • Hero Member
  • *****
  • Posts: 1263
Re: undefined reference to `fcntl@GLIBC_2.28'
« Reply #1 on: August 16, 2024, 08:34:59 pm »
Solved (sort of) by binding fcntl() to a base version node into the C source with
Code: C  [Select][+][-]
  1. __asm__(".symver fcntl,fcntl@GLIBC_2.0");

According to:
https://forum.lazarus.freepascal.org/index.php/topic,58888.msg486108.html#msg486108 and https://web.archive.org/web/20160107032111/http://www.trevorpounds.com/blog/?p=103
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

MarkMLl

  • Hero Member
  • *****
  • Posts: 7699
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #2 on: August 16, 2024, 10:01:08 pm »
Thanks for that, and... wow, /that/ thread :-(

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

robert rozee

  • Full Member
  • ***
  • Posts: 160
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #3 on: August 17, 2024, 07:23:28 am »
[...] /that/ thread :-(

"/that/" thread yielded one of the longest ever discussions on this area of the forum, generated a good understanding for many of us for what is happening, and yielded a set of solutions for the related problems that folks were encountering.

all-in-all, i think it was a good outcome! i used to hold out hope that there would be an 'official' set of changes made to lazarus/FPC to create a non-ad-hoc solution, but i can't see it every happening in any of our lifetimes.


cheers,
rob   :-)

Fred vS

  • Hero Member
  • *****
  • Posts: 3362
    • StrumPract is the musicians best friend
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #4 on: August 17, 2024, 02:40:16 pm »
[...] /that/ thread :-(

"/that/" thread yielded one of the longest ever discussions on this area of the forum, generated a good understanding for many of us for what is happening, and yielded a set of solutions for the related problems that folks were encountering.

all-in-all, i think it was a good outcome! i used to hold out hope that there would be an 'official' set of changes made to lazarus/FPC to create a non-ad-hoc solution, but i can't see it every happening in any of our lifetimes.


cheers,
rob   :-)

Hello Rob!

For those who don't want to wait too long, there is that solution.

Fre;D
« Last Edit: August 17, 2024, 02:54:29 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

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1761
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #5 on: August 17, 2024, 03:44:27 pm »
Quote
all-in-all, i think it was a good outcome! i used to hold out hope that there would be an 'official' set of changes made to lazarus/FPC to create a non-ad-hoc solution, but i can't see it every happening in any of our lifetimes

If i am well-informed, versioned linking will be added to FPC (trunk). Will take some time (core-developer is very busy). This is also the reason why I abandoned my own efforts (also being more of a hack than an implementation).

robert rozee

  • Full Member
  • ***
  • Posts: 160
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #6 on: August 17, 2024, 04:39:19 pm »
hi Fred   :-)

i'd forgotten about your fpc-ootb, to be honest i've not been doing much programming at all over the last few months. a quick question - am i right in saying fpc-ootb does not include the lazarus IDE and LCL? if not, is there any sort of 'lazarus-ootb', or a set of instructions on how to install stock-lazrus to work with it?

in the past, i've always just downloaded the three .deb install packages from sourceforge:
https://sourceforge.net/projects/lazarus/
and ended up with things residing in /usr/share and /usr/bin - the downside of this being that one needs sudo to make library changes and can't add new components to the IDE.

Don - am really happy to hear that there has been some progress, any idea if this is something that is months, years, or longer away?


cheers,
rob   :-)

Fred vS

  • Hero Member
  • *****
  • Posts: 3362
    • StrumPract is the musicians best friend
Re: [SOLVED] undefined reference to `fcntl@GLIBC_2.28'
« Reply #7 on: August 17, 2024, 06:14:55 pm »
hi Fred   :-)

i'd forgotten about your fpc-ootb, to be honest i've not been doing much programming at all over the last few months. a quick question - am i right in saying fpc-ootb does not include the lazarus IDE and LCL? if not, is there any sort of 'lazarus-ootb', or a set of instructions on how to install stock-lazrus to work with it?

in the past, i've always just downloaded the three .deb install packages from sourceforge:
https://sourceforge.net/projects/lazarus/
and ended up with things residing in /usr/share and /usr/bin - the downside of this being that one needs sudo to make library changes and can't add new components to the IDE.

Don - am really happy to hear that there has been some progress, any idea if this is something that is months, years, or longer away?


cheers,
rob   :-)

Hello Rob!!
fpc-ootb is a fork of Free Pascal compiler with all the features that I really need (and that fpc devs are welcome to add... ;) )
For Lazarus IDE and LCL maybe there are some libc methods that need to sign too, I did not check LCL code.
But I have compiled the Lazarus app LazPaint using fpc-ootb and it can be run on very old distros and all the libc methods are signed with old libc compatible table.
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

 

TinyPortal © 2005-2018