On 8/30/23 10:45, andy pugh wrote:
On Wed, 30 Aug 2023 at 15:06, andy pugh <bodge...@gmail.com> wrote:

rtapi_app is compiled/linked via src/rtapi/Submakefile.

I am no less confused now. The compilation command is

c++ -std=gnu++17 -rdynamic -L/home/andypugh/linuxcnc-dev/lib
-Wl,-rpath,/home/andypugh/linuxcnc-dev/lib -ltirpc  -lgpiod -o
../bin/rtapi_app objects/rtapi/uspace_rtapi_app.o
objects/rtapi/uspace_rtapi_parport.o
objects/rtapi/uspace_rtapi_string.o objects/rtapi/rtapi_pci.o
-pthread -lrt -ludev  -ldl

I'm confused by this command line.

The "-o ../bin/rtapi_app" indicates that we're building rtapi_app from a bunch of object files and libraries. Is it really rtapi_app that needs to be linked against libgpiod, isn't it the hal_gpiod driver?

If i'm misremembering how that stuff's supposed to work (which is very possible), the other possibility that comes to mind is the order of arguments on the linker command line. Some linkers (but I think not all?) require that the "-lwhatever" libraries come *later* in the command line than the object files that require them. When the linker comes to to a -l argument, it tries to satisfy any *currently unknown* symbols from the named library.


And there is a clear "-lgpiod" as a flag.  But once compiled:

andypugh@pi400:~/linuxcnc-dev/src$ ldd ../bin/rtapi_app
linux-vdso.so.1 (0x0000ffff7f950000)
libudev.so.1 => /lib/aarch64-linux-gnu/libudev.so.1 (0x0000ffff7f850000)
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff7f630000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff7f5f0000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff7f440000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff7f913000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff7f3a0000)

Which doesn't really seem to match?


If none of rtapi_app's input files needed symbols from libgpiod, then the linker will not link rtapi_app against libgpiod. See for example how the -ltirpc in the linker command line did not cause rtapi_app to be linked to libtirpc.


--
Sebastian Kuzminsky



_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to