multiple definition of `xenomai_main'
Hi,
I am building Etherlab ethercat master application with RTDM interface.
The steps I used as follows:
step 1. Installing the Xenomai libraries and toolsA. get Xenomail release tarball: xenomai-3.0.1.tar.bz2B. building:$ export xenomai_root="/work/develop/xenomai-3.0.1"$ export build_root="/work/tmp/xenomai/build_root"$ mkdir $build_root/xenomai && cd $build_root/xenomai$ xenomai_root/configure CFLAGS="-march=armv7-a -mfpu=vfp3" LDFLAGS="-march=armv7-a -mfpu=vfp3" --build=i686-pc-linux-gnu --host=arm-linux-gnueabihf --with-core=cobalt$ make installNow, I got Xenomia libraries and tools under /usr/xenomai.So, I build application after got Xenomai libraries.
step 2. Building Etherlab(ethercat-1.5.2) softwareA. get and extract ethercat-1.5.2.tar.bz2B. building:$ export ethercatpath=/work/tmp/ethercat-hg$ export kernelpath=/work/develop/botbone_os_kernel$ export targetpath=${ethercatpath}/target/xenomai$ export xenomaipath=/usr/xenomaimkdir -p ${targetpath}cd ${ethercatpath}$ ./configure --with-devices=2 --enable-8139too=no --enable-generic=yes --enable-rtdm --with-xenomai-dir=${xenomaipath} --with-linux-dir=${kernelpath} CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CPP=arm-linux-gnueabihf-cpp --host=arm-none-linux-gnueabi$ make
But, I failed to compile the application and got error as follows:.../usr/xenomai/lib/xenomai/bootstrap.o: In function __wrap_main':bootstrap.c:(.text+0x0): multiple definition of xenomai_main'/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference to rt_dev_ioctl'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference to rt_dev_open'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference to rt_dev_close'collect2: error: ld returned 1 exit statusmake[4]: *** [ec_xenomai_example] Error 1make[4]: Leaving directory /work/tmp/ethercat-hg/examples/xenomai'make[3]: *** [all-recursive] Error 1make[3]: Leaving directory /work/tmp/ethercat-hg/examples'make[2]: *** [all] Error 2make[2]: Leaving directory /work/tmp/ethercat-hg/examples'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/work/tmp/ethercat-hg'make: *** [all] Error 2
I don't understand what happened because I just compiled source code.So, It's sure I make wrong setting for those two configure process.Or, I forgot to set any correct libraries path for compiling?Could anyone give me any suggestion for these errors?Thank you in advance.
Quoted 4 lines · Shen Felix
Hi,
I am building Etherlab ethercat master application with RTDM interface.
The steps I used as follows:
step 1. Installing the Xenomai libraries and toolsA. get Xenomail release tarball: xenomai-3.0.1.tar.bz2B. building:$ export xenomai_root="/work/develop/xenomai-3.0.1"$ export build_root="/work/tmp/xenomai/build_root"$ mkdir $build_root/xenomai && cd $build_root/xenomai$ xenomai_root/configure CFLAGS="-march=armv7-a -mfpu=vfp3" LDFLAGS="-march=armv7-a -mfpu=vfp3" --build=i686-pc-linux-gnu --host=arm-linux-gnueabihf --with-core=cobalt$ make installNow, I got Xenomia libraries and tools under/usr/xenomai.So, I build application after got Xenomai libraries.
Please use 3.0.3.
Quoted 6 lines
step 2. Building Etherlab(ethercat-1.5.2) softwareA. get and extract ethercat-1.5.2.tar.bz2B. building:$ export ethercatpath=/work/tmp/ethercat-hg$ export kernelpath=/work/develop/botbone_os_kernel$ export targetpath=${ethercatpath}/target/xenomai$ export xenomaipath=/usr/xenomaimkdir -p ${targetpath}cd ${ethercatpath}$ ./configure --with-devices=2 --enable-8139too=no --enable-generic=yes --enable-rtdm --with-xenomai-dir=${xenomaipath} --with-linux-dir=${kernelpath} CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CPP=arm-linux-gnueabihf-cpp --host=arm-none-linux-gnueabi$ make
But, I failed to compile the application and got error as follows:.../usr/xenomai/lib/xenomai/bootstrap.o: In function__wrap_main':bootstrap.c:(.text+0x0): multiple definition ofxenomai_main'/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_ioctl'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_open'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_close'collect2: error: ld returned 1 exit statusmake[4]: *** [ec_xenomai_example] Error 1make[4]: Leaving directory/work/tmp/ethercat-hg/examples/xenomai'make[3]: *** [all-recursive] Error 1make[3]: Leaving directory/work/tmp/ethercat-hg/examples'make[2]: *** [all] Error 2make[2]: Leaving directory/work/tmp/ethercat-hg/examples'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/work/tmp/ethercat-hg'make: *** [all] Error 2I don't understand what happened because I just compiled source code.So, It's sure I make wrong setting for those two configure process.Or, I forgot to set any correct libraries path for compiling?Could anyone give me any suggestion for these errors?Thank you in advance.
It looks like the Ethercat build system was not updated for using Xenomai 3.x, at least to enable the backward compatibility mode for using the obsolete rt_dev_* API. The double definition of xenomai_main() denotes an issue with the LDFLAGS.
Signature · 1 line
Philippe.
Quoted 10 lines · Philippe Gerum
Quoted 4 lines · Shen Felix
Hi,
I am building Etherlab ethercat master application with RTDM interface.
The steps I used as follows:
step 1. Installing the Xenomai libraries and toolsA. get Xenomail release tarball: xenomai-3.0.1.tar.bz2B. building:$ export xenomai_root="/work/develop/xenomai-3.0.1"$ export build_root="/work/tmp/xenomai/build_root"$ mkdir $build_root/xenomai && cd $build_root/xenomai$ xenomai_root/configure CFLAGS="-march=armv7-a -mfpu=vfp3" LDFLAGS="-march=armv7-a -mfpu=vfp3" --build=i686-pc-linux-gnu --host=arm-linux-gnueabihf --with-core=cobalt$ make installNow, I got Xenomia libraries and tools under/usr/xenomai.So, I build application after got Xenomai libraries.Please use 3.0.3.
Quoted 3 lines
step 2. Building Etherlab(ethercat-1.5.2) softwareA. get and extract ethercat-1.5.2.tar.bz2B. building:$ export ethercatpath=/work/tmp/ethercat-hg$ export kernelpath=/work/develop/botbone_os_kernel$ export targetpath=${ethercatpath}/target/xenomai$ export xenomaipath=/usr/xenomaimkdir -p ${targetpath}cd ${ethercatpath}$ ./configure --with-devices=2 --enable-8139too=no --enable-generic=yes --enable-rtdm --with-xenomai-dir=${xenomaipath} --with-linux-dir=${kernelpath} CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CPP=arm-linux-gnueabihf-cpp --host=arm-none-linux-gnueabi$ make
But, I failed to compile the application and got error as follows:.../usr/xenomai/lib/xenomai/bootstrap.o: In function__wrap_main':bootstrap.c:(.text+0x0): multiple definition ofxenomai_main'/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_ioctl'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_open'/work/tmp/ethercat-hg/lib/.libs/libethercat_rtdm.so: undefined reference tort_dev_close'collect2: error: ld returned 1 exit statusmake[4]: *** [ec_xenomai_example] Error 1make[4]: Leaving directory/work/tmp/ethercat-hg/examples/xenomai'make[3]: *** [all-recursive] Error 1make[3]: Leaving directory/work/tmp/ethercat-hg/examples'make[2]: *** [all] Error 2make[2]: Leaving directory/work/tmp/ethercat-hg/examples'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/work/tmp/ethercat-hg'make: *** [all] Error 2
Quoted 7 lines
Quoted 2 lines
I don't understand what happened because I just compiled source code.So, It's sure I make wrong setting for those two configure process.Or, I forgot to set any correct libraries path for compiling?Could anyone give me any suggestion for these errors?Thank you in advance.
It looks like the Ethercat build system was not updated for using Xenomai 3.x, at least to enable the backward compatibility mode for using the obsolete rt_dev_* API. The double definition of
xenomai_main()denotes an issue with the LDFLAGS.
Nice reply. I once downloaded an obsolete 2.x code file with rt_dev_*. After modified to new ones and "--rtdm" was added to CFLAGS and LDFLAGS in the makefile, compilation became ok.
Also, when xenomai was installed, a file named xenomai.conf or something else with the content "$prefix/xenomai/lib" should be added to the /etc/ld.so.conf.d directory and "ldconfig" should be run. Then the xenomai lib will be recognized. To avoid mass display with the web-browser, you should edit your e-mail with a mail client and use the plain text :)
Good trip with xenomai.