[ros-users] Integrating ROS node subscriber with X-Plane plugin

Clayton Morrison clayton at cs.arizona.edu
Mon Aug 2 06:11:52 UTC 2010


Hi Josh,

Thank you for the help!  (I'm Clay, btw -- forgot to sign my previous email; I cc'd Tom and Ian, who are helping me.)

I didn't think to check the Mac crash report, which was an oversight on my part.  Below (Under the OSX Crash Report heading) is the report for when I execute xplane with the "bad" version of the plugin (trying to execute ros::init()).  The symbol '__ZN3ros4initERKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS4_j' is reported as not found.  
(I also attached below the dribble of a simple run of X-Plane under gdb -- basically the same thing.)  
It is definitely not finding ros::init(map<string,string>,...).

I ran
	$ make clean
	$ VERBOSE=1 make
in my package -- the output is attached at the bottom.  The part that sticks out to me are these messages:
file was built for unsupported file format which is not the architecture being linked (i386)

I looked into the link you suggested for modifying ROS_COMPILE_FLAGS.  Ian suggested I try appending -arch i385 to attempt to get ros to build everything for i386 (which I take the above messages to be about).  The verbose make output attached below is actually based on this -- I still get the message about the dylibs not being the right format, although I do see the -arch flags appearing in the make.  This suggests to me that my flags are not being appropriately propagated up to rebuild all of the parts of ros that I depend on.  

Below I also attached my current CMakeLists.txt.

> What does 'file `rospack find roscpp`/lib/libros.dylib' tell you?


I tried this but I think I'm misunderstanding how to execute what you suggested.  I did execute the following with these results:
	$ rospack find roscpp/lib/libros.dylib
	[rospack] couldn't find package [roscpp/lib/libros.dylib]
