[etherlab-users] Linker problems with stable-1.5 patched with the latest rtdm-patch
WIEGAND Ralf
Ralf.Wiegand at hexagonmetrology.com
Tue Mar 13 16:20:53 CET 2012
Thanks for the fast response.
The problem is only with the ecrt_rtdm_*** library-functions and not with other functions, like erct_master_get_slave(..). My ld configuration contains /usr/realtime/lib and /opt/etherlab/lib system wide (etc/ld.so.conf.d/). I used exactly this configuration for older versions of the etherlabmaster patched with rtdm-support.
Could it be a problem with the rpath-entry in the libethercat for the rtdm-library ?
The attached file contains the output of readelf -a libethercat.so.
Regards,
Ralf Wiegand
Hexagon Metrology GmbH
Siegmund-Hiepe-Str. 2-12
35578 Wetzlar
Deutschland
Phone: +49 6441 207-410
Fax: +49 6441 207-387
E-Mail: Ralf.Wiegand at hexagonmetrology.com
Hauptgeschäftsführer: Holger Fritze
Geschäftsführer: Per Holmberg - Erik Steinbacher - Arno Seuren
Amtsgericht Wetzlar, HRB 1201
-----Ursprüngliche Nachricht-----
Von: Richard Hacker [mailto:ha at igh-essen.com]
Gesendet: Dienstag, 13. März 2012 09:25
An: etherlab-users at etherlab.org
Cc: WIEGAND Ralf
Betreff: Re: [etherlab-users] Linker problems with stable-1.5 patched with the latest rtdm-patch
On Monday 12 March 2012 21:39:28 WIEGAND Ralf wrote:
> Hello Graeme,
>
> first of all, thanks for the great job on the rtdm-patch.
>
> I am trying to use your latest rtdm-patch for the stable-1.5 on revision
> 2266 and get some problems during linking my own application. There are
> undefined references to every ecrt_rtdm_*** library function. I use the
> linker-flags "-L/usr/realtime/lib -L/opt/etherlab/lib" and "-llxrt -lrtdm
> -lethercat". The patch, compilation and installation of the master runs
> without any problems. The ld is configured to search libraries under
> /usr/realtime/lib and /opt/etherlab/lib.
... but libc probably isn't ;)
While you told your linker where to find libetherlab.so (by using
-L/opt/etherlab/lib), libc (actually libdl.so.2) does not know where to find
it. If you call ldd on your executable, you should find that libetherlab.so is
not resolved.
To tell libdl.so.2 where to find the library, you must use the option rpath in
the linking stage of ld:
ld -o <executable> <objects>.o \
-L/opt/etherlab/lib -rpath=/opt/etherlab/lib -letherlab
or with gcc:
gcc -o <executable> <objects>.o \
-L/opt/etherlab/lib -Wl,-rpath=/opt/etherlab/lib -letherlab
Alternatively you can configure it system wide by adding the line
/opt/etherlab/lib
to /etc/ld.so.conf
or added a file /etc/ld.so.conf.d/ethercat.conf with the directory included.
Thereafter run ldconfig as root (instead of rebooting, which will also work...
but we're not using Windows here ;) )
Now calling ldd on your executable should show libetherlab.so being resolved.
> I also checked the content of the
> libethercat library with readelf, but all called library-functions are
> listed in the output. When i try to read out the ELF information with
> readelf of the ec_rtai_rtdm_example, i get an error that the file isn't an
> ELF-file.
It is probably statically linked to libethercat.a, although I am not conviced
thereof.
>
> My system is debian based (lenny) with kernel 2.6.32.11 and rtai-3.8.1.
>
> Do you or anybody on the list have any idea to solve the problem or give me
> a hint ?
>
>
> Regards,
>
> Ralf Wiegand
>
>
> Hexagon Metrology GmbH
> Siegmund-Hiepe-Str. 2-12
> 35578 Wetzlar
> Deutschland
>
> Phone: +49 6441 207-410
> Fax: +49 6441 207-387
>
> E-Mail: Ralf.Wiegand at hexagonmetrology.com
>
>
>
> Hauptgeschäftsführer: Holger Fritze
> Geschäftsführer: Per Holmberg - Erik Steinbacher - Arno Seuren
> Amtsgericht Wetzlar, HRB 1201
>
>
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>
Mit freundlichem Gruß
Richard Hacker
--
------------------------------------------------------------------------
Richard Hacker M.Sc.
richard.hacker at igh-essen.com
Tel.: +49 201 / 36014-16
Ingenieurgemeinschaft IgH
Gesellschaft für Ingenieurleistungen mbH
Heinz-Bäcker-Str. 34
D-45356 Essen
Amtsgericht Essen HRB 11500
USt-Id.-Nr.: DE 174 626 722
Geschäftsführung:
- Dr.-Ing. S. Rotthäuser,
- Dr.-Ing. T. Finke,
- Dr.-Ing. W. Hagemeister
Tel.: +49 201 / 360-14-0
http://www.igh-essen.com
------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libethercat.out
Type: application/octet-stream
Size: 35032 bytes
Desc: libethercat.out
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20120313/5be01ebd/attachment-0004.obj>
More information about the Etherlab-users
mailing list