Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is all the things I needed to do to get it to compile (not work) for OSX :

Do the change as described by tkoolen

Add :

set_property(TARGET ${OGRE_PROJECT_NAME} PROPERTY MACOSX_BUNDLE TRUE)

to the gz_add_executable macro

Add :

${Boost_LIBRARIES}

to the opende link libraries.

Add :

#if __APPLE__
int isinf( double x ) { return x == x - 1; }
#endif

to gazebo/common/PID.cc

Change the following in gazebo/common/Time.h

 29 #ifdef __MACH__
 30 #include <mach/clock.h>
 31 #include <mach/mach.h>
 32 #include <unistd.h>
 33 #endif

 49 #ifdef __MACH__
 50   clock_resolution.tv_sec = 1 / sysconf(_SC_CLK_TCK);
 51 #else
 52   clock_getres(CLOCK_REALTIME, &clock_resolution);
 53 #endif

 98 #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
 99   clock_serv_t cclock;
100   mach_timespec_t mts;
101   host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
102   clock_get_time(cclock, &mts);
103   mach_port_deallocate(mach_task_self(), cclock);
104   tv.tv_sec = mts.tv_sec;
105   tv.tv_nsec = mts.tv_nsec;
106 #else
107   clock_gettime(0, &tv);
108 #endif

186 #ifdef __MACH__
187     if (nanosleep(&nsleep, &remainder) == -1)
188 #else
189     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
190 #endif

216 #ifdef __MACH__
217     if (nanosleep(&nsleep, &remainder) == -1)
218 #else
219     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
220 #endif

Removed rt from linking library in gazebo/common/CMakeLists.txt

There are some conflicts with generated files and existing files that have the same name but different capitals, which gives conflicts on OSX, therefore you must rename the following files :

gazebo/transport/Transport.hh -> gazebo/transport/Transport.h

Also change in :
gazebo/transport/CMakeLists.txt
gazebo/transport/Transport.cc

gazebo/physics/Physics.hh -> gazebo/physics/Physics.h

Also change in :
gazebo/physics/CMakeLists.txt
gazebo/physics/Physics.cc

gazebo/common/Common.hh -> gazebo/common/Common.h

Also change in :
gazebo/common/CMakeLists.txt
gazebo/common/Common.cc

gazebo/sensors/Sensors.hh -> gazebo/sensors/Sensors.h

Also change in :
gazebo/sensors/CMakeLists.txt
gazebo/sensors/Common.cc

gazebo/rendering/Rendering.hh -> gazebo/rendering/Rendering.h

Also change in :
gazebo/rendering/CMakeLists.txt
gazebo/rendering/Rendering.cc

Add the following include and link directories in the main CMakeLists.txt (perhaps better to place these in the parts that actually need them, got lazy)

 include_directories(/opt/X11/include)
 link_directories(/opt/X11/lib)

Assuming X11 is located there.

Add :

 add_dependencies(gzlog gtest)
 add_dependencies(gzlog gtest_main)

Disable gz_log from tools/test/CMakeLists.txt

Change the following line in gazebui/gui/GLWidget.cc

 718 #if defined(WIN32) || defined(__APPLE__)

Replace google::protobuf::FieldDescriptor::TYPE_BOOL with 1 in gazebo/gui/ModelListWidget.cc

Add GL and GLU to the link target for gzclient

But, now I am stuck on segfaults :)

Here is all the things I needed to do to get it to compile (not work) for OSX :

Do the change as described by tkoolen

Add :

set_property(TARGET ${OGRE_PROJECT_NAME} PROPERTY MACOSX_BUNDLE TRUE)

to the gz_add_executable macro

Add :

${Boost_LIBRARIES}

to the opende link libraries.

Add :

#if __APPLE__
int isinf( double x ) { return x == x - 1; }
#endif

to gazebo/common/PID.cc

Change the following in gazebo/common/Time.h

 29 #ifdef __MACH__
 30 #include <mach/clock.h>
 31 #include <mach/mach.h>
 32 #include <unistd.h>
 33 #endif

 49 #ifdef __MACH__
 50   clock_resolution.tv_sec = 1 / sysconf(_SC_CLK_TCK);
 51 #else
 52   clock_getres(CLOCK_REALTIME, &clock_resolution);
 53 #endif

 98 #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
 99   clock_serv_t cclock;
100   mach_timespec_t mts;
101   host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
102   clock_get_time(cclock, &mts);
103   mach_port_deallocate(mach_task_self(), cclock);
104   tv.tv_sec = mts.tv_sec;
105   tv.tv_nsec = mts.tv_nsec;
106 #else
107   clock_gettime(0, &tv);
108 #endif

186 #ifdef __MACH__
187     if (nanosleep(&nsleep, &remainder) == -1)
188 #else
189     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
190 #endif

216 #ifdef __MACH__
217     if (nanosleep(&nsleep, &remainder) == -1)
218 #else
219     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
220 #endif

Removed rt from linking library in gazebo/common/CMakeLists.txt

There are some conflicts with generated files and existing files that have the same name but different capitals, which gives conflicts on OSX, therefore you must rename the following files :

gazebo/transport/Transport.hh -> gazebo/transport/Transport.h

Also change in :
gazebo/transport/CMakeLists.txt
gazebo/transport/Transport.cc

gazebo/physics/Physics.hh -> gazebo/physics/Physics.h