(I tried other variants of his command (e.g., 'rospack find roscpp /lib/libros.dylib') but these isn't recognized as valid by rospack.)  
I think I'm doing this wrong.  At any rate, I did verify that libros.dylib does exist here: 
	<rosroot>/ros/core/roscpp/lib/libros.dylib


So my current best guess is that I need to recompile the dylibs targeting i386, but I'm not sure how to do this (I see warnings about modifying the CMakeLists.txt in ros core).

Thanks,

-Clay


-----------------
OSX Crash Report:
-----------------

Process:         X-Plane [47144]
Path:            /Applications/X-Plane-9/X-Plane.app/Contents/MacOS/X-Plane
Identifier:      com.laminar_research.X-Plane
Version:         9.60 (398)
Code Type:       X86 (Native)
Parent Process:  launchd [82]

Date/Time:       2010-08-01 22:45:44.812 -0700
OS Version:      Mac OS X 10.6.4 (10F569)
Report Version:  6

Interval Since Last Report:          1915213 sec
Crashes Since Last Report:           71
Per-App Interval Since Last Report:  9021 sec
Per-App Crashes Since Last Report:   47
Anonymous UUID:                      6C1CAA8C-6A69-49D5-8E9C-32F61F9CAB2E

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Dyld Error Message:
  Symbol not found: __ZN3ros4initERKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS4_j
  Referenced from: /Applications/X-Plane-9/Resources/plugins/XP_ROS_Plugin.xpl
  Expected in: flat namespace

Model: MacBookPro6,2, BootROM MBP61.0057.B09, 2 processors, Intel Core i7, 2.66 GHz, 8 GB, SMC 1.58f16
Graphics: NVIDIA GeForce GT 330M, NVIDIA GeForce GT 330M, PCIe, 512 MB
Graphics: Intel HD Graphics, Intel HD Graphics, Built-In, 288 MB
Memory Module: global_name
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom BCM43xx 1.0 (5.10.131.16.1)
Bluetooth: Version 2.3.3f8, 2 service, 12 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Network Service: AirPort, AirPort, en1
Serial ATA Device: ST9500420ASG, 465.76 GB
Serial ATA Device: MATSHITADVD-R   UJ-898
USB Device: Hub, 0x0424  (SMSC), 0x2514, 0xfa100000
USB Device: Internal Memory Card Reader, 0x05ac  (Apple Inc.), 0x8403, 0xfa130000
USB Device: Apple Internal Keyboard / Trackpad, 0x05ac  (Apple Inc.), 0x0236, 0xfa120000
USB Device: BRCM2070 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0xfa110000
USB Device: Bluetooth USB Host Controller, 0x05ac  (Apple Inc.), 0x8218, 0xfa113000
USB Device: Hub, 0x0424  (SMSC), 0x2514, 0xfd100000
USB Device: Optical Mouse, 0x0458  (KYE Systems Corp. (Mouse Systems)), 0x003a, 0xfd130000
USB Device: IR Receiver, 0x05ac  (Apple Inc.), 0x8242, 0xfd120000
USB Device: Built-in iSight, 0x05ac  (Apple Inc.), 0x8507, 0xfd110000



-----------
gdb report:
-----------

galeru:X-Plane-9 clayton$ gdb X-Plane.app
GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar  5 04:43:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ............. done

(gdb) run
Starting program: /Applications/X-Plane-9/X-Plane.app/Contents/MacOS/X-Plane 
Reading symbols for shared libraries .++++++++++++....................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
dyld: lazy symbol binding failed: Symbol not found: __ZN3ros4initERKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS4_j
  Referenced from: /Applications/X-Plane-9/Resources/plugins/XP_ROS_Plugin.xpl
  Expected in: flat namespace

dyld: Symbol not found: __ZN3ros4initERKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS4_j
  Referenced from: /Applications/X-Plane-9/Resources/plugins/XP_ROS_Plugin.xpl
  Expected in: flat namespace


Program received signal SIGTRAP, Trace/breakpoint trap.
0x8fe01065 in __dyld_dyld_fatal_error ()
(gdb) 



---------------
VERBOSE=1 make:
---------------

galeru:xplane_plugin_node clayton$ VERBOSE=1 make
/opt/local/bin/cmake -H/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node -B/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node --check-build-system CMakeFiles/Makefile.cmake 0
/opt/local/bin/cmake -E cmake_progress_start /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/depend
cd /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles/rospack_genmsg_libexe.dir/DependInfo.cmake --color=
make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/build
make[2]: Nothing to be done for `CMakeFiles/rospack_genmsg_libexe.dir/build'.
/opt/local/bin/cmake -E cmake_progress_report /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles 
[  0%] Built target rospack_genmsg_libexe
make -f CMakeFiles/rosbuild_precompile.dir/build.make CMakeFiles/rosbuild_precompile.dir/depend
cd /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles/rosbuild_precompile.dir/DependInfo.cmake --color=
make -f CMakeFiles/rosbuild_precompile.dir/build.make CMakeFiles/rosbuild_precompile.dir/build
make[2]: Nothing to be done for `CMakeFiles/rosbuild_precompile.dir/build'.
/opt/local/bin/cmake -E cmake_progress_report /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles 
[  0%] Built target rosbuild_precompile
make -f CMakeFiles/XP_ROS_Plugin.dir/build.make CMakeFiles/XP_ROS_Plugin.dir/depend
cd /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles/XP_ROS_Plugin.dir/DependInfo.cmake --color=
make -f CMakeFiles/XP_ROS_Plugin.dir/build.make CMakeFiles/XP_ROS_Plugin.dir/build
/opt/local/bin/cmake -E cmake_progress_report /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles 1
[100%] Building CXX object CMakeFiles/XP_ROS_Plugin.dir/src/XP_ROS_Plugin.o
/usr/bin/c++   -DXP_ROS_Plugin_EXPORTS -D APL -m32 -D XPLM200 -D XPLM=1 -O2 -g -fPIC -I/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/include -I/Users/clayton/Documents/repository/ros/ros/core/roscpp/include -I/Users/clayton/Documents/repository/ros/ros/core/roscpp/msg_gen/cpp/include -I/Users/clayton/Documents/repository/ros/ros/core/roscpp/srv_gen/cpp/include -I/Users/clayton/Documents/repository/ros/ros/3rdparty/xmlrpcpp/src -I/Users/clayton/Documents/repository/ros/ros/std_msgs/include -I/Users/clayton/Documents/repository/ros/ros/std_msgs/msg_gen/cpp/include -I/Users/clayton/Documents/repository/ros/ros/core/rosconsole/include -I/Users/clayton/Documents/repository/ros/ros/core/roslib/include -I/Users/clayton/Documents/repository/ros/ros/core/roslib/msg_gen/cpp/include -I/Users/clayton/Documents/repository/ros/ros/tools/rospack -I/Users/clayton/Documents/repository/ros/ros/tools/rospack/include -I/Users/clayton/Documents/repository/ros/ros/3rdparty/gtest/gtest/include -I/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/xplane_sdk/Widgets -I/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/xplane_sdk/XPLM   -DROS_PACKAGE_NAME='"xplane_plugin_node"' -W -Wall -Wno-unused-parameter -fno-strict-aliasing -pthread -arch i386 -o CMakeFiles/XP_ROS_Plugin.dir/src/XP_ROS_Plugin.o -c /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp: In function ‘float MyFlightLoopCallback(float, float, int, void*)’:
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp:60: warning: deprecated conversion from string constant to ‘char*’
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp: In function ‘int XPluginStart(char*, char*, char*)’:
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp:76: warning: deprecated conversion from string constant to ‘char*’
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp:78: warning: deprecated conversion from string constant to ‘char*’
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp:80: warning: deprecated conversion from string constant to ‘char*’
/Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/src/XP_ROS_Plugin.cpp:82: warning: deprecated conversion from string constant to ‘char*’
Linking CXX shared library lib/XP_ROS_Plugin.xpl
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/XP_ROS_Plugin.dir/link.txt --verbose=1
/usr/bin/c++  -D APL -m32 -D XPLM200 -D XPLM=1 -O2 -g -dynamiclib -headerpad_max_install_names -Wl,-rpath,/Users/clayton/Documents/repository/ros/ros/core/roscpp/lib -Wl,-rpath,/Users/clayton/Documents/repository/ros/ros/3rdparty/xmlrpcpp/lib -Wl,-rpath,/Users/clayton/Documents/repository/ros/ros/core/rosconsole/lib -Wl,-rpath,/Users/clayton/Documents/repository/ros/ros/core/roslib/lib -Wl,-rpath,/Users/clayton/Documents/repository/ros/ros/tools/rospack/lib -pthread -arch i386 -undefined dynamic_lookup -o lib/XP_ROS_Plugin.xpl -install_name /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/lib/XP_ROS_Plugin.xpl CMakeFiles/XP_ROS_Plugin.dir/src/XP_ROS_Plugin.o -L/Users/clayton/Documents/repository/ros/ros/core/roscpp/lib -L/Users/clayton/Documents/repository/ros/ros/3rdparty/xmlrpcpp/lib -L/Users/clayton/Documents/repository/ros/ros/core/rosconsole/lib -L/Users/clayton/Documents/repository/ros/ros/core/roslib/lib -L/Users/clayton/Documents/repository/ros/ros/tools/rospack/lib -L/Users/clayton/Documents/repository/ros/ros/3rdparty/gtest/gtest/lib -lros -lboost_signals-mt -lXmlRpc -lrosconsole -lboost_thread-mt -llog4cxx -lroslib -lrospack -lrosstack 
ld: warning: in /Users/clayton/Documents/repository/ros/ros/core/roscpp/lib/libros.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libboost_signals-mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/clayton/Documents/repository/ros/ros/3rdparty/xmlrpcpp/lib/libXmlRpc.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/clayton/Documents/repository/ros/ros/core/rosconsole/lib/librosconsole.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libboost_thread-mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/liblog4cxx.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/clayton/Documents/repository/ros/ros/core/roslib/lib/libroslib.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/clayton/Documents/repository/ros/ros/tools/rospack/lib/librospack.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/clayton/Documents/repository/ros/ros/tools/rospack/lib/librosstack.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
/opt/local/bin/cmake -E cmake_progress_report /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles  1
[100%] Built target XP_ROS_Plugin
/opt/local/bin/cmake -E cmake_progress_start /Users/clayton/Documents/repository/ros/ua-ros-pkg/ua_bootstrapped_learning/xplane_plugin_node/CMakeFiles 0



---------------
CMakeLists.txt:
---------------

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

set(XPLANE_SDK_ROOT "${PROJECT_SOURCE_DIR}/src/xplane_sdk")

set(OS_COMPILE_FLAGS "-D APL -m32")
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")

include_directories("${XPLANE_SDK_ROOT}/Widgets")
include_directories("${XPLANE_SDK_ROOT}/XPLM")

set(CMAKE_C_FLAGS "${OS_COMPILE_FLAGS} -D XPLM200 -D XPLM=1")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")

file(GLOB SRC_FILES "src/*.cpp")

set(ROS_COMPILE_FLAGS "${ROS_COMPILE_FLAGS} -arch i386") #  -arch x86_64")
set(ROS_LINK_FLAGS "${ROS_LINK_FLAGS} -arch i386") # -arch x86_64")

rosbuild_add_library(XP_ROS_Plugin ${SRC_FILES})
target_link_libraries(XP_ROS_Plugin ${OSX_LIBRARIES})
set_target_properties(XP_ROS_Plugin PROPERTIES PREFIX "" SUFFIX ".xpl")


On Aug 1, 2010, at 5:38 PM, Josh Faust wrote:

> Hi Tom,
> 
> What do you mean by x-plane crashing?  Does it output an error message?
> 
> 
> Some immediate hunches (but not sure how to verify/fix) and questions:
> (1) xplane is a 32bit application.  Could my build process (described below) be inadvertently using 64bit versions of compiled ROS libs?
> 
> This is certainly possible, though I would expect the linker to complain since it looks like you're only trying to build your executable 32bit and not the rest of your ROS dependencies.  What does 'file `rospack find roscpp`/lib/libros.dylib' tell you?
> 
> The first thing I'd check is if the correct compiler flags are actually getting through.  In your package:
> make clean
> VERBOSE=1 make
>  
> If they are, you probably need to set them for the rest of ROS as well by using the ROS_COMPILE_FLAGS cmake variable inside a custom rosconfig.cmake as explained here: http://www.ros.org/wiki/rosbuild#Customizing_the_build_.28debug.2C_optimizations.2C_default_build_flags.29
> 
> 
> 
> (2) I am calling ros::init() in a non-main fn, so I'm using the version based on map<string,string>.  I'm sending in an empty map b/c I have no params to remap.  Am I doing this wrong?  (source for XP_ROS_Plugin.cpp below; I did verify in an separate, non-X-Plane-related build that I can use ros::init() in this way without crashing...)
> 
> That should be fine.
>  
> (3) Generally: how does one go about debugging a setup like this (on mac, ros inside a plugin inside another app)?  How can I get more details about what is going on when ros::init() is called?
> 
> 
> You can usually debug these things the same way you'd debug anything else -- run xplane in gdb and go from there.  First I'd check what error message it's outputting when crashing though.  I'm not on my mac at the moment but if it's crashing with an OSX popup asking to report it you should be able to click the report button and it'll show a bunch more information.
> 
> Josh
>  
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

Clayton T. Morrison
Assistant Research Professor
University of Arizona
web: http://cs.arizona.edu/~clayton/
email: clayton at cs.arizona.edu
office: 520-621-6609



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100801/25aa278c/attachment-0003.html>


More information about the ros-users mailing list