sechshelme / Lazarus-SDL3.0-Packages_and_Examples

2 stars 0 forks source link

Error while loading library #2

Open rchastain opened 5 months ago

rchastain commented 5 months ago

Hello! It's me again. :)

I noticed something.

When I run a program using SDL3 unit, I have to set LD_LIBRARY_PATH.

So I use this script:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/

if [ $# -eq 0 ]
  then
    echo "Missing parameter"
  else
    $1
fi

Otherwise, if I try to run the program directly, I get the following error:

[roland@localhost anim (main)]$ ./Project1
./Project1: error while loading shared libraries: libSDL3.so.0: cannot open shared object file: No such file or directory

Of course, I can live with that. But I noticed that I don't have this problem with C programs using SDL3. I can run them directly, without setting LD_LIBRARY_PATH.

sechshelme commented 5 months ago

I don't have to do anything like that, it works straight away for me. How did you install your SDL3 library? I do it with cmake and then with sudo make install -j

For me the finished lin is here "/usr/local/lib"

rchastain commented 5 months ago

Thank you for your answer. I didn't know the -j option.

I installed like this:

cmake -S . -B build
cmake --build build
sudo cmake --install build

What is weird is that (as I said), the C examples work without problem. The problem is only with the Pascal examples.

sechshelme commented 5 months ago

Thank you for your answer. I didn't know the -j option.

Ideally, you should write a number at the end, depending on the number of cores in the CPU or a few more. Just a -j starts almost simply starts a new process for each section. With things as small as SDL3 you don't notice anything, but if you compile a Linux kernel, your PC can freeze. It's still running and compiling, but it no longer responds to input.

Of course, I can live with that. But I noticed that I don't have this problem with C programs using SDL3. I can run them directly, without setting LD_LIBRARY_PATH.

Have you ever tried sudo ldconfig? Otherwise, your Linux manages the libs differently than my "Linux Mint".

I suspect your cmake does something similar to what I did with "make".

Does it look something like this for you too:

make.txt