ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Linking with 32 bit libraries [closed]

asked 2012-08-20 10:11:07 -0500

jdlangs gravatar image

I am trying to build a C++ ROS node that uses functionality from a proprietary library where I only have 32-bit binaries. I know from experience that ld will not link binaries of different architectures so is there any alternative for me to make it work?

If not, is it at all feasible to set up/build a 32-bit ros installation with a minimum of pain?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by jdlangs
close date 2017-11-21 11:10:47.079607

3 Answers

Sort by ยป oldest newest most voted

answered 2012-08-20 17:05:19 -0500

joq gravatar image

updated 2012-08-20 17:06:19 -0500

Setting up a 32-bit ROS installation is easy if you start with a 32-bit Ubuntu installation. The 32-bit binaries will be installed automatically if you follow the ROS installation instructions.

edit flag offensive delete link more

answered 2015-01-16 01:08:51 -0500

BennyRe gravatar image

I know your problem very well, I have the same.

If a 64-bit system is not absolutely necessary for your use case, prefer @joq answer instead of mine!

I compile my node with the flags:

set_target_properties(asr_node PROPERTIES COMPILE_FLAGS "-m32 -fPIC")
set_target_properties(asr_node PROPERTIES LINK_FLAGS -m32)

Now the headache part begins. As @raul.perula stated the flags alone aren't sufficient. The libraries your package depends on are also required in 32 bit. So, I deliver the required ROS libraries (and some others) in 32-bit binaries with my package. Other system side dependencies I install as rosdeps. For others that aren't installable with rosdep I perform a check in my CMakeLists.txt and for the case they aren't installed I print a apt-get install command to install them. (So yes my system is polluted with 32-bit crap everywhere)

Sounds dirty and in my opinion it is dirty, but I got a 32 bit node running with a 64 bit ROS and it works like a charm.

edit flag offensive delete link more


I think that could be a solution, but yes, it is a very dirty solution. I will prefer, for instance, to download the 32-bit roscpp ROS library and to link that one.

How have you got the required ROS libraries in 32-bit binaries without compile them?

raul.perula gravatar image raul.perula  ( 2015-01-16 02:39:49 -0500 )edit

You can download the .dep files from These files you open with an archive manager and get the libraries.

BennyRe gravatar image BennyRe  ( 2015-01-16 03:36:44 -0500 )edit

Ok. A couple of new questions @BennyRe.

1.- Where do you put the .so lib file? In a "lib" folder inside the project? 2.- How do you specify in the CMakeFile.txt to link with that file?


raul.perula gravatar image raul.perula  ( 2015-01-16 08:20:36 -0500 )edit
  1. Yes I've got a lib folder in my package.
  2. I add them to target_link_libraries and remove the catkin_LIBRARIES from there. I had to remove them because they would add the 64-bit libraries from the system.
BennyRe gravatar image BennyRe  ( 2015-01-19 02:50:00 -0500 )edit

how to install others 32 bit dependencies like roscpp and etc?

khairulizwan gravatar image khairulizwan  ( 2016-01-31 23:01:31 -0500 )edit

or maybe the doubt is how you do the deliver the required ROS libraries (which is 32 bit right; like roscpp and etc) ?

khairulizwan gravatar image khairulizwan  ( 2016-01-31 23:15:27 -0500 )edit

I deliver the required ROS libraries (and some others) in 32-bit binaries with my package in a libs directory.

BennyRe gravatar image BennyRe  ( 2016-02-01 07:02:17 -0500 )edit

how did you do that, i am sorry i am newbie about linux and ros too..where did you get the file and etc...

khairulizwan gravatar image khairulizwan  ( 2016-02-01 20:12:11 -0500 )edit

answered 2015-01-15 11:50:13 -0500

I am in the same situation, I want to compile my code (ROS Hydro with catkin, Ubuntu 12.04 64b) with a third-party code in 32b.

I tried putting the "set_target_properties" to 32b:

set_target_properties(rfid_driver_wrapper PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")

But I get this error:

/opt/ros/hydro/lib/ could not read symbols: File in wrong format

Could anybody help me?

edit flag offensive delete link more



Please do not ask questions in answers. Feel free to open a new question. Short answer to your question: You have to install all the dependencies of your package in 32 bit. (BTW: What RFID device do you wrap?)

BennyRe gravatar image BennyRe  ( 2015-01-16 00:54:53 -0500 )edit

Thanks for your reply @BennyRe.

Ok, next time I will open a new question. I thought that it was better to extend a question unanswered to solve the question.

I am using the Feig Electronic ID ISC.MR101-USB 13.56 MHz RFID. It is a little old but it is what I have.

raul.perula gravatar image raul.perula  ( 2015-01-16 02:35:00 -0500 )edit

Now i get same error like @raul.perula.

I am searching the on the shared link. But i could not find it.

khairulizwan gravatar image khairulizwan  ( 2016-02-02 22:22:25 -0500 )edit

Question Tools


Asked: 2012-08-20 10:11:07 -0500

Seen: 1,196 times

Last updated: Jan 16 '15