Brian,

Thanks for the help.  I believe I will go ahead and just have a separate install that sets the -m32 compile flag
as part of the default. 

Since you asked, the scenario here is that I have several ROS nodes running on a 64 bit machine and
a third party library(for which I don't have access to the code) for one of the nodes only has a 32-bit version(currently). 
My hope is they will provide me with a 64-bit version soon, but in the meantime, I still need to move forward,
which I will by setting up a seperate ros build for the 32-bit package.

Thanks,

Jeff Hyams
RE2, Inc.
www.resquared.com



On Mon, Jun 14, 2010 at 12:29 PM, Brian Gerkey <gerkey@willowgarage.com> wrote:
hi Jeff,

On Mon, Jun 14, 2010 at 6:24 AM, Jeff Hyams <jeff.hyams@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.
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users