Also change in :
gazebo/physics/CMakeLists.txt
gazebo/physics/Physics.cc

gazebo/common/Common.hh -> gazebo/common/Common.h

Also change in :
gazebo/common/CMakeLists.txt
gazebo/common/Common.cc

gazebo/sensors/Sensors.hh -> gazebo/sensors/Sensors.h

Also change in :
gazebo/sensors/CMakeLists.txt
gazebo/sensors/Common.cc

gazebo/rendering/Rendering.hh -> gazebo/rendering/Rendering.h

Also change in :
gazebo/rendering/CMakeLists.txt
gazebo/rendering/Rendering.cc

Add the following include and link directories in the main CMakeLists.txt (perhaps better to place these in the parts that actually need them, got lazy)

 include_directories(/opt/X11/include)
 link_directories(/opt/X11/lib)

Assuming X11 is located there.

Add :

 add_dependencies(gzlog gtest)
 add_dependencies(gzlog gtest_main)

Disable gz_log from tools/test/CMakeLists.txt

Change the following line in gazebui/gui/GLWidget.cc

 718 #if defined(WIN32) || defined(__APPLE__)

Replace google::protobuf::FieldDescriptor::TYPE_BOOL with 1 in gazebo/gui/ModelListWidget.cc

Add GL and GLU to the link target for gzclient

But, now I am stuck on segfaults :)

EDIT: Ok, no segfaults, however it depends on Ogre and indirectly on CEGUI, however CEGUI on OSX 64 bit is not available :( not a stable branch at least and taking the unstable branch causes a whole new world of compile errors.

Here is all the things I needed to do to get it to compile (not work) for OSX :

Do the change as described by tkoolen

Add :

set_property(TARGET ${OGRE_PROJECT_NAME} PROPERTY MACOSX_BUNDLE TRUE)

to the gz_add_executable macro

Add :

${Boost_LIBRARIES}

to the opende link libraries.

Add :

#if __APPLE__
int isinf( double x ) { return x == x - 1; }
#endif

to gazebo/common/PID.cc

Change the following in gazebo/common/Time.h

 29 #ifdef __MACH__
 30 #include <mach/clock.h>
 31 #include <mach/mach.h>
 32 #include <unistd.h>
 33 #endif

 49 #ifdef __MACH__
 50   clock_resolution.tv_sec = 1 / sysconf(_SC_CLK_TCK);
 51 #else
 52   clock_getres(CLOCK_REALTIME, &clock_resolution);
 53 #endif

 98 #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
 99   clock_serv_t cclock;
100   mach_timespec_t mts;
101   host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
102   clock_get_time(cclock, &mts);
103   mach_port_deallocate(mach_task_self(), cclock);
104   tv.tv_sec = mts.tv_sec;
105   tv.tv_nsec = mts.tv_nsec;
106 #else
107   clock_gettime(0, &tv);
108 #endif

186 #ifdef __MACH__
187     if (nanosleep(&nsleep, &remainder) == -1)
188 #else
189     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
190 #endif

216 #ifdef __MACH__
217     if (nanosleep(&nsleep, &remainder) == -1)
218 #else
219     if (clock_nanosleep(CLOCK_REALTIME, 0, &nsleep, &remainder) == -1)
220 #endif

Removed rt from linking library in gazebo/common/CMakeLists.txt

There are some conflicts with generated files and existing files that have the same name but different capitals, which gives conflicts on OSX, therefore you must rename the following files :

gazebo/transport/Transport.hh -> gazebo/transport/Transport.h

Also change in :
gazebo/transport/CMakeLists.txt
gazebo/transport/Transport.cc

gazebo/physics/Physics.hh -> gazebo/physics/Physics.h

Also change in :
gazebo/physics/CMakeLists.txt
gazebo/physics/Physics.cc

gazebo/common/Common.hh -> gazebo/common/Common.h

Also change in :
gazebo/common/CMakeLists.txt
gazebo/common/Common.cc

gazebo/sensors/Sensors.hh -> gazebo/sensors/Sensors.h

Also change in :
gazebo/sensors/CMakeLists.txt
gazebo/sensors/Common.cc

gazebo/rendering/Rendering.hh -> gazebo/rendering/Rendering.h

Also change in :
gazebo/rendering/CMakeLists.txt
gazebo/rendering/Rendering.cc

Add the following include and link directories in the main CMakeLists.txt (perhaps better to place these in the parts that actually need them, got lazy)

 include_directories(/opt/X11/include)
 link_directories(/opt/X11/lib)

Assuming X11 is located there.

Add :

 add_dependencies(gzlog gtest)
 add_dependencies(gzlog gtest_main)

Disable gz_log from tools/test/CMakeLists.txt

Change the following line in gazebui/gui/GLWidget.cc

 718 #if defined(WIN32) || defined(__APPLE__)

Replace google::protobuf::FieldDescriptor::TYPE_BOOL with 1 in gazebo/gui/ModelListWidget.cc

Add GL and GLU to the link target for gzclient

But, now I am stuck on segfaults :)

EDIT: Ok, no segfaults, however it depends I can't seem to process any input :( I get two windows of gazebo but nothing happens if I click on Ogre and indirectly on CEGUI, however CEGUI on OSX 64 bit is not available :( not a stable branch at least and taking the unstable branch causes a whole new world of compile errors.

them.