[fpc-pascal] CThreads problem when cross-compiling to ARM/RPi.

Jonas Maebe jonas.maebe at elis.ugent.be
Thu May 23 14:50:07 CEST 2013

On 23 May 2013, at 14:32, Bruce Tulloch wrote:

> On Thu, May 23, 2013 at 10:28 PM, Jonas Maebe <jonas.maebe at elis.ugent.be 
> >wrote:
>> On 23 May 2013, at 14:25, Bruce Tulloch wrote:
>> Do you have a libdl.so in your library search path? And what kind of
>> reference to libdl does link.res contain?
> Yes, it's in the search path as:
> root at beria:/lib/arm-linux-gnueabihf# ls -l libdl*
> -rw-r--r-- 1 root root 9812 Feb 23 00:37 libdl-2.13.so
> lrwxrwxrwx 1 root root   13 Feb 23 00:37 libdl.so.2 -> libdl-2.13.so

You don't have libdl.so, only libdl.so.2. The latter is for use at run  
time, the former for use at link/compile time. Install the libc-dev or  
similar package in your crossroot to get it along with other missing  
symlinks. Do not start creating those manually, it will only lead to  
errors and confusion down the line.

> It's referred to in an INPUT statement in link.res as:
> -lpthread
> -ldl
> )
> and there are two search statements:
> SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/usr/lib/arm-linux- 
> gnueabihf/")
> SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/lib/arm-linux- 
> gnueabihf/")
> at the top of the file which suggest it should be found okay.

The linker will only look for libdl.so and resolve it to its target in  
case it's a symlink, so that the symlink is no longer required at run  
time. It will not look for libdl.so.<something>, that one is used by  
the programs at run time (since the symlinks at compile/link time  
pointed to it and the linker will write the name of this symlink  
target into the binary's list of linked libraries).

> Just noticed another INPUT statement also refers to dl as:
> /usr/local/lib/fpc/2.7.1/units/arm-linux/rtl/dl.o
> This appears ahead of the -ldl statement.

That is the object file of the Pascal "dl" unit. It is unrelated to  
your library issue.


More information about the fpc-pascal mailing list