AutonomyLab / ardrone_autonomy

ROS driver for Parrot AR-Drone 1.0 and 2.0 quadrocopters
http://wiki.ros.org/ardrone_autonomy
BSD 3-Clause "New" or "Revised" License
356 stars 226 forks source link

Compiling for ARM (Odroid U2) #71

Closed krsapkota closed 7 years ago

krsapkota commented 11 years ago

I get this error while I try to compile the libraries on my ubuntu linaro.

Error: bad instruction `bswap r4'

I am compiling natively. I had a similar problem on RaspberryPi so I switched to Odroid U2 but the problem persists.

Any help would be highly appreciated!

Thanks

mani-monaj commented 11 years ago

I get this error while I try to compile the libraries on my ubuntu linaro.

You mean compiling the SDK?

krsapkota commented 11 years ago

yes, while building sdk.

mani-monaj commented 11 years ago

The Parrot SDK consists of lots of libraries, either written by Parrot for multi-platform networking and thread management or 3rd parties like FFMPEG. The build system is also optimized for each platform independently using appropriate compile flags. In my opinion it is not straight forward to make the Makefiles compatible with ARM. Extra effort may also needed to change some header files.

If you just need basic functionalities, I would suggest to take a look at NodeCopter project which is a lightweight implementation of the SDK in JavaScript. You may also be able to bridge that with ROS using Ros Bridge.

krsapkota commented 11 years ago

Ok finally fixed the problem with some minor hack, found out that assembler instruction "bswap" does not exist on ARM. So in ardrone_autonomy / ARDroneLib / VP_SDK / VP_Os / linux / intrin.h I replaced _byteswap_ulong for TARGET_CPU_X86 with the same function for TARGET_CPU_ARM (else part) and commented out _BitScanReverse. Now it compiles like a charm and I am running it on odroid (armv7l).

mani-monaj commented 11 years ago

@krsapkota That is really interesting. Are you interested to contribute the ARM Compiling Guide on this project's wiki?

krsapkota commented 11 years ago

Ya sure! But the problem is i am just done with my internship and i don't have any arm machine with me right now. Probably I should get a RaspberryPi.

mtourne commented 10 years ago

Hello, I encountered the same problem on the same platform (Odroid U2 / armv7)

It seems that automatically when using USE_LINUX=yes then TARGET_CPU_X86=1

Here is the quick & dirty patch I made on the build system : https://gist.github.com/mtourne/7258641

I also had trouble compiling VLIB, I'm now using the arm11 (VLIB/Platform/arm11) code which seems to have no platform specific code in it.

I'm not yet sure the video acquisition will work and at what fps, I'll keep you posted.

ghost commented 10 years ago

I followed this suggestion:

"Ok finally fixed the problem with some minor hack, found out that assembler instruction "bswap" does not exist on ARM. So in ardrone_autonomy / ARDroneLib / VP_SDK / VP_Os / linux / intrin.h I replaced byteswapulong for TARGET_CPU_X86 with the same function for TARGET_CPU_ARM (else part) and commented out _BitScanReverse. Now it compiles like a charm and I am running it on odroid (armv7l)."

However I got the following error: ld common/mobile_main /usr/bin/ld: ../../Soft/Build/targets_versions/ffmpeg_static_PROD_MODE_Linux_3.8.13.14_GNU_Linux_usrbingcc_4.6.4/libavcodec.a(mpegvideo_enc.o): undefined reference to symbol 'lrintf@@GLIBC_2.4' /lib/arm-linux-gnueabihf/libm.so.6: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status

My gcc version is 4.6.4 and I am using Xubuntu 13.10 odroid u2

krsapkota commented 10 years ago

Make sure that you do not have conflicting ffmpeg libraries. I suggest uninstalling all ffmpeg stuff and rebuilding the sdk because before you build the sdk, the script (build_sdk.sh) builds and installs ffmpeg anyway and this ffmpeg is compatible with ardone_autonomy.

On Sun, Feb 2, 2014 at 4:51 AM, Tyler Zhu notifications@github.com wrote:

I followed this suggestion:

"Ok finally fixed the problem with some minor hack, found out that assembler instruction "bswap" does not exist on ARM. So in ardrone_autonomy / ARDroneLib / VP_SDK / VP_Os / linux / intrin.h I replaced byteswapulong for TARGET_CPU_X86 with the same function for TARGET_CPU_ARM (else part) and commented out _BitScanReverse. Now it compiles like a charm and I am running it on odroid (armv7l)."

However I got the following error: ld common/mobile_main /usr/bin/ld: ../../Soft/Build/targets_versions/ffmpeg_static_PROD_MODE_Linux_3.8.13.14_GNU_Linux_usrbingcc_4.6.4/libavcodec.a(mpegvideo_enc.o): undefined reference to symbol 'lrintf@@GLIBC_2.4' /lib/arm-linux-gnueabihf/libm.so.6: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status

My gcc version is 4.6.4 and I am using Xubuntu 13.10 odroid u2

Reply to this email directly or view it on GitHubhttps://github.com/AutonomyLab/ardrone_autonomy/issues/71#issuecomment-33891333 .

ghost commented 10 years ago

Thank you so much. I tried it for a week. I removed both ffmpeg and ffmpeg-odroid and try to compile it. Still failed.

Currently I use Xubuntu 13.10 on Odroid U2. What's your operating system?

Best regards, Tyler

infdsc02 commented 10 years ago

Hi:

Someone tried to install ardrone_autonomy for ROS Hydro version on a ARM device? Because is very different to the Fuerte version that uses mtourne.

Best regards.

P.D: Sorry by my English.

heechul commented 9 years ago

I was just able to compile/run the ardrone driver from the indigo-devel branch on an ARM platform (Tegra TK1) using @mtourne 's patch (after some modifications). Here's what I did.

the git branch is cloned at ~/Projects/catkin_ws/src/ardrone_autonomy 0) cd ~/Projects/catkin_ws/catkin_make ...fail on building ardronlib 1) cd ~/Projects/catkin_ws/build/ardrone/src/ardronelib 2) manually apply the patch https://gist.github.com/mtourne/7258641 3) modify catkin_ws/build/ardrone_autonomy/CMakeFiles/ardronelib.dir/build.make as follow to prevent issuing git update (It would nullify changes in step2. There must be a better way to fix this, but I'm not very familiar with the ROS build system.)

   ardrone/src/ardronelib-stamp/ardronelib-update: ardrone/src/ardronelib-stamp/ardronelib-download
        $(CMAKE_COMMAND) -E cmake_progress_report ...
        # @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue  --bold "Performing update step for 'ardronelib'" 
        # cd  /home/heechul/Projects/catkin_ws/build/ardrone/src/ardronelib &&  /usr/bin/cmake -P  /home/heechul/Projects/catkin_ws/build/ardrone/tmp/ardronelib-gitupdate.cmake

4) catkin_make

The driver seems to run fine on the Tegra K1, but it's cpu consumption is quite high (80% of one core).

Now, I tried to compile http://wiki.ros.org/tum_ardrone on the Tegra K1, but failed. Here's the log. Any suggestions for fixes will be welcome.

catkin_make
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating gvars3/config.h
config.status: gvars3/config.h is unchanged
/usr/bin/ld: src/gvars3.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a s
hared object; recompile with -fPIC
src/gvars3.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[5]: *** [libGVars3.so] Error 1
make[4]: *** [gvars_built] Error 2
make[3]: *** [all] Error 2
make[2]: *** [thirdparty/src/thirdparty-stamp/thirdparty-build] Error 2
make[1]: *** [tum_ardrone/CMakeFiles/thirdparty.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
./configure: 3152: test: linux: unexpected operator
source path               /home/heechul/Projects/catkin_ws/build/ardrone/src/ardronelib/ARDroneLib/FFMPEG/ffmpeg
C compiler                gcc
ARCH                      arm (generic)
big-endian                no
runtime cpu detection     no
ARMv5TE enabled           yes
ARMv6 enabled             yes
ARMv6T2 enabled           yes
ARM VFP enabled           yes
IWMMXT enabled            no
NEON enabled              no     <--- why?
...
Building ARDroneTool/Lib
dep Platform/x86/UVLC/uvlc_codec.c
dep Platform/x86/video_utils.c
...
cc video_codec.c
cc video_controller.c
cc video_mem32.c
/tmp/ccLzql7h.s: Assembler messages:
/tmp/ccLzql7h.s:80: Error: bad instruction `bswap r4'
make[8]: *** [../../Soft/Build/targets_versions/vlib_PROD_MODE_Linux_3.10.24-g2210df4_GNU_Linux_usrbingcc_4.8.2/video_mem32.o] Error 1
make[7]: *** [all] Error 2
make[6]: *** [build_vlib] Error 2
make[5]: *** [all] Error 2
make[4]: *** [build_libs] Error 2
make[3]: *** [all] Error 2
make[2]: *** [ardrone/src/ardronelib-stamp/ardronelib-build] Error 2
make[1]: *** [ardrone_autonomy/CMakeFiles/ardronelib.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

Thanks

infdsc02 commented 9 years ago

Hi:

In your CMakeList.txt change:

GIT_REPOSITORY git://github.com/AutonomyLab/ardronelib.git

by:

GIT_REPOSITORY https://github.com/infdsc02/ardronelib.git

and then delete:

GIT_TAG bdacd1cbd3fbc54263d29e6e2067265e5941d10e

Then try again to compile.

mani-monaj commented 9 years ago

@infdsc02 @heechul @mtourne

If you've found a stable solution, please let me know so we can work to merge your patches into ardronelib.

AlvarHHM commented 9 years ago

I just tried to compile it on a Raspberry Pi (ARMv6)

@infdsc02 's fork does not work, #81 will happen exactly

I then tried, to follow @heechul 's step (manually apply the patch https://gist.github.com/mtourne/7258641) and it work.

yuhuisong commented 9 years ago

I use Ubuntu14.04, ROS indigo and Odroid U3.

I install the package ardrone_autonomy following: $ cd ~/catkin_ws/src $ git clone https://github.com/AutonomyLab/ardrone_autonomy.git -b indigo-devel $ cd ~/catkin_ws $ catkin_make

But failed, then $ cd ~catkin_ws/devel/src/ardronelib/ARDroneLib/VP_SDK/VP_Os/linux/intrin.h follow @krsapkota's step, I replaced _byteswap_ulong for TARGET_CPU_X86 with the same function for TARGET_CPU_ARM (else part) and commented out _BitScanReverse. and follow @heechul' step, modify catkin_ws/build/ardrone_autonomy/CMakeFiles/ardronelib.dir/build.

the driver runs fine.

Then I install the package tum_ardrone following: $ cd ~/catkin_ws/src $ git clone https://github.com/tum-vision/tum_ardrone.git -b indigo-devel $ cd .. $ rosdep install tum_ardrone

I encounted the following error: Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package ros-indigo-ardrone-autonomy ERROR: the following rosdeps failed to install apt: command [sudo -H apt-get install ros-indigo-ardrone-autonomy] failed

$ catkin_make

I encounted the following error: configure: creating ./config.status config.status: creating Makefile config.status: creating gvars3/config.h config.status: gvars3/config.h is unchanged /usr/bin/ld.bfd.real: src/gvars3.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC src/gvars3.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[5]: * [libGVars3.so] Error 1 make[4]: * [gvars_built] Error 2 make[3]: * [all] Error 2 make[2]: * [thirdparty/src/thirdparty-stamp/thirdparty-build] Error 2 make[1]: * [tum_ardrone/CMakeFiles/thirdparty.dir/all] Error 2 make: * [all] Error 2 Invoking "make -j4 -l4" failed

Any suggestions for fixes will be welcome.

mani-monaj commented 9 years ago

Since you successfully compiled the driver from source on Odroid, it is safe to remove "ardrone_autonomy" from tum_ardrone/package.xml file (there is no binary distribution of the driver for ARM architectures). The errors you get when compiling tum_ardrone are caused by missing dependencies. Assuming that those dependencies are available as ARM binaries in Ubuntu/ROS repos, rosdep should be able to install the missing ones.

@yuhuisong Is it possible for you to write a short HOWTO on compiling the driver for Odroid by summarizing all the steps? If so, I will add that to the documentation or wiki for other users to benefit from.

javinavarro commented 9 years ago

I'm trying to install ardrone_autonomy on a raspberry pi as @AlvarTheCoder (on a rpi 2 b model) and I'm having problems with it. I've tried the solutions that you have given on the comments, but no one works for me. I don't know if I'm doing something wrong. I've tried: 1) build the 'default' package, but fails. 2) using the patch of @mtourne and didn't works. 3) making the changes that @krsapkota said. 4) using the patched ardronelib. 5) commenting out the line 21 of the 'new' makefile. If someone know a solution or have installed on a rpi successfuly the package, can you write here the necessary things step by step? Thank you in advance.

