fredvs / freepascal-ootb

Free Pascal Compiler OOTB - an open source Object Pascal compiler that works out of the box, no installation needed. It is is a fork from Free Pascal fpc.
8 stars 1 forks source link

[Linux Mageia] Cannot find libdl.so #2

Closed rchastain closed 3 months ago

rchastain commented 3 months ago

Hello Fred!

I try to use the 32-bit compiler under Linux Mageia 64-bit, and I get this error:

/usr/bin/ld: cannot find -l:libdl.so: No such file or directory

After seeing this discussion, I tried to create a symlink as it suggested, but it doesn't solve the problem.

Would you have an idea?

fredvs commented 3 months ago

¡Hello Roland!

Sorry for the delay, I did not see the issue.

Does it appear with fpc-ootb 32 bit or/also with original fpc 32 bit?

The error message indicates that libdl.so 32 bit is not found (to compile 32 bit apps you need the 32 bit version of libdl.so).

Is your system multi-arch ( 64 bit libraries and 32 bit libraries installed )?

On Debian system like Ubuntu it is done on terminal with:

> dpkg --add-architecture i386
> sudo apt-get update

For Magea a trick would be to use the installation of wine. (the Great Windows emulator). wine needs 32 bit libraries and a multi-arch system installed on Magea.

https://wine.htmlvalidator.com/install-wine-on-mageia-9.html

In the link they explain how to install 32 bit system on a 64 bit OS. See chapter: Enable 32-bit repositories If you dont want to install wine, it should be enough.

If, after install of 32-bit libraries + reboot, you still get the error:

/usr/bin/ld: cannot find -l:libdl.so: No such file or directory

(but strange, if you use fpc-ootb, the command to linker should be -l:libdl.so.2)

Try doing this on terminal:

> find /usr/ -name libdl.so.2

Locate in the result the 32 bit libdl.so.2, in my system it is there:

/usr/lib/i386-linux-gnu/libdl.so.2

And create a symlink libdl.so:

> sudo ln -s /usr/lib/i386-linux-gnu/libdl.so.2 /usr/lib/i386-linux-gnu/libdl.so

Good luck (and courage).

Fre;D

rchastain commented 3 months ago

Hello Fred. Thank you for the long and detailed answer.

Does it appear with fpc-ootb 32 bit or/also with original fpc 32 bit?

I have only fpc-ootb. fpc 32 bit is available in package manager, but it's impossible to install fpc 64 and fpc 32, I don't know why. (Maybe I could ask the question on the Mageia forum.)

I already have 32-bit repositories enabled. When I try what you suggest (the symbolic link), I get this error:

/usr/bin/ld: /home/roland/Applications/freepascal32/units/i386-linux/rtl/si_c21.o: in function `SI_C21_$$__FPC_LIBC21_START':
si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x27): undefined reference to `__libc_csu_fini'
/usr/bin/ld: si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x2c): undefined reference to `__libc_csu_init'
rchastain commented 3 months ago

Maybe I should learn to compile fpc by myself?

By the way, it would be interesting if you would explain how you build fpc-ootb.

fredvs commented 3 months ago

Hello Roland.

Are you using the asset from the release: https://github.com/fredvs/freepascal-ootb/releases/download/3.2.2/fpc-ootb-322-i386-linux_glibc20.zip

If so, I dont understand why you get the error:

undefined reference to `__libc_csu_fini'

It was fixed, see readme.md:

NEW: Release OOTB-glibc20 for Linux 32 bit: with signed symbol GLIBC_2.0. for all glibc methods and link with 'libdl.so.2'.
This is to have binaries that run on system with older or newer version of glibc than the one on the system-compilation.
Also fixed libc_csu_init and libc_csu_fini error at linking on last Linux distros.

Also I dont understand why you need to create a symlink libdl.so, it was fixed in fpc-ootb too.

Fre;D

fredvs commented 3 months ago

By the way, it would be interesting if you would explain how you build fpc-ootb.

Take a look in fpc-ootb source: https://github.com/fredvs/freepascal-ootb/blob/main/build_fpc32_linux.sh

rchastain commented 3 months ago

Are you using the asset from the release: https://github.com/fredvs/freepascal-ootb/releases/download/3.2.2/fpc-ootb-322-i386-linux_glibc20.zip

I have just seen that there are new binaries. So, no, I wasn't using the latest binaries. I will try the new binaries tonight and come back.

fredvs commented 3 months ago

I have just seen that there are new binaries. So, no, I wasn't using the latest binaries. I will try the new binaries tonight and come back.

Ha ok, because otherwise I am completely lost.

Take a look in fpc-ootb source: https://github.com/fredvs/freepascal-ootb/blob/main/build_fpc32_linux.sh

Also, to compile fpc-ootb 32 bit (or fpc "original" 32 bit), you will need a working fpc(-ootb) 32 bit installed.

rchastain commented 3 months ago

Compilation successful with the new binaries. Thank you Fred!