ros / roscpp_core

ros distribution sandbox
89 stars 116 forks source link

OSX compile fix #15

Closed hgaiser closed 10 years ago

hgaiser commented 11 years ago

I am not sure why this is in message_forward.h, but when compiling on OSX 10.9 with libc++ this causes an error when compiling with generated messages.

Not sure this is the proper fix, but it worked for me.

jensenb commented 11 years ago

Removing the forward declaration also solved the problem for me with clang/libc++ on Mavericks. Why is that even needed? Compilation speed up? In any case I am pretty sure adding declarations to namespace std is undefined behaviour (C++ std 17.4.3.1/1), unless they are template specializations.

dirk-thomas commented 11 years ago

The header file uses it later (https://github.com/hgaiser/roscpp_core/blob/573448adf6f5ac64611c17d3933345c7367c360f/roscpp_traits/include/ros/message_forward.h#L54) and since it does not import anything it must have a forward declaration for the type.

Can you please post the error message you are getting?

jensenb commented 11 years ago

Here is a gist of the error: https://gist.github.com/jensenb/30563a884c1c76eeb401 . It occurs in the dependent package eigen_conversions. Maybe the include <memory>is missing?

jensenb commented 10 years ago

I did some more research into the issue, and although forward declaring STL stuff is undefined behaviour, only libc++ has a problem with it. The Boost guys also ran into similar issues, and they solved it by conditionally including the appropriate headers on libc++ systems, and using their forward declarations on systems where this was not a problem. That would something like e4dff32c8847f7e9e16b3aecebbbbaf7d84daf5a.

jensenb commented 10 years ago

Have you been able to understand the error on libc++ systems?

dirk-thomas commented 10 years ago

Fixes with a preprocessor conditional as mentioned in e4dff32c8847f7e9e16b3aecebbbbaf7d84daf5a.

wjwwood commented 10 years ago

Should this commit, https://github.com/ros/roscpp_core/commit/e4dff32c8847f7e9e16b3aecebbbbaf7d84daf5a, be back ported to Groovy? I still get this compile error when building Groovy on Mavericks.

hgaiser commented 10 years ago

Yes most likely, actually to any ros distro that has this.

jensenb commented 10 years ago

I also think so.

dirk-thomas commented 10 years ago

Done in fb997090a6d58f2b01000cc4552f659c08e61c5e

wjwwood commented 10 years ago

Thanks.