[ros-users] 32 bit compile on 64-bit machine

Brian Gerkey gerkey at willowgarage.com
Mon Jun 14 16:29:44 UTC 2010


hi Jeff,

On Mon, Jun 14, 2010 at 6:24 AM, Jeff Hyams <jeff.hyams at resquared.com> wrote:
> I am trying to get ROS to compile with 32 bit (-m32) libraries on an 64 bit
> kernel.  I am wondering two things
> about the build:
>
> 1.  Is there a way in one of my nodes to "inject" the -m32 compile option to
> all dependent packages when building my package? Or will
>      I need to edit each individual package's CMake files to get the -m32
> option in there?

The build system allows you to specify default compile and link flags
to be passed to all packages:
http://www.ros.org/wiki/rosbuild#Customizing_the_build_.28debug.2C_optimizations.2C_default_build_flags.29
.  For example, if you want to add "-m32" to all compile and link
steps for all packages, you could put these lines in
$ROS_ROOT/rosconfig.cmake (manually prepending the default values from
rosbuild/rosconfig.cmake):
  set(ROS_COMPILE_FLAGS "-W -Wall -Wno-unused-parameter
-fno-strict-aliasing -pthread -m32")
  set(ROS_LINK_FLAGS "-pthread -m32")

Alternatively, if you want only packages that depend on package 'foo'
to be built with certain flags, you can export them from
foo/manifest.xml, e.g.:
  <export>
    <cpp cflags="-m32" lflags="-m32"/>
  </export>
Note that this mechanism does *not* allow you to specify build flags
for packages on which 'foo' depends.  Package dependency is one-way.

> 2.  I think the answer to the following is that it I'd have to do it myself,
> but I'll ask anyways:
>        I need to still compile 64 bit ROS packages as well as my single 32
> bit package.  Is there a method in the build system already to allow
>        both 32 bit and 64-bit compiled libraries to exist in a single ROS
> home?

No, there is no support for building libraries (or executables) in
both 32-bit and 64-bit.  There is support for building them both
statically-linked and dynamically-linked.

> 2a.  If the answer to the above is no(which I suspect it is after cursory
> examination), would the easiest option be to add a
>        separate ROS install, get it to compile all the libraries as 32
> bit(with whatever the answer to #1 would be), then use
>        that install to compile my package?  I don't have a ton of time to
> modify the build structure to allow both libraries to
>        exist at the moment, so I'm looking for a quick and easy solution.

I don't fully understand your use case, but I suspect that the answer
here is yes.

	brian.



More information about the ros-users mailing list