[fpc-pascal] Static linking to C library on Linux
Ryan Joseph
genericptr at gmail.com
Wed Nov 27 17:16:57 CET 2019
I'm trying to link to a static library (built from Python sources) in Pascal and having troubles on Linux. On Mac where I have experience I successfully link and every works as expected but on Linux I get slews of linker errors in what appear to be standard C library functions.
For example:
/usr/bin/ld.bfd: /home/chris/pas/PythonBridge-master/sources/libpython3.7m.a(bytearrayobject.o): in function `memcpy':
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34: undefined reference to `memcpy'
/usr/bin/ld.bfd: /home/chris/pas/PythonBridge-master/sources/libpython3.7m.a(typeobject.o): in function `_PyType_Name':
/home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:417: undefined reference to `strrchr'
/usr/bin/ld.bfd: /home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:107: undefined reference to `strlen'
/usr/bin/ld.bfd: /home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:108: undefined reference to `strncmp'
/usr/bin/ld.bfd: /home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:103: undefined reference to `strrchr'
/usr/bin/ld.bfd: /home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:107: undefined reference to `strlen'
/usr/bin/ld.bfd: /home/chris/Downloads/Python-3.7.4/Objects/typeobject.c:108: undefined reference to `strncmp'
Do I need to link to other system libraries when building on Linux? I'm also confused because I thought the purpose of the static libraries was to contain all the code they needed to run and thus these system functions like "memcpy" would be present also. I used to same make command I did on Mac to build the library but maybe I did something wrong on Linux.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list