Fix linking against libraries in Makefile.modinc#2610
Fix linking against libraries in Makefile.modinc#2610gmoccapy merged 1 commit intoLinuxCNC:masterfrom
Conversation
When linking a shared object/executable, libraries have to be added after the object files and not before. Otherwise, symbols used in the object files are not resolved. See https://forum.linuxcnc.org/9-installing-linuxcnc/41983-linuxcnc-ethercat-undefined-symbol-ecrt-slave-config-sdo?start=0
|
I don't have any EtherCAT hardware, so I will just have to trust you on this.... |
|
To test this, no hardware is needed. The point is that the lcec module likes to link against other libraries, for instance libethercat. But right now, without this patch and sittner/linuxcnc-ethercat#122, it looks like this: When loading the module which is missing the link to libethercat, the symbol The reason why it does not work with the current makefiles is the order of the linker arguments. Missing symbols are resolved left to right. creates an executable If the order of the arguments is swapped missing symbols are not looked up in libethercat and stay unresolved. This is the current case. |
This is basically sittner#122 and LinuxCNC/linuxcnc#2610 manually merged. Should fix sittner#123
This is basically sittner#122 and LinuxCNC/linuxcnc#2610 manually merged. Should fix sittner#123
When linking a shared object/executable, libraries have to be added after the object files and not before. Otherwise, symbols used in the object files are not resolved.
See https://forum.linuxcnc.org/9-installing-linuxcnc/41983-linuxcnc-ethercat-undefined-symbol-ecrt-slave-config-sdo?start=0