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

Building nodes as 32bit on 64 bit machine

asked 2014-10-02 20:40:17 -0500

Robocop87 gravatar image

Hey everyone!

I am using a node that was developed using a 32 bit closed source library. I only have access to a 64bit computer, and there is no 64 bit version of the library. I would like to build my node which depends on the 32 bit library as a 32 bit application in order to make this work.

I found this website which shows how to do it using rosbuild:

but I need a solution for catkin. Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-02 23:04:01 -0500

ahendrix gravatar image

That post suggests that setting the -m32 compile and link flags will compile your node as a 32-bit executable.

Since catkin is pure cmake, you should be able to use set_target_properties to add -m32 to the LINK_FLAGS and COMPILE_FLAGS properties on the node in question.

That said, this may not work very well if the ROS libraries that you're trying to link with are 64-bit. You may have to set up a separate workspace and build your node and all of its dependencies in 32-bit mode. In this case, you'll probably just want to set the CMAKE_CXX_FLAGS globally when you call catkin_make.

edit flag offensive delete link more


Sorry for the late response, I'm not familiar at all with cmake and the docs look pretty intimidating. I'll give them a read and try it out.

Robocop87 gravatar image Robocop87  ( 2014-10-06 18:55:47 -0500 )edit

Yeah, cmake can be a bit intimidating, but it's a whole lot better than writing raw makefiles or trying to use autotools, particularly when you have a large project with complex cross-project dependencies.

ahendrix gravatar image ahendrix  ( 2014-10-06 19:14:20 -0500 )edit

Is it possible to use something like ia32-libs to let me build my node as 64 bit but use the 32 bit library?

Robocop87 gravatar image Robocop87  ( 2014-10-06 19:21:34 -0500 )edit

No. ia32-libs is the older 32-bit compatibility libraries (before Debian had proper multi-arch support). The Kernel is capable of running 32- or 64-bit binaries, but binaries can't switch between 32- and 64-bit mode while running.

ahendrix gravatar image ahendrix  ( 2014-10-06 22:53:02 -0500 )edit

additional comment to above solution

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

Asan A. gravatar image Asan A.  ( 2021-06-17 09:28:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-02 20:40:17 -0500

Seen: 1,212 times

Last updated: Oct 02 '14