PhilippeMorere commented 8 years ago

I had the same problem when compiling on my Raspberry 2. @infdsc02's option wasn't working so I ended up forking the project and applying the patches myself. If anyone is still looking for a solution:

GIT_REPOSITORY git://github.com/AutonomyLab/ardronelib.git GIT_TAG bdacd1cbd3fbc54263d29e6e2067265e5941d10e

by

GIT_REPOSITORY https://github.com/PhilippeMorere/ardronelib.git GIT_TAG 53af2ad47cbfea022f70ca1360daa7974369d6b3

export ROS_PARALLEL_JOBS=-j2

catkin_make

I hope it helps!

mani-monaj commented 8 years ago

@PhilippeMorere

I will be more than happy to include your patch in ardronelib if you open a pull request. My only question is if this patch backward compatible? I mean does it break the build on x86 systems?

PhilippeMorere commented 8 years ago

@mani-monaj Done. https://github.com/AutonomyLab/ardronelib/pull/10. It compiles and runs on my laptop as well. Though I haven't tested all functionalities.

mani-monaj commented 8 years ago

@PhilippeMorere Thank you. I will make my comments on your PR.

di55olve88 commented 8 years ago

I was able to build and run the indigo-devel version using @PhilippeMorere fork of ardronelib on my Raspberry Pi 3. Everything appears to run well!

richardg71 commented 7 years ago

I just confirmed that this worked with Ubuntu MATE and ROS kinetic with the indigo-devel version. I was also able to install and run the ardrone_tutorials.

opan08 commented 7 years ago

@PhilippeMorere thanks too much! I just confirmed that this worked with pi3 Ubuntu MATE and ROS kinetic with the indigo-devel version.

sd12832 commented 7 years ago

@PhilippeMorere @opan08 @richardg71 @mani-monaj What do you mean when you say the indigo-devel version?

sd12832 commented 7 years ago

@PhilippeMorere @opan08 @richardg71 @mani-monaj I am currently working on a Raspberry Pi 3 and using ROS Kinetic on Ubuntu MATE 16.04 LTS. I just git cloned the actual project into my ~/catkin_ws/src and tried to invoke catkin_make from my ~/catkin_ws. I started getting errors related to bswap. Now that I used @PhilippeMorere patch, I seem to be getting the error related to ffmpeg. But once I removed it from my Pi, and invoked catkin_make, it started working again. Thanks! Though my previous question about indigo-devel version still stands.

mani-monaj commented 7 years ago

@sd12832 I am glad you could make it work!

Thanks! Though my previous question about indigo-devel version still stands.

Are you using the indigo-devel branch of ardrone_autonomy?

sd12832 commented 7 years ago

@mani-monaj No I am not as of now.

mani-monaj commented 7 years ago

@sd12832 I will close this issue since the problem seems to be resolved. Feel free to re-open this if you have any further question/update.

shreks7 commented 6 years ago

After following @PhilippeMorere instructions I get this issue -

Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_perf /tmp/ccQmijMw.s: Assembler messages: /tmp/ccQmijMw.s:130: Error: unexpected characters following instruction at operand 2 -- mov x4,x4,ror#8'

Anyone getting the same error? How do you fix it?

20chix commented 5 years ago

screenshot from 2018-10-29 11-07-29

After following @PhilippeMorere instructions I get this issue, any suggestions?

Edit: ROS Kinetic, RPi 3, Ubuntu Mate 16.04

Resolved

Just to let everyone know I resolved this issue by doing these commands from this page (https://ardrone-autonomy.readthedocs.io/en/latest/installation.html)

PS: I have Kinetic and still worked.

$ cd ~/catkin_ws/src
$ git clone https://github.com/AutonomyLab/ardrone_autonomy.git -b indigo-devel
$ cd ~/catkin_ws
$ rosdep install --from-paths src -i

Then I followed @PhilippeMorere instructions and it worked :)

Thanks

Funderburger commented 5 years ago

Hi, I'm getting the same error as @shreks7. Does anyone know how to solve that? (I'm working on a Jetson Nano which has armv8 -it might be this the problem?)

EDIT: I found the solution here.

issouker97 commented 4 years ago

hi @PhilippeMorere i'm so grateful four the efforts that you have done for us , actually i have tried to follow your method because i have faced the same problem so when i change the line number 80 with what you have recommended and tap the rest of the commands i ended up with a new error : make[7]: [all] Error 2 make[6]: [build_vlib] Error 2 make[5]: [all] Error 2 make[4]: [build_libs] Error 2 make[3]: [all] Error 2 make[2]: [/home/islamusma/catkin_ws/devel/src/ardronelib-stamp/ardronelib-build] Error 2 make[1]: [ardrone_autonomy/CMakeFiles/ardronelib.dir/all] Error 2 make: [all] Error 2 Invoking "make -j2" failed could you possibly help me to solve this problem , i will be absolutely delighted for that , thanks in